Return results of a sql query as JSON in oracle 12c

后端 未结 9 1644
误落风尘
误落风尘 2020-11-29 05:42

Background

I need to fetch a few thousands rows from Oracle and convert them to JSON for use in SlickGrid. Currently I am fetching the rows in PHP,

9条回答
  •  不知归路
    2020-11-29 06:42

    To add to the answer in oracle 12.2 , you can create json as you want like this .

    SELECT JSON_ARRAY(
    JSON_OBJECT (
             KEY 'number' VALUE s.number,
             KEY 'name' VALUE s.sname,
             KEY 'location' VALUE s.loc
              )
           ) AS student_det
    FROM   student s;
    

提交回复
热议问题