Result Set of ONE to assign to a variable
Hi Every one,
I'm creating INSERT, UPDATE, DELETE Triggers on a table CONTENT to make JSONs and update different rows from a table PRESENTATION. Those JSONs are huge strings of concatenations of data from the tables CONTENT and others.
What I do to create the the JSONs contents is make a strange and complex query that results in a long string.
The issue I'm having is that I can't assign the SELECT to a variable because I get this "ERROR 1242 (21000) at line 17: Subquery returns more than 1 row".
How can I do to make the variable assignation without having RESULT SET or SUBQUERY errors.
This is a shortened version of what I want to do.
set @super_long_string_json = ( SELECT CONCAT (a1, a2, a3, a4) as super FROM ( SELECT ...CONTENT ... ) as ALIAS );
UPDATE PRESENTATION set CONTENT = @super_long_string_json WHERE id = 1;
I have tried using GROUP by super, LIMIT 1 without a satisfactory result.
Thanks in advance,
Ziggy :-)
Subject
Views
Written By
Posted
Result Set of ONE to assign to a variable
1731
October 31, 2011 10:27AM
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.