33.57 WRITE Procedure Signature 21

This procedure writes an object attribute.

Note:

This signature is only available if SDO_GEOMETRY (Oracle Locator) is installed in the database.

Syntax

APEX_JSON.WRITE (
    p_name        IN VARCHAR2,
    p_value       IN mdsys.sdo_geometry,
    p_write_null  IN BOOLEAN DEFAULT FALSE );

Parameters

Table 33-71 WRITE Parameters

Parameter Description
p_name The attribute name.
p_value The attribute value to be written.
p_write_null If TRUE, write null values. If FALSE (the default), do not write nulls.

Example

The following example writes a JSON object with the a1, a2, a3, and a4 attributes. a3 is an SDO_GEOMETRY, encoded as GeoJSON.

DECLARE
  l_sdo_geometry mdsys.sdo_geometry := sdo_geometry( 2001, 4326, sdo_point_type( 10, 50, null ), null, null );
BEGIN
  apex_json.open_object; -- {
  apex_json.write('a1', 1); -- "a1": 1
  apex_json.write('a2', 'two'); -- ,"a2": "two"
  apex_json.write('a3', l_sdo_geometry); -- ,"a3": { "type": "Point", "coordinates": [ 10, 50 ] }
  apex_json.write('a4', false); -- ,"a4": false
  apex_json.close_object; -- }
END;