获取异常ORA-00942:表或视图不存在 - 插入现有表时 [英] Getting an exception ORA-00942: table or view does not exist - when inserting into an existing table

查看:465
本文介绍了获取异常ORA-00942:表或视图不存在 - 插入现有表时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试将一批行插入现有表时遇到异常

I am getting below exception, when trying to insert a batch of rows to an existing table


ORA-00942:表或视图不存在

ORA-00942: table or view does not exist

我可以确认该表存在于db中,我可以使用oracle
sql将数据插入该表开发商。但是当我尝试在java中使用preparedstatement插入行时,其抛出表不存在错误。

I can confirm that the table exists in db and I can insert data to that table using oracle sql developer. But when I try to insert rows using preparedstatement in java, its throwing table does not exist error.

请在下面找到错误的堆栈跟踪

Please find the stack trace of error below

java.sql.SQLException: ORA-00942: table or view does not exist

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289) 
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573) 
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1889)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940) 
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout>>(OracleStatement.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
    at quotecopy.DbConnection.insertIntoDestinationDb(DbConnection.java:591)
    at quotecopy.QuoteCopier.main(QuoteCopier.java:72) 

有人可以提出这个错误的原因吗?

Can anyone suggest the reasons for this error ?

更新:问题已解决

我的数据库连接属性或我的表或视图名称没有问题。问题的解决方案非常奇怪。我尝试插入的其中一列是Clob类型。因为我之前在oracle db中处理clob数据时遇到了很多麻烦,尝试用一个临时字符串setter替换clob setter,并执行相同的代码,没有任何问题,所有行都被正确插入!!!。

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)

ie. peparedstatement.setClob(columnIndex, clob)

替换为


peparedstatement.setString(columnIndex,String)

peparedstatement.setString(columnIndex, "String")

为什么错误表或视图确实存在错误被抛出插入clob数据时出错你能解释一下吗?

Why an error table or view does exist error was throws for error in inserting clob data. Could anyone of you please explain ?

非常感谢您的回答和评论。

Thanks a lot for your answers and comments.

推荐答案

我的数据库连接属性或我的表或视图名称没有问题。问题的解决方案非常奇怪。我尝试插入的其中一列是Clob类型。因为我之前在oracle db中处理clob数据时遇到了很多麻烦,尝试用一个临时字符串setter替换clob setter,并执行相同的代码,没有任何问题,所有行都被正确插入!!!。

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)

ie. peparedstatement.setClob(columnIndex, clob)

替换为


peparedstatement.setString(columnIndex,String)

peparedstatement.setString(columnIndex, "String")

这篇关于获取异常ORA-00942:表或视图不存在 - 插入现有表时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆