2
任何人都可以告訴我這個SQL查詢有什麼問題。SQL日期格式綁定變量
select
USERNAME, DATECREATED, CREDTYPE, USAGETYPE, OPERATIONID, TXNID, CALLERID
from
arwfissuanceauditlog
where
OPERATIONID in (2104,2107)
and datecreated >= 'to_date('2010/06/21', 'yyyy/MM/dd HH24:MI:SS')'
and datecreated < 'to_date('2010/08/03', 'yyyy/MM/dd HH24:MI:SS')'
我得到這個消息時,我在SQL Developer中運行它
Unknown Command
Bind Variable "MI" is NOT DECLARED
我從Java這樣
try {
stmt = conn.createStatement();
results = stmt.executeQuery(queryToExecute);
} catch (SQLException e) {
CredChangeReportSVC.DEFAULTLOGGER.error("An exception occurred while executing query: " + queryToExecute, e);
}
在日誌中我得到這個消息調用此
ERROR 03 Aug 2010 14:51:06,939 - An exception occurred while executing query: "select USERNAME, DATECREATED, CREDTYPE, USAGETYPE, OPERATIONID, TXNID, CALLERID from arwfissuanceauditlog where OPERATIONID in (2104,2107) and datecreated >= 'to_date('2010/06/21', 'yyyy/MM/dd HH24:MI:SS')' and datecreated < 'to_date('2010/08/03', 'yyyy/MM/dd HH24:MI:SS')'"
java.sql.SQLException: Invalid SQL type
在此先感謝。