37.56 WRITE Procedure Signature 20
This procedure writes a BLOB object attribute. The value will be Base64-encoded.
Syntax
APEX_JSON.WRITE (
p_name IN VARCHAR2
p_value IN BLOB,
p_write_null IN BOOLEAN DEFAULT FALSE );Parameters
| Parameter | Description |
|---|---|
p_name |
The attribute name. |
p_values |
The attribute value to be written. |
p_write_null |
If TRUE, write an empty array. If FALSE (default), do not write an empty array.
|
Example
This example writes a JSON object with the a1, a2, a3, and a4 attributes. a3 is a BLOB, encoded in Base64 format.
DECLARE
l_blob blob := to_blob( hextoraw('000102030405060708090a');
BEGIN
apex_json.open_object; -- {
apex_json.write('a1', 1); -- "a1": 1
apex_json.write('a2', 'two'); -- ,"a2": "two"
apex_json.write('a3', l_blob); -- ,"a3": "AAECAwQFBgcICQo="
apex_json.write('a4', false); -- ,"a4": false
apex_json.close_object; -- }
END;Parent topic: APEX_JSON