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!

How to insert json data of json_0bject_t type using plsql

hsemarJun 28 2018 — edited Jun 29 2018

Hi,

I'm trying to generate json data using json_object_t  datatype and inserting into it.   I have created a samle scenario here  and it is giving me the error

Database version is 12cR2.

Error report -

ORA-40573: Invalid use of PL/SQL JSON object type.

ORA-06512: at line 5

create table s1 ( s varchar2(32767));

alter table "ADPDBT"."S1" add constraint SCK check(S IS JSON) ENABLE;

inserting data into the table

                             DECLARE

                                  r_js    json_object_t;

                              BEGIN                                                              

                                    r_js := JSON_OBJECT_T('{ "employee_no":9999 }');

                                    insert into s1 values (r_js.to_string);

                                    commit;

                            END;

                            /

                           

Regards,

hsemar

This post has been answered by Gaz in Oz on Jun 29 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2018
Added on Jun 28 2018
10 comments
2,211 views