Use APEX application elements in SQL query

I have two APEX applications called AI_TABLE and AI_ERROR , and I need to use them in an SQL query. Not sure how to use them and can't find the tutorial, even if it seems pretty simple ...

 SELECT * FROM :AI_TABLE a WHERE a.ERROR_TEXT = :AI_ERROR 

I would ideally want this to be displayed in an interactive report format. Thanks for the help!

+4
source share
1 answer

You cannot bind a table name :AI_TABLE during embedded SQL execution, you will need to use dynamic PL / SQL; or in Apex, create a report area of ​​the SQL Query (PL/SQL function body returning SQL query) type SQL Query (PL/SQL function body returning SQL query) :

 RETURN 'SELECT * FROM '|| :AI_TABLE || ' a WHERE a.ERROR_TEXT = ' || :AI_ERROR; 
+4
source

All Articles