Here i am trying to get all the select values in a varible.
DECLARE
ite json;
BEGIN
select INTO ite from json_object('{1}','{1}');
RETURN ite;
when i call this function i got the result null.
plpgsqlpostgresql
Here i am trying to get all the select values in a varible.
DECLARE
ite json;
BEGIN
select INTO ite from json_object('{1}','{1}');
RETURN ite;
when i call this function i got the result null.
Best Answer
Have a look at SELECT INTO in Postgres docs.
SELECT INTO: define a new table from the results of a query
Synopsis
Examples
Create a new table films_recent consisting of only recent entries from the table films:
Try the next syntax:
db<>fiddle here
Or as pointed out in comments a reduced version:
Or even simpler with a SQL function: