27.47 OPEN_ARRAY Procedure Signature 1
Enters the array within the provided array column and moves the cursor to before the first row, so that calling next_array_row()
points to the first array element.
Currently only supported for contexts on REST data sources.
Syntax
APEX_EXEC.OPEN_ARRAY (
p_context IN t_context,
p_column_name IN VARCHAR2 )
Parameters
Parameter | Description |
---|---|
p_context |
Context object obtained with one of the OPEN_ functions.
|
p_column_name |
Name of the array column to add a row for. |
Example
DECLARE
l_context apex_exec.t_context;
BEGIN
l_context := apex_exec.open_rest_source_query(
p_static_id => '{REST Source static ID}',
p_max_rows => 1000 );
<<rest_rows_loop>>
WHILE apex_exec.next_row( l_context ) LOOP
sys.dbms_output.put_line( 'ID: ' || apex_exec.get_varchar2( l_context, 'TITLE' ) );
sys.dbms_output.put_line( 'MAG: ' || apex_exec.get_varchar2( l_context, 'MAG' ) );
sys.dbms_output.put_line( 'PLACE: ' || apex_exec.get_varchar2( l_context, 'PLACE' ) );
sys.dbms_output.put_line( 'TITLE: ' || apex_exec.get_varchar2( l_context, 'TIME' ) );
sys.dbms_output.put_line( 'TIME: ' || apex_exec.get_varchar2( l_context, 'ID' ) );
sys.dbms_output.put_line( 'SOURCES: ' );
apex_exec.open_array(
p_context => l_context,
p_column_name => 'SOURCES' );
<<rest_array_row_sources_loop>>
WHILE apex_exec.next_array_row( l_context ) LOOP
sys.dbms_output.put_line( '-- ID: ' || apex_exec.get_varchar2( l_context, 'SOURCE_ID' ) );
sys.dbms_output.put_line( '-- NAME: ' || apex_exec.get_varchar2( l_context, 'SOURCE_NAME' ) );
END LOOP rest_array_row_sources_loop;
apex_exec.close_array( l_context );
sys.dbms_output.put_line( 'REPORTERS: ' );
apex_exec.open_array(
p_context => l_context,
p_column_name => 'REPORTERS' );
<<rest_array_row_reporters_loop>>
WHILE apex_exec.next_array_row( l_context ) LOOP
sys.dbms_output.put_line( '-- NAME: ' || apex_exec.get_varchar2( l_context, 'REPORTER_NAME' ) );
END LOOP rest_array_row_reporters_loop;
apex_exec.close_array( l_context );
END LOOP rest_rows_loop;
apex_exec.close( l_context );
EXCEPTION
WHEN others THEN
apex_exec.close( l_context );
RAISE;
END;
Parent topic: APEX_EXEC