Been a long couple of days.

           exec sql select * into :wCount, :wSeas
             from json_table(systools.httpgetclob(:wURL, ''), '$'
               columns(
                 wData_length dec(3,0) path 'lax $.wData_length',
                 nested 'lax $.SeasOceans[*]'
                 columns(
                 SeasOceans varchar(20) path 'lax $')) );

returns the count and the first array element with an sql message:

"Result of SELECT more than one row.
SQLCODE = -811"

Which is not incorrect, but I thought was handled by "nested"?  Perhaps it is related to SQLRPGLE more than to SQL?



On 11/15/2019 1:18 PM, Peter Dow wrote:

The documentation I was reading at https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/sqlp/rbafyjsontable.htm

did not have an explanation of the "path". Reading further, I found where it had example of an array within the json object. That got me to

SELECT * FROM json_table('
{
   "wData_length":14,
   "SeasOceans":[
      "Adriatic Sea",
      "Arctic Ocean",
      "Atlantic Ocean",
      "Bay of Bengal",
      "Caribbean Sea"
   ]
}',
 'lax $.SeasOceans[*]'
 COLUMNS(
 SeasOceans varchar(40) PATH 'lax $')
) as jt

which returns

....+....1....+....2....+....3....+....4
SEASOCEANS
Adriatic Sea
Arctic Ocean
Atlantic Ocean
Bay of Bengal
Caribbean Sea
********  End of data  ********

I still have no idea what the lax in the path means.  I tried changing it to abc and it didn't complain, but it didn't select anything either.

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx> /

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-2022 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.