created a page to allow users to input SQL statement, when user press button, it should Execute this query and another region with Classic Report will display results. on Button a Dynamic Action execute PL/SQL code below: on Click event:
begin
IF :P8_YOURSQL IS NOT NULL THEN
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY (
p_collection_name => 'SOMECOLLECTION',
p_query => :P8_YOURSQL,
p_truncate_if_exists => 'YES'
);
end if;
end;
Item to Submit: P8_YOURSQL
second Action refreshes CR region and CR region is based on:
SELECT * FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME = 'SOMECOLLECTION';
resulted columns are not limited to the query results and column headers are C001, C002, C003 etc. (a) how i can limit the columns to the SQL statement contained? (b) how to change header to the actual column names? (c) how to check for a valid SQL statement?
please help with sample code How To.