Home > Database > Mysql Tutorial > body text

Get the value corresponding to KEY from the string of a serialized array.

大家讲道理
Release: 2016-11-12 09:32:24
Original
1305 people have browsed it

delimiter $$
 
create function get_from_serialized_json 
( in_string varchar(255), 
  in_key varchar(255) )
  returns varchar(255)
BEGIN
return trim( '"' from
   substring_index(
    substring_index(
        substring(trim("}" FROM in_string ), locate(concat("\"",in_key,"\""), in_string  )+1 
    ) , ";",2 
   ), ":",-1 )) ;
END$$
Copy after login

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template