JSON and MySQL Stored Procedures

You probably heard that MySQL 5.7 supports JSON.
But did you know that you can also use JSON with MySQL Stored Procedures - making them very flexible?

Less talk, more code:
(Data was used from the UK Land Registry that I worked on)


4 comments:

  1. This method will be useful to work with node.js and the native mysql driver, just stringify the object to json, I will try

    ReplyDelete
  2. 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.

    ReplyDelete
  3. Thanks for sharing this. It's going to make building Stored Procedures with an unknown set of parameters much easier to develop AND maintain.

    ReplyDelete