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 Utf8 Charset

Omar M. SawalhahFeb 27 2022

Hi,
I have a table with Arabic characters, need to expose a GET endpoint using ORDS for a Flutter application. So I tried the following
Simple source type "Collection query" to get the data, but the output is

 "title": "عجنوا مسك الجمال",
 "id": 721,

I changed the Collection query and tried the source type "PL/SQL" , just to set the mime header owa_util.mime_header('application/json', false, 'utf-8');
and the display the result as CLOB in htp.p call, the problem is that, because the result json is big, I hit the issue in 12c that json_object
Error(14,22): PL/SQL: ORA-40449: invalid data type for return value, check this post https://asktom.oracle.com/pls/apex/asktom.search?tag=sql-json-ora-40459-exception
To make sure that this was the problem, I restricted the rows, and the result appears correctly.
Then I tried a SYS_REFCURSOR, just get a large result and use "PL/SQL" just to set the headers, but the problem that sitting the header, in this case, I mean using cur SYS_REFCURSOR, with "RESULTSET" in the response didn't fix the problem.
So my question is that how can I set Content-Type header in a GET handler, or
Solve the " ORA-40449: invalid data type" error?
I had to decode the result in the Flutter app, and that is not applicable for some code generators.
Regards,
Omar

Comments
Post Details
Added on Feb 27 2022
5 comments
1,080 views