Forum Stats

  • 3,827,153 Users
  • 2,260,746 Discussions


How can I use methods on Packages which return JSON on oracledb

edited Feb 17, 2017 3:13PM in Node.js


I started exploring oracledb package in order to possibly substitute ORDS. Every request we have published declares a JSON variable that gets populated when we run a function from a PL/SQL Package. Is it possible to run that function in oracledb that returns a JSON data type from Oracle?


  • danmcghan-Oracle
    danmcghan-Oracle Member Posts: 43 Employee
    edited Feb 14, 2017 12:40PM

    Hello 98371...

    What do you mean by JSON data type? What version of the database are you using?

    I'm guessing you're either using PL/JSON or built-in JSON types in 12.2. In either case, you should be able to serialize the JSON object to a string (or CLOB). The driver has supported CLOBs as streams for a while but recent enhancements make it even easier to fetch CLOBs as strings without having to stream them.



  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,648 Employee
    edited Feb 17, 2017 3:13PM

    If you're not using Oracle Database's JSON support you are probably already storing your JSON as VARCHAR or CLOB.  As Dan mentioned, you can easily transfer JavaScript strings in Node.js to and from these Oracle types using node-oracledb.

    The Oracle Database JSON datatype support was introduced is in (with enhancements in 12.2).  It actually also stores the data in VARCHARs or LOBs, so node-oracledb can access the JSON directly with normal inserts & updates.  The extra database-side JSON features make working with data much easier, e.g. you can access individual entries in nested JSON objects by using x.y.z syntax.   Check out Database JSON Developer's Guide - Contents  Also see the node-oracledb documentation and examples at  and

    (see selectjson.js and selectjsonclob.js)