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 pass JSON type data as an input parameter in a Stored procedure

Albert ChaoMay 30 2022 — edited May 30 2022

Hi Team,
I have one requirement wherein I need to pass JSON as an input parameter and process the data accordingly.

JSON data:

{
"Table name": "test_table",
"Column name":["column_1","column_2"],
"Column_value":["test_data","1"]
}

I need to write a procedure with this JSON as an input parameter.
Then based on the table name and column name it should insert the particular column value into the respective columns of a table.
Pseudo Code:
Store JSON in one table with the table structure as
table_id |Table_name | Column_name | Column_value

Then pass table_name, column_name, and column_values JSON format as input parameters.
Then extract tables, columns, and column_value from the input parameter and load in into the respective table.

Will this work? As I am not aware of how to handle JSON in a stored procedure or if anyone has any clue of how to start with this it would help me

Tool Used: SQL Developer (18c)

This post has been answered by odie_63 on May 31 2022
Jump to Answer
Comments
Post Details
Added on May 30 2022
2 comments
12,247 views