Passing Stage variable into Oracle using Oracle date formats
Posted: Tue Sep 11, 2012 8:39 am
Hi, I am trying to write a dynamic query in Oracle using Datastage variables that get set at time of job running. I am getting errors from the way I am tying to pass the date into Oracle. I have defined a stage variable: srchQueryDateRange - that will hold the date portion of my query, the variable holds the following:
If dateFormat = 'D8' Then " and TO_CHAR(B.srvc_from_dt,\'yyyymmdd\') = ORCHESTRATE.SRVC_FROM_DT"
else If dateFormat = 'RD8' Then " and TO_CHAR(B.srvc_from_dt,\'yyyymmdd\') >= ORCHESTRATE.SRVC_FROM_DT and TO_CHAR(B.srvc_to_dt,\'yyyymmdd\') <= ORCHESTRATE.SRVC_TO_DT" else ""
My problem seems to be trying to pass the format within a variable. Can someone please tell me what I am doing wrong?
Thanks so much for any help.
Mona
If dateFormat = 'D8' Then " and TO_CHAR(B.srvc_from_dt,\'yyyymmdd\') = ORCHESTRATE.SRVC_FROM_DT"
else If dateFormat = 'RD8' Then " and TO_CHAR(B.srvc_from_dt,\'yyyymmdd\') >= ORCHESTRATE.SRVC_FROM_DT and TO_CHAR(B.srvc_to_dt,\'yyyymmdd\') <= ORCHESTRATE.SRVC_TO_DT" else ""
My problem seems to be trying to pass the format within a variable. Can someone please tell me what I am doing wrong?
Thanks so much for any help.
Mona