January 9th, 2004, 09:19 PM
-
sql query
hi..i'm using the oracle db. The following sql quey can run in php(but returns the wrong result), but cannot run in oracle sql plus. Can someone tell me what's wrong?
Thank you!
Code:
SQL> select distinct( acav_cardno ), acch_icno, acch_accesscode, acav_cardholdername from ac_cardholder, ac_activity where trunc(acav_trxdatetime) between to_date('01-11-2003','dd-mm-yyyy') and to_date('30-11-2003','dd-mm-yyyy') and acch_cardno = acav_cardno and acav_readertype='I' order by acch_icno;
2 ;
select distinct( acav_cardno ), acch_icno, acch_accesscode, acav_cardholdername from ac_cardholder,
ERROR at line 1:
ORA-00933: SQL command not properly ended
January 10th, 2004, 06:22 AM
-
Looks like you have two ; in your statement? Leave out the second one, or leave them out completely and try to terminate the query with / (in SQL*Plus)
January 10th, 2004, 08:24 PM
-
actually it cannot work. when i put first ";" and press enter, the oracle sql query seek waiting the input from me. so i put the second ";" and the error messages come out.
Here I have try the simply sql. and it can work.
select acav_cardno, acav_cardholdername, acch_icno, acch_accesscode from ac_cardholder, ac_activity where acch_cardno = acav_cardno and trunc(acav_trxdatetime) between to_date('01-11-2003', 'dd-mm-yyyy') and to_date('30-11-2003', 'dd-mm-yyyy');
but when i try(as follow, i added the "acav_readertype = 'I'"), the error message come out said "ERROR at line 2:
ORA-00936: missing expression"
select acav_cardno, acav_cardholdername, acch_icno, acch_accesscode from ac_cardholder, ac_activity where acch_cardno = acav_cardno and acav_readertype = 'I' and trunc(acav_trxdatetime) between to_date('01-11-2003', 'dd-mm-yyyy') and to_date('30-11-2003', 'dd-mm-yyyy');
hope that u can help me. Thanks!