Skip to Main Content

ORDS, SODA & JSON in the Database

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!

ORDS Issue in Oracle 12.1

user8632739Jun 22 2022 — edited Jun 26 2022

I have executed below with JSON on my 12.1.0.2 database but receiving below error. Looks like 12.1 doesn't support JSON. Could you please let me know what is this error code ? I am not able to get proper resources from internet regarding this.
Oracle Version 12.1 but the same one is working in Oracle 12.2 version
With content type SQL it is working perfectly

[oracle@cbq2-svd-testdb1 ~]$ curl -k -X POST https://test:8445/ -u testapi:testapi -d "exec dbms_workload_repository.create_snapshot();" -H "Content-Type: Application/sql"|jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 324 0 276 100 48 103 18 0:00:02 0:00:02 --:--:-- 104

{
"env": {
"defaultTimeZone": "GMT+03:00"
},
"items": [
{
"statementId": 1,
"statementType": "sqlplus",
"statementPos": {
"startLine": 1,
"endLine": 1
},
"statementText": "exec
dbms_workload_repository.create_snapshot()",
"response": [
"\nPL/SQL procedure successfully completed.\n\n"
],
"result": 0
}
]
}

###################### Not working with content type JSON ##########

[oracle@test-svd-testdb1 ~]$ curl -k -X POST https://test:8445/ -u testapi:testapi -d "test_exec.json" -H "Content-Type: Application/json"|jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 424 100 410 100 14 2042 69 --:--:-- --:--:-- --:--:-- 2146

{
"code": "BadRequest",
"title": "Bad Request",
"message": "An error occurred parsing the SQL script ",
"o:errorCode": "ORDS-24000",
"cause": "An error with the following message occurred:
Problem recognizing JSON",
"action": "Ensure the SQL script is well-formed",
"type": "tag:oracle.com,2020:error/BadRequest",

}
}

Validated the JSON file and it is properly formated.
[oracle@cbq2-svd-testdb1 ~]$ cat test_exec.json|jq

Comments
Post Details
Added on Jun 22 2022
4 comments
430 views