Using the JSON datatype for stored procedure params effectively gives us SPs with optional params. This takes stored procedures to a new level by making them a lot more flexible.
dear jonathan , I am very much new to mysql and json and encountering a prob .. requesting you please bear with me ..
actually the thing is ... I have to read a table and stored in JSON array inside the stored procedure in mysql ( how we can achieve this) .. the intention behind this .. i have to generate a JSON file . please help me
There are some MySQL JSON functions in 5.7 to read JSON arrays, but bare in mind that they are limited and your best course of action is to read those using a programming language. I am however, happy to help if you have a specific issue with some details.
This method will be useful to work with node.js and the native mysql driver, just stringify the object to json, I will try
ReplyDeleteUsing the JSON datatype for stored procedure params effectively gives us SPs with optional params. This takes stored procedures to a new level by making them a lot more flexible.
ReplyDeletenice
ReplyDeleteI'm getting a s yntax error when I use:
ReplyDeleteCREATE PROCEDURE procedure_name(query JSON)
It says that the JSON identifier is unexpected.
You using mysql 5.7?
DeleteYes, maybe MySQL Workbench has an issue?
Deletedear jonathan , I am very much new to mysql and json and encountering a prob .. requesting you please bear with me ..
ReplyDeleteactually the thing is ... I have to read a table and stored in JSON array inside the stored procedure in mysql ( how we can achieve this) .. the intention behind this .. i have to generate a JSON file . please help me
There are some MySQL JSON functions in 5.7 to read JSON arrays, but bare in mind that they are limited and your best course of action is to read those using a programming language.
ReplyDeleteI am however, happy to help if you have a specific issue with some details.