Does MYSQL provide a solution like The explode function in PHP?

Source: Internet
Author: User
Is there any explode function in MYSQL like PHP? ------ solution -------------------- here is an example of the stored procedure I wrote, which contains what you want. DELIMITER $ DROPPROCEDUREIFEXISTS 'sp _ get_new_release '$ CREATEDEFINER 'root' @ 'localh is there any explode function like PHP in MYSQL?
Consult

------ Solution --------------------
Here is an example of the stored procedure I wrote.
DELIMITER $

Drop procedure if exists 'sp _ get_new_release '$

Create definer = 'root' @ 'localhost' PROCEDURE 'sp _ get_new_release '(IN var_str varchar (20 ),
IN var_note_language char (5 ))
BEGIN
DECLARE cnt int;
DECLARE I int;
SET @ curs = var_str;
SET @ op = "'";
SET @ cur_lang = 'en ';
SET @ full_version = '';
SET @ SQL = 'select * FROM software_release a WHERE 1 = 1 ';
Select count (*) FROM software_release where strcmp (note_language, var_note_language) = 0 INTO cnt;
IF cnt! = 0 THEN
SET @ SQL = CONCAT (@ SQL, 'AND STRCMP (a. note_language,', @ op, var_note_language, @ op, ') = 0 ');
ELSE
SET @ SQL = CONCAT (@ SQL, 'AND STRCMP (a. note_language,', @ op, @ cur_lang, @ op, ') = 0 ');
End if;
Loop1: LOOP
SET I = LOCATE ('.', @ curs, 1 );
SET @ a = LEFT (@ curs, i-1 );
SET @ full_version = CONCAT (@ full_version, REPEAT ('0', (4-LENGTH (@ a), @ );
SET @ curs = SUBSTR (@ curs, I + 1 );
If instr (@ curs, '.') = 0 THEN
SET @ a = @ curs;
SET @ full_version = CONCAT (@ full_version, REPEAT ('0', (4-LENGTH (@ a), @ );
LEAVE loop1;
End if;
End loop loop1;
SET @ SQL = CONCAT (@ SQL, 'AND full_version> =', @ op, @ full_version, @ op );
PREPARE s1 FROM @ SQL;
EXECUTE s1;
Deallocate prepare s1;
END $

DELIMITER;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.