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 check columns in JSON data in PLSQL?

User_CI7SYOct 30 2021 — edited Nov 4 2021

Hi Team, I have defined a particular format to be inserted into my JSON column and it should be like this below, but some users send incorrect column names , how can I check this and raise an exception? So instead of first field fileDateStamp user sent Date, also some columns are not in right sequence.
Expected JSON:
"{ "fileDateStamp" : "2021-09-15 16:30:00",
"inventory" : [
{
"branch" : "SITE100",
"productIDQualifier" : "UPC",
"productID" : "78101150434",
"quantityOnHand" : 10,
"quantityUOM" : "EA",
"productURL" : "website url"
}
]
}"
Actual JSON from user:
{ "date": "2012-04-21T18:25:43.000Z",
"inventory": [
{
"branch": "1231",
"quantityOnHand": 300,
"quantityUOM": "CT",
"productID": "1009",
"productIDQualifier": "CATALOG",
"productURL": "www.testsite.com/productID/1009"
}
],
"DIST_ID": "123"
}

Edited by Moderator (BluShadow) to remove genuine website link

Comments
Post Details
Added on Oct 30 2021
4 comments
623 views