Having following query:
select table_name
from user_tables
where table_name in (\'A\',\'B\',\'C\',\'D\',\'E\',\'F\');
Assuming only user_tables
Only way is to use NOT EXISTS
by converting the IN clause
String into a Table of values.(CTE)
This is not a clean solution though. As The maximum length of IN
clause expression is going to be 4000
only, including the commas..
WITH MY_STRING(str) AS
(
SELECT q'#'A','B','C','D','E','F'#' FROM DUAL
),
VALUES_TABLE AS
(
SELECT TRIM(BOTH '''' FROM REGEXP_SUBSTR(str,'[^,]+',1,level)) as table_name FROM MY_STRING
CONNECT BY LEVEL <= REGEXP_COUNT(str,',')
)
SELECT ME.* FROM VALUES_TABLE ME
WHERE NOT EXISTS
(SELECT 'X' FROM user_tables u
WHERE u.table_name = ME.table_name);