db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Usselmann, Vitali" <Usselm...@elkware.com>
Subject AW: Why SQL statement is not terminated correctly?
Date Tue, 30 Sep 2003 10:05:29 GMT

Hi fumi,

I can not tell you the difference between your code fragments.
I solved my problems with Criteria.or() by using the Criterion
object instead of Criteria.or() as shown at the bottom of:
http://db.apache.org/torque/peers-howto.html

regards, Vitali




-----Urspr√ľngliche Nachricht-----
Von: fumi [mailto:fmhk1968@yahoo.co.jp]
Gesendet: Montag, 29. September 2003 20:08
An: torque-user@db.apache.org
Betreff: Why SQL statement is not terminated correctly?


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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message