MySQL Forums
Forum List  »  Stored Procedures

How to convert table column to json array in a function.
Posted by: Alex Graham
Date: November 10, 2019 09:12AM

Hello. I want to convert whole table column to json array to make some calculations further. So that I've tried to create some function.
CREATE DEFINER=`root`@`localhost` FUNCTION `M1`() RETURNS json
DETERMINISTIC
BEGIN
DECLARE t json;
set t=json_object(select `value` from test.population);
RETURN t;
END
But the stuff inside json_object is written incorrectly. Cloud you give me the right way?

Options: ReplyQuote


Subject
Views
Written By
Posted
How to convert table column to json array in a function.
583
November 10, 2019 09:12AM


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.