oracle query not working in PHP 4
I am trying to execute an oracle(11g) query in PHP 4 which is finally failed. But the same query is successful in sql plus. Connection to database is ok coz all other queries are running successfully. I am pasting the query below :
SELECT to_CHAR(A.FROM_DATE,'DD-MM-RRRR HH:MIAM'),
to_CHAR(A.TO_DATE,'DD-MM-RRRR HH:MIAM'),
A.PLACE_OF_VISIT,
A.PURPOSE_OF_VISIT,
C.EMPLOYEE_NAME,
A.CONTACT_NO,
B.ABSENCE_TYPE,
A.REMARKS,
D.EMPLOYEE_NAME
FROM EMP_ABSENCE_DETAILS A,
ABSENCE_TYPE B,
EMPLOYEE_MASTER C,
EMPLOYEE_MASTER D
WHERE A.EMP_CODE LIKE '%'
A开发者_运维问答ND A.REASON_OF_ABSENCE = B.CODE
AND A.ENTRY_STATUS ='A'
AND ltrim(rtrim(C.EMPLOYEE_CODE))=ltrim(rtrim((A.OFFICER_EMP_CODE)))
AND ltrim(rtrim(D.EMPLOYEE_CODE))=ltrim(rtrim((A.EMP_CODE)))
AND to_date('30/11/2010','DD/MM/RRRR') >= to_date(FROM_DATE,'DD/MM/RRRR')
AND to_date('30/11/2010','DD/MM/RRRR')<= to_date(TO_DATE,'DD/MM/RRRR')
please help me
thanks and regards
Jessy
SELECT to_CHAR(A.FROM_DATE,'DD-MM-RRRR HH:MIAM'),
to_CHAR(A.TO_DATE,'DD-MM-RRRR HH:MIAM'),
A.PLACE_OF_VISIT,
A.PURPOSE_OF_VISIT,
C.EMPLOYEE_NAME,
A.CONTACT_NO,
B.ABSENCE_TYPE,
A.REMARKS,
D.EMPLOYEE_NAME
FROM EMP_ABSENCE_DETAILS A,
ABSENCE_TYPE B,
EMPLOYEE_MASTER C,
EMPLOYEE_MASTER D
WHERE A.EMP_CODE LIKE '%'
AND A.REASON_OF_ABSENCE = B.CODE
AND A.ENTRY_STATUS ='A'
AND ltrim(rtrim(C.EMPLOYEE_CODE))=ltrim(rtrim((A.OFFICER_EMP_CODE)))
AND ltrim(rtrim(D.EMPLOYEE_CODE))=ltrim(rtrim((A.EMP_CODE)))
AND to_date('30/11/2010','DD/MM/RRRR') >= trunc(A.FROM_DATE)
AND to_date('30/11/2010','DD/MM/RRRR')<= trunc(A.TO_DATE)
EDIT for @powtac
AND to_date('30/11/2010','DD/MM/RRRR') >= to_date(FROM_DATE,'DD/MM/RRRR')
AND to_date('30/11/2010','DD/MM/RRRR')<= to_date(TO_DATE,'DD/MM/RRRR')
has been replaced with
AND to_date('30/11/2010','DD/MM/RRRR') >= trunc(A.FROM_DATE)
AND to_date('30/11/2010','DD/MM/RRRR')<= trunc(A.TO_DATE)
精彩评论