Home Backend Development PHP Tutorial MYSQL里有没有像PHP里面的explode函数解决方法

MYSQL里有没有像PHP里面的explode函数解决方法

Jun 13, 2016 pm 01:49 PM
language set

MYSQL里有没有像PHP里面的explode函数
请教

------解决方案--------------------
给你一个我写的存储过程的例子,里面有你想要的。
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))),@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))),@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 ;

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Feb 26, 2024 pm 07:48 PM

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

System76 tips Fedora Cosmic spin for 2025 release with Fedora 42 System76 tips Fedora Cosmic spin for 2025 release with Fedora 42 Aug 01, 2024 pm 09:54 PM

System76 has made waves recently with its Cosmic desktop environment, which is slated to launch with the next major alpha build of Pop!_OS on August 8. However, a recent post on X by System76 CEO, Carl Richell, has tipped that the Cosmic DE developer

How to delete elements from set in javascript How to delete elements from set in javascript Jan 12, 2022 am 10:56 AM

Methods to delete elements: 1. Use delete() to delete the specified element from the Set object, the syntax is "setObj.delete(value);"; 2. Use clear() to delete all elements in the Set object, the syntax is "setObj.delete(value);" "setObj.clear();".

Inventory of common uses of dict and set in Python programming Inventory of common uses of dict and set in Python programming Jul 25, 2023 pm 04:52 PM

This article is based on the basics of Python and introduces how to use dict and set. The dict using the key-value storage structure is very useful in Python. It is important to choose an immutable object as the key. The most commonly used key is a string.

What is the difference between the set method and the add method in List in java? What is the difference between the set method and the add method in List in java? Apr 19, 2023 pm 07:49 PM

Preface There are two very similar methods in the commonly used collection interface List in Java: Eset(intindex,Eelement); voidadd(intindex,Eelement); both of these methods insert specified elements at specified positions in the collection, then What is the difference between these two methods? Next, let’s take a look at the differences and similarities between these two methods through ArrayList, our commonly used collection implementation. First, let’s take a look at the similarities between these two methods in ArrayList. They will insert new elements at specified positions in the collection, such as the following Example: #Insert an F in the 2nd position of the collection #Insert Listlist= through the add method

Comparison of Java Map and other collection frameworks: advantages and disadvantages analysis and application scenario guide Comparison of Java Map and other collection frameworks: advantages and disadvantages analysis and application scenario guide Feb 19, 2024 pm 10:24 PM

1. Overview of the Map Collection Framework The Map collection framework is a key-value pair data structure that allows you to use keys to find and store values. Each key in the Map is unique and can only be associated with one value. Common implementations in the Map collection framework include HashMap, TreeMap and LinkedHashMap. 1.HashMapHashMap is the most widely used Map implementation in Java. It stores data based on hash tables. HashMap has excellent performance, and the time complexity of search and insertion operations is O(1), but it does not guarantee the order of elements. Demo code: Mapmap=newHashMap

How to implement the Set command of Springboot integrated Tile client How to implement the Set command of Springboot integrated Tile client May 19, 2023 pm 01:37 PM

The set command syntax SETkeyid[FIELDnamevalue...][EXseconds][NX|XX](OBJECTgeojson)|(POINTlatlonz)|(BOUNDSminlatminlonmaxlatmaxlon)|(HASHgeohash)|(STRINGvalue) The set command is equivalent to the use of the hash command in redis. It is also a combination of key and id, but the difference is that Tile38's set command can also carry more other attributes, such as customizing the FIELD field, setting the EX validity period, etc., then we need to

Java Collection Framework Practical Guide: Teach you step by step how to use the framework and solve practical problems Java Collection Framework Practical Guide: Teach you step by step how to use the framework and solve practical problems Feb 23, 2024 am 10:52 AM

1.ListList is an ordered collection in the Java collection framework that allows elements to be repeated and elements can be accessed by index. Common implementation classes of List include ArrayList, LinkedList and Vector. The following demonstrates how to use ArrayList to store a set of integers: importjava.util.ArrayList;publicclassArrayListDemo{publicstaticvoidmain(String[]args){//Create an ArrayList object ArrayListnumbers=newArr

See all articles