|
View previous topic :: View next topic
|
| Author |
Message |
pshongal
New User
Joined: 14 Jun 2012 Posts: 98 Location: India
|
|
|
|
Please see part of the query
,CASE
WHEN (DATE(VRFY_TS) >= CURRENT DATE - 30 DAYS)
THEN 'N'
ELSE 'Y'
END
I want to remove hard coded value "30" and make it dynamic. So I tried as below.
,CASE
WHEN (DATE(VRFY_TS) >= CURRENT DATE - (WS-DAYS) DAYS)
THEN 'N'
ELSE 'Y'
END
WS-DAYS will be passed from calling program. But this is not working
Please help to correct it. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| What does 'not working' mean? Syntax error, wrong data returned, something else? Should your host variable not be prefixed with ':'? |
|
| Back to top |
|
 |
pshongal
New User
Joined: 14 Jun 2012 Posts: 98 Location: India
|
|
|
|
It is giving bind error.
SQLCODE=-206
SQLSTATE=42703 |
|
| Back to top |
|
 |
chandan.inst
Active User

Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
This is not tested but try like below if it works
| Code: |
CASE
WHEN (DATE(VRFY_TS) >= CURRENT DATE - :WS-DAYS DAYS)
THEN 'N'
ELSE 'Y'
END |
Regards,
Chandan |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| Quote: |
SQLCODE=-206
SQLSTATE=42703 |
Why don't you provide us complete error log? |
|
| Back to top |
|
 |
chandan.inst
Active User

Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
You can use the solution provided by me in earlier post just make sure you have proper PIC clause for WS-DAYS as S9(4) COMP.
Let us know if it works.
Regards,
Chandan |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| Quote: |
You can use the solution provided by me in earlier post just make sure you have proper PIC clause for WS-DAYS as S9(4) COMP.
Let us know if it works. |
it should.... |
|
| Back to top |
|
 |
pshongal
New User
Joined: 14 Jun 2012 Posts: 98 Location: India
|
|
|
|
| Thanks a lot Chandan. It worked. |
|
| Back to top |
|
 |
|
|