Hi!
I'm getting a syntax check error when formatting this query:
select jt.*
from dual l, json_table('[{"rn":1},{"rn":2}]', '$[*]' columns(rn integer path '$.rn')) jt;
[Error] Syntax check (2: 69): ERROR: line 2, column 69, ending line 2, column 75: Found 'integer': Expecting: ) , -or- EXISTS FORMAT PATH -or- BLOB CLOB DATE FOR identifier NUMBER SDO_GEOMETRY substitution_variable TIMESTAMP VARCHAR VARCHAR2
[Error] Syntax check (2: 69): ERROR: line 2, column 69, ending line 2, column 75: Found 'integer': A reserved word cannot be used as an identifier
And this is seams to be correct according to the documentation:
20.2 COLUMNS Clause of SQL/JSON Function JSON_TABLE
A regular column specification consists of a column name followed by an optional scalar data type for the column, which can be SQL data typeVARCHAR2
,NUMBER
,DATE
,TIMESTAMP
,TIMESTAMP WITH TIME ZONE
, orSDO_GEOMETRY
(the same as for theRETURNING
clause ofjson_value
), followed by an optional value clause and an optionalPATH
clause. The default data type isVARCHAR2(4000)
.
Anyway the query executes without error, but we must make sure that the json field contains only integers or we may get a very different result, as in this example:
select jt.*
from dual l, json_table('[{"rn":1.6},{"rn":2.3}]', '$[*]' columns(rn_int integer path '$.rn', rn_num number path '$.rn')) jt;
So i think this is not toad problem at all.
Thanks!