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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Convert a cursor into JSON?

Mike KutzApr 15 2022

Database: 21c ATP Free Tier
I'm looking for the JSON version of this (LiveSQL PL/SQL code for converting cursor to XML)
So, if I give a cursor like:

open cur for
    select column_name, data_type
    from user_tab_cols
    where table_name = 'EMP';

The function should return JSON (or json_object_t) that matches something like:

{ "ROWSET":[
        { "COLUMN_NAME":"EMPNO", "DATA_TYPE":"NUMBER" },
        { "COLUMN_NAME":"DEPTNO", "DATA_TYPE":"NUMBER" },
        { "COLUMN_NAME":"HIRE_DATE", "DATA_TYPE":"DATE" },
        ...
    ]
}

Thanks,
MK

This post has been answered by Stew Ashton on Apr 16 2022
Jump to Answer

Comments

Processing

Post Details

Added on Apr 15 2022
5 comments
4,909 views