Use APEX application items within SQL query
oracle, oracle-apex, sql
Solution
You cannot bind the table name `:AI_TABLE` at run time in native SQL, you will need to use dynamic PL/SQL; or in Apex create a report region of the type `SQL Query (PL/SQL function body returning SQL query)`:
RETURN 'SELECT * FROM '|| :AI_TABLE || ' a WHERE a.ERROR_TEXT = ' || :AI_ERROR;
Problem
I have two APEX application items 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 a tutorial this even though it seems like quite a simple thing... ``` SELECT * FROM :AI_TABLE a WHERE a.ERROR_TEXT = :AI_ERROR ``` I'd ideally want this to show in the interactive report format. Thanks for the help!