Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using json_object_t.get_string for a nested value in json document

I want to read the value of P_PROCESS_FLAG in the given example below. The below code is not returning the value 'S'. How do I read the value of P_PROCESS_FLAG in the example below

declare
l_output varchar2(4000);
l_obj json_object_t;
l_process_flag varchar2(100);
begin

l_output := '{
"OutputParameters" : {
"@xmlns" : "http://xmlns.oracle.com/apps/per/rest/HR_EMP_SYNC_GLB/create_employee/",
"@xmlns:xsi" : "http://www.w3.org/2001/XMLSchema-instance",
"P_PROCESS_FLAG" : "S",
"P_ERROR_MESSAGE" : null
}
}';
l_obj := json_object_t.parse (l_output);
l_process_flag := l_obj.get_string('OutputParameters.P_PROCESS_FLAG');

dbms_output.put_line('l_process_flag is '||l_process_flag);
exception
when others then
dbms_output.put_line('SQLERRM '||sqlerrm);
end;

Comments
Post Details
Added on Jun 14 2022
2 comments
2,590 views