37.43 WRITE Procedure Signature 7
This procedure writes an array with all rows that the cursor returns. Each row is a separate object. If the query contains object type, collection, or cursor columns, the procedure uses write(xmltype) to generate JSON. Otherwise, it uses DBMS_SQL to fetch rows and the write() procedures for the appropriate column data types for output. If the column type is varchar2 and the uppercase value is 'TRUE' or 'FALSE', it generates boolean values.
Syntax
APEX_JSON.WRITE (
p_cursor IN OUT NOCOPY sys_refcursor );Parameters
| Parameter | Description |
|---|---|
p_cursor |
The cursor. |
Example
This example writes an array containing JSON objects for departments 10 and 20.
DECLARE
c sys_refcursor;
BEGIN
open c for select deptno, dname, loc from dept where deptno in (10, 20);
apex_json.write(c);
END;This is the output:
[ { "DEPTNO":10 ,"DNAME":"ACCOUNTING" ,"LOC":"NEW YORK" }
, { "DEPTNO":20 ,"DNAME":"RESEARCH" ,"LOC":"DALLAS" } ]Parent topic: APEX_JSON