0

当我在 SQL 开发人员中运行该语句时,它运行良好,但是,当我尝试像这样通过连接管理器运行它时,我不断收到“找不到表或视图”。我想知道这是否是因为连接管理器可能有不同的语法规则或什么?有没有人知道问题可能是什么?谢谢。

ps = con.prepareStatement("select receipts.ordernumber, receipts.part, receipts.location, receipts.site, 
                           receipts.orderqty,  receipts.supplier, receipts.mfr, receipts.mfrpart, 
                           receipts.ponumber, orders.poline, orders.porelease, orders.price, 
                           orders.uom, orders.currency_r, orders.datecreated, orders.datelate, 
                           orders.approval_time, orders.userid, orders.buyer, orders.note_r, 
                           orders.qtyopen, orders.orderstate, supplier.accountnumber, 
                           delivery.method, 
                           CASE WHEN delivery.method = 'EDI' and delivery.process = 'ORDER' THEN 'YES' ELSE 'NO' END AS EDI, 
                           receipts.userid " +
"from receipts, orders, supplier, delivery " + 
"where receipts.customerix=43 and 
       orders.wip_order = 1 and supplier.suppliercode = orders.supplier and 
       supplier.customerix = orders.customerix and 
       delivery.supplierix = supplier.supplierix and 
       receipts.consigned = '1' and 
       orders.custordernumber(+) = receipts.ordernumber AND 
       orders.CUSTOMERIX(+) = receipts.CUSTOMERIX and 
       receipts.exported=0 and 
       receipts.export_active=1 
       order by receipts.ordernumber");


            statement = update.prepareStatement(" update receipts set export_active = 1 where receiptix in " +
                "(SELECT receipts.receiptix FROM pours.receipts, pours.orders, pours.supplier " +
                "WHERE receipts.customerix =7021 AND orders.wip_order = 1 AND supplier.suppliercode = orders.supplier " +
                "AND supplier.customerix = orders.customerix " +
                "AND receipts.consigned = '1' AND orders.custordernumber(+) = receipts.ordernumber " +
                "AND orders.CUSTOMERIX(+) = receipts.CUSTOMERIX AND receipts.exported = 0)");
4

2 回答 2

0

看看这里: http ://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html

此外,尝试进行更简单的查询以查看是否可以访问表中的数据;

问候!/托马斯

于 2013-03-26T18:47:56.810 回答
0

I Think you went wrong with the DBName, for the connection..为连接提供正确的数据库后检查

当您的数据库没有此表时,您只会收到此错误

DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
DB_CONNECTION = "jdbc:oracle:thin:@localhost:1521:DBName";
DB_USER = "user";
DB_PASSWORD = "password";
于 2013-03-26T19:00:51.607 回答