msfanboy msfanboy - 1 month ago 8
C# Question

Check if a table exists in an oracle sql database with c#

This code:

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='xxx'


The above code throws an exception:


ORA-00900: invalid SQL statement


What did I do wrong? The above code worked long ago I could swear.

Answer

Oracle does not support INFORMATION_SCHEMA, you need to use ALL_TABLES, see here

Comments