APPEND_FUNCTION Procedure
Appends a function to an array. The function is added unescaped. Ensure the contents of the function are trusted. Do not add untrusted data such as data coming from an end user.
The function being added can either be a complete function, in which case it is added as is, it can be a function body, in which case it is wrapped with function(){}, or be an expression, which case it is wrapped and the expression returned.
Syntax
MEMBER PROCEDURE append_function (
p_code IN VARCHAR2,
p_type IN PLS_INTEGER,
p_omit_null IN BOOLEAN DEFAULT TRUE );Parameters
| Parameter | Description |
|---|---|
p_code |
The value. |
p_type |
The type of code being added, use one of the constants:
|
p_omit_null |
Whether to omit the value if it is null. |
Example
Create an array that appends a function to the array.
declare
l_obj apex_t_javascript_object := apex_t_javascript_object();
begin
l_obj.open_array;
l_obj.append_function (
p_code => 'function(){return 1;}',
p_type => apex_javascript.c_type_function );
l_obj.append_function (
p_code => 'return 2;',
p_type => apex_javascript.c_type_function_body );
l_obj.append_function (
p_code => '3',
p_type => apex_javascript.c_type_expression );
l_obj.close_array;
sys.dbms_output.put_line( l_obj.to_clob );
end;
Output:
[function(){return 1;},function(){return 2;},function(){return 3;}]
Parent topic: APEX_T_JAVASCRIPT_OBJECT