我正在尝试使用“ SQL SELECT JSON_VAL FROM Json_Table”的示例 从远程Web服务获取数据。我不断收到相同错误的变化...
嵌入式语句中缺少位置17 INTO子句。
有人可以引导我吗? IBM i(as / 400)DB / 2 OS / V7R3M0
谢谢!
// JSON_TABLE : used to extract values from that JSON object into relational data.
// '$' : used as the outermost SQL/JSON path expression,
// the column definitions will use the existing JSON object
// as their context item. Because '$' only references one item in the
// object, this use of JSON_TABLE will only produce one row.
// After the outermost SQL/JSON path expression, the columns are defined.
D myString s 5500a
Exec SQL SELECT JSON_VAL FROM Json_Table(
Systools.HttpPostClob(
'http://10.10.10.10:8099/dir/dir/pgm',
'<httpHeader>' +
'<header name="Content-Type" value="application/json"/>' +
'</httpHeader>', :myString
// '</httpHeader>' INTO :myString << NO
// '</httpHeader>') INTO :myString << NO
), '$' COLUMNS(JSON_VAL VARCHAR(1000) PATH '$.json')) as x ;
ParmOut = myString;
答案 0 :(得分:0)
SELECT INTO
语法如下:
exec sql
select ...
into ...
from ...
所以尝试一下:
exec sql
select json_val
into :mystring
from json_table(
systools.HttpPostClob(
'http://10.10.10.10:8099/dir/dir/pgm',
'<httpHeader>' +
'<header name="Content-Type" value="application/json"/>' +
'</httpHeader>'
), '$' COLUMNS(JSON_VAL VARCHAR(1000) PATH '$.json')) as x ;
问题是,我在DB2 for i v7.3文档中找不到HttpPostClob()。如果没有滚动自己的存储过程,可能无法在该平台上使用。