Getting an exception ORA-00942: table or view does not exist - when inserting into an existing table

Oracle will also report this error if the table exists, but you don't have any privileges on it. So if you are sure that the table is there, check the grants.


There seems to be some issue with setCLOB() that causes an ORA-00942 under some circumstances when the target table does exist and is correctly privileged. I'm having this exact issue now, I can make the ORA-00942 go away by simply not binding the CLOB into the same table.

I've tried setClob() with a java.sql.Clob and setCLOB() with an oracle.jdbc.CLOB but with the same result.

As you say, if you bind as a string the problem goes away - but this then limits your data size to 4k.

From testing it seems to be triggered when a transaction is open on the session prior to binding the CLOB. I'll feed back when I've solved this...checking Oracle support.


There was no problem with my database connection properties or with my table or view name. The solution to the problem was very strange. One of the columns that I was trying insert was of Clob type. As I had a lot of trouble handling clob data in oracle db before, gave a try by replacing the clob setter with a temporary string setter and the same code executed with out any problems and all the rows were correctly inserted!!!.

ie. peparedstatement.setClob(columnIndex, clob)

was replaced with

peparedstatement.setString(columnIndex, "String")