I'm having trouble writing a query. I have a support tabled called 'MYTABLE' and it has a column called 'TABLENAME' that can have one or many table names in it. Multiple Tables are separated with commas.
Example:
TBLUSER
TBLUSER, TBLACCOUNT
I'm trying to write an query that will identify any entries in the MYTABLE table that are not valid tables in the database. I was able to write the follow....
SELECT *
FROM MYTABLE T1
LEFT outer JOIN ALL_TAB_COLS T2
ON ( upper(T1.TABLENAME) = upper(t2.Table_Name)
AND T2.Owner = 'ME'
)
WHERE TABLE_NAME IS NULL;
And it works exactly how I want - but it only works when the entry in MYTABLE contains a single table. When there are multiple tables separated by commas - it fails. My SQL skills are somewhat lacking and my natural instinct is to 'Do a For Each' but I feel that's not the right approach (and I have no idea how to do that in SQL).