gpt4 book ai didi

java - ORA-00942 : table or view does not exist but query runs on SQL developer

转载 作者:行者123 更新时间:2023-12-01 21:43:20 24 4
gpt4 key购买 nike

我有一个oracle sql查询,它在oracle sql开发人员上运行良好,但是当我从Java准备好的语句运行它时,sql异常抛出“ORA-00942:表或 View 不存在”,并且用户获得了上述的所有权限3个模式。查询有问题吗?目前我似乎找不到问题,仍在调试sql字符串也可以在SQL Developer中执行。

SQL查询

SELECT CLI_CLIENT.NAME ,CLI_CLIENT.CLIENT_ID,

AA.SEARCHES,

(SELECT COUNT(*) FROM RES_BOOKING,CLI_WEB_USER WHERE RES_BOOKING.BOOKED_USER=CLI_WEB_USER.ADM_USER_ID

AND TRUNC(RES_BOOKING.BOOKING_DATE) BETWEEN '01-MAR-16' AND '24-MAR-16' AND CLI_WEB_USER.CLIENT_ID=CLI_CLIENT.CLIENT_ID)AS BOOKINGS

FROM CLI_CLIENT,

(SELECT CWU.CLIENT_ID,

COUNT(ST.OPERATION) AS SEARCHES

FROM STAT.ST_TRANSACTION ST , CLI_WEB_USER CWU , CACHE.CACC_CRITERIA CC , CACHE.CACC_CRITERIA_STATS CS

WHERE ST.USER_NAME=CWU.USERNAME

AND ST.OPERATION LIKE 'OTA_HotelAvailRQ%'

AND TRUNC(ST.TRS_TIMESTAMP) BETWEEN '01-MAR-16' AND '24-MAR-16'

AND CWU.CLIENT_ID IN (10975,10040)

AND CC.CRITERIA_ID=CS.CRITERIA_ID

AND CS.SESSION_ID=ST.SESSION_ID

AND CS.DISTRIBUTION_CHANNEL='W'

GROUP BY CLIENT_ID, CWU.CLIENT_ID

)AA

WHERE CLI_CLIENT.CLIENT_ID=AA.CLIENT_ID;

Java异常

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

最佳答案

检查您是否在 SQL Developer 和 Java 应用程序中使用同一用户帐户连接到数据库。情况很可能并非如此,您的 Java 应用程序无法访问查询中的一个或多个表。

关于java - ORA-00942 : table or view does not exist but query runs on SQL developer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36215274/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com