27.16 DESCRIBE_QUERY Function Signature 2

This procedure describes the query context based on the current region source.

Syntax

APEX_EXEC.DESCRIBE_QUERY (
    p_location               IN t_location,
    --
    p_table_owner            IN VARCHAR2           DEFAULT NULL,
    p_table_name             IN VARCHAR2           DEFAULT NULL,
    p_match_clause           IN VARCHAR2           DEFAULT NULL,
    p_columns_clause         IN VARCHAR2           DEFAULT NULL,
    p_test_for_rowid         IN BOOLEAN            DEFAULT FALSE,
    --
    p_sql_query              IN VARCHAR2           DEFAULT NULL,
    p_function_body          IN VARCHAR2           DEFAULT NULL,
    p_function_body_language IN t_language         DEFAULT c_lang_plsql,
    --
    p_optimizer_hint         IN VARCHAR2           DEFAULT NULL,
    --
    p_server_static_id       IN VARCHAR2           DEFAULT NULL,
    --
    p_module_static_id       IN VARCHAR2           DEFAULT NULL,
    p_post_process_type      IN t_post_processing  DEFAULT NULL,
    --
    p_columns                IN t_columns          DEFAULT c_empty_columns )
    RETURN t_columns;

Parameters

Parameter Description
p_location Location to open the query context for. Use constants c_location_*.
p_table_owner Table owner when query type TABLE is used.
p_table_name Table name when query type TABLE is used.
p_match_clause Match clause to append when query type GRAPH is used.
p_columns_clause Columns clause to append when query type GRAPH is used.
p_include_rowid_column Add the ROWID column to the SELECT list when query type TABLE is used. Default is FALSE.
p_sql_query SQL Query to execute when query type SQL Query is used.
p_function_body Function body returning SQL query.
p_function_body_language Programming Language used for p_function_body. Use constants c_lang_*
p_optimizer_hint Optimizer hint to be applied to the most outer SQL query generated by Oracle APEX.
p_server_static_id Static ID of the Remote Server when REST-Enabled SQL is used.
p_module_static_id Static ID of the REST data source.
p_post_process_type Type of post processing to be applied to the REST data source result data.
p_columns Columns to be selected from the data source.

Returns

The t_columns object describing the columns and data types.

Example

The following example describes a query and prints out result column names.

DECLARE
    l_columns apex_exec.t_columns;
BEGIN
    l_columns := apex_exec.describe_query(
        p_location  => apex_exec.c_location_local_db,
        p_sql_query => 'select * from emp' );

    FOR i in 1 .. l_columns.count LOOP
        htp.p( 'Col #' || i || ': ' || apex_escape.html( l_columns( i ).name ));
    END LOOP;
END;