× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



actually no - that introduces the array syntax to the json which is not
wanted

Jay

On Mon, Nov 27, 2023 at 11:47 AM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:

think I got it...


values *json_object*(
key 'test'
*value*
(select *json_arrayagg*(
*json_object*(
*trim*(sys_tname)
*value* *json_object*(
'tableName' *value* *trim*
(sys_tname)
)
)
)
from qsys2.systables
where sys_dname = 'QGPL')
);

On Mon, Nov 27, 2023 at 11:25 AM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:

So when I do the below, I get a list of objects as expected...


*-- values json_object(*
*-- key 'test'*
*-- value * (select *json_object*(
*trim*(sys_tname)
*value* *json_object*(
'tableName' *value* *trim*
(sys_tname)
)
)
from qsys2.systables
where sys_dname = 'QGPL');
*-- ); *

But when I remove the comments, because I want the list of objects within
another object, I get the following error...

sqlcode -811
THE RESULT OF AN EMBEDDED SELECT STATEMENT OR A SUBSELECT IN THE SET
CLAUSE OF AN UPDATE STATEMENT IS A TABLE OF MORE THAN ONE ROW, OR THE
RESULT OF A SUBQUERY OF A BASIC PREDICATE IS MORE THAN ONE VALUE

So what is the correct syntax?

tia
Jay



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.