db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fumi <fmhk1...@yahoo.co.jp>
Subject Why SQL statement is not terminated correctly?
Date Mon, 29 Sep 2003 18:08:13 GMT
Hi.

delete from emp where job = 'Engineer' or hiredate < '1970/04/01';

I wrote this code to execute above query.
---------------------------------------------------------------------------------
Criteria crit = new Criteria();
crit.add(EmpPeer.JOB, "Engineer");
crit.orDate(EmpPeer.HIREDATE, 1970, 4, 1, Criteria.LESS_THAN);
EmpPeer.doDelete(crit);
---------------------------------------------------------------------------------


ORA-00933(SQL statement is not terminated correctly) occured.
---------------------------------------------------------------------------------
java.sql.SQLException: ORA-00933: 
        at com.workingdogs.village.DataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:573)
        at employee.om.BaseEmpPeer.doDelete(BaseEmpPeer.jav
a:525)
        at employee.sample.TorqueDeleteSample.doIt(TorqueDe
leteSample.java:53)
        at employee.sample.TorqueDeleteSample.main(TorqueDe
leteSample.java:16)
rethrown as org.apache.torque.TorqueException: ORA-00933: 
        at org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:23
6)
        at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:587)
        at employee.om.BaseEmpPeer.doDelete(BaseEmpPeer.jav
a:525)
        at employee.sample.TorqueDeleteSample.doIt(TorqueDe
leteSample.java:53)
        at employee.sample.TorqueDeleteSample.main(TorqueDe
leteSample.java:16)
Caused by: java.sql.SQLException: ORA-00933:
        at com.workingdogs.village.DataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at com.workingdogs.village.TableDataSet.fetchRecords(Unknown Source)
        at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:573)
        ... 3 more
---------------------------------------------------------------------------------

But i executed next code and succeed.
---------------------------------------------------------------------------------
Criteria crit = new Criteria();
crit.addDate(EmpPeer.HIREDATE, 1970, 4, 1, Criteria.LESS_THAN);
crit.or(EmpPeer.JOB, "Engineer");
EmpPeer.doDelete(crit);
---------------------------------------------------------------------------------

What difference between these code fragments?

[My Environment]
Oracle8i 8.1.7
Torque 3.1
JSDK1.4.2

Thanx, in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message