The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, Don.
Asked: November 11, 2020 - 10:06 pm UTC
Last updated: November 13, 2020 - 9:17 am UTC
Version: 19
Viewed 10K+ times! This question is
ORA-06550: line 10, column 12: PL/SQL: ORA-19200: Invalid column specification
with jdata as ( select treat('{"practitionerId":12345,"gender":"F"}' as json) as jrow from dual ) select j.jrow.practitionerId from jdata j; declare p_input_json varchar2(32767) := '{"practitionerId":12345,"gender":"F"}'; p_practitioner int; begin with jdata as ( select treat(p_input_json as json) as jrow from dual ) select j.jrow.practitionerId into p_practitioner from jdata j; end; /
declare p_input_json varchar2(32767) := '{"practitionerId":12345,"gender":"F"}'; json_obj json_object_t ; begin json_obj := json_object_t.parse ( p_input_json ); dbms_output.put_line ( json_obj.get ( 'practitionerId' ).to_String ); end; / 12345
declare p_input_json varchar2(32767) := '{"practitionerId":12345,"gender":"F"}'; p_practitioner varchar2(400); begin select * into p_practitioner from json_table ( p_input_json, '$' columns ( practitionerId ) ); dbms_output.put_line ( p_practitioner ); end; / 12345
A reader, November 12, 2020 - 2:56 pm UTC
Don Simpson, November 12, 2020 - 3:50 pm UTC
declare p_input_json varchar2(32767) := '{"practitionerId":12345,"gender":"F"}'; p_practitioner int; begin with jdata as ( select treat(p_input_json as json) as jrow from dual ) select j.jrow.practitionerId into p_practitioner from jdata j nested jrow columns(practitionerId); DBMS_OUTPUT.put_line (p_practitioner); end; /
The Oracle documentation contains a complete SQL reference.