Parameterising a WHERE clause
Posted: Fri Jul 15, 2005 3:33 am
Hi,
I want to pass an SQL query as a parameter in a job, but I am getting a fatal error when I do so. I believe that DS is not accepting the quotes that I give to define WHERE clause.
My where clause is :
WHERE CNSM_END_DT = TO_DATE('2999-12-31','YYYY-MM-DD')
The fatal error that I get is :
ConsumerDbTgt: GenericQuery:esqlErrorHandler
Prepare failed for: GenericStmt_1
query is: SELECT CNSM_ID,SRC_CNSM_CD AS src_cnsm_cd,SRC_APPL_CD AS src_appl_cd FROM CONSUMER WHERE CNSM_END_DT = TO_DATE(2999-12-31, YYYY-MM-DD) ORDER BY src_appl_cd ASC,src_cnsm_cd ASC
sqlcode is: -904
esql complaint: ORA-00904: "DD": invalid identifier
I can see in this error message that the quotes that I had given for TO_DATE('2999-12-31','YYYY-MM-DD') is missing.
Is there a way that I can accomplish this?
Regards,
The Bird.
I want to pass an SQL query as a parameter in a job, but I am getting a fatal error when I do so. I believe that DS is not accepting the quotes that I give to define WHERE clause.
My where clause is :
WHERE CNSM_END_DT = TO_DATE('2999-12-31','YYYY-MM-DD')
The fatal error that I get is :
ConsumerDbTgt: GenericQuery:esqlErrorHandler
Prepare failed for: GenericStmt_1
query is: SELECT CNSM_ID,SRC_CNSM_CD AS src_cnsm_cd,SRC_APPL_CD AS src_appl_cd FROM CONSUMER WHERE CNSM_END_DT = TO_DATE(2999-12-31, YYYY-MM-DD) ORDER BY src_appl_cd ASC,src_cnsm_cd ASC
sqlcode is: -904
esql complaint: ORA-00904: "DD": invalid identifier
I can see in this error message that the quotes that I had given for TO_DATE('2999-12-31','YYYY-MM-DD') is missing.
Is there a way that I can accomplish this?
Regards,
The Bird.