MySQL Forums
Forum List  »  Stored Procedures

Is there a way to pass parameters to a mySQL procedure as a json string and then use the key / values
Posted by: Donavon Lerman
Date: October 08, 2014 10:28AM

This topic was cross posted on http://stackoverflow.com/questions/26241559
But since this forum is more specific thought I would getting a better response / solution here.

+---------------------------------------------+

I would like to pass parameters to a mySQL stored procedure as a json string.

Is there a standard method for doing this and working with the json key / values once it is in the procedure?

Example:

SET @jsonString = "{\"parameter4\":true,\"parameter1\":\"California\",\"parameter3\":123,\"parameter2\":\"Hello World\"}";
CALL SP_Test(@jsonString);

----

CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_Test`(IN `jsonString` TEXT)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'Pass parameter as json string'
BEGIN

/*
How to split and use jsonString key/values????
*/

END

Options: ReplyQuote


Subject
Views
Written By
Posted
Is there a way to pass parameters to a mySQL procedure as a json string and then use the key / values
5792
October 08, 2014 10:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.