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;