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.
Parameterising a WHERE clause
Moderators: chulett, rschirm, roy
It's called 'escaping' and the back-slash is the default escape character. It is usually used to tell something to ignore a metacharacter and (as Arnd notes) accept it 'unparsed'. In this case it also works for quotes.
I didn't mention it because in my experience with the Server product it doesn't help. So... either my memories are faulty, it only actually works in the PX product or... they've managed to fix that.
Glad you got it working.
I didn't mention it because in my experience with the Server product it doesn't help. So... either my memories are faulty, it only actually works in the PX product or... they've managed to fix that.
![Confused :?](./images/smilies/icon_confused.gif)
Glad you got it working.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers