29.37 WRITE Procedure Signature 1

This procedure writes an array attribute of type VARCHAR2.

Syntax

APEX_JSON.WRITE (
    p_value    IN VARCHAR2 );

Parameters

Table 29-51 WRITE Procedure Parameters

Parameter Description

p_value

The value to be written.

Example

This example writes an array containing 1, "two", "long text", false, the current date and a JSON representation of an xml document.

DECLARE
  l_clob clob := 'long text';
  l_xml sys.xmltype := sys.xmltype('<obj><foo>1</foo><bar>2</bar></obj>');
BEGIN
  apex_json.open_array; -- [
  apex_json.write(1); -- 1
  apex_json.write('two'); -- , "two"
  apex_json.write(l_clob); -- , "long text"
  apex_json.write(false); -- , false
  apex_json.write(sysdate); -- , "2014-05-05T05:36:08Z"
  apex_json.write(localtimestamp); -- , "2014-05-05T05:36:08.5434Z"
  apex_json.write(current_timestamp); -- , "2014-05-05T05:36:08.5434+02:00"  
  apex_json.write(l_xml); -- , { "foo": 1, "bar": 2 }
  apex_json.close_array; -- ]
END;