PL1user
New User
Joined: 26 Nov 2008 Posts: 13 Location: UK
|
|
|
|
Hi,
I am trying to use COLAESCE in one of my select SQLs. I would explain the problem i am facing with an example,
Code: |
SELECT COALESCE(MAX(MARK),100)
FROM <DB2TABLE>
WHERE NAME = :WS_NAME |
The above SQL would work fine. It would return either MAX(MARK) or 100.
My question is, if I have 100 in a working storage variable(e.g. WS_SCORE), would I be able to do something like,
Code: |
SELECT COALESCE(MAX(MARK),:WS_SCORE)
FROM <DB2TABLE>
WHERE NAME = :WS_NAME |
I think the above SQL would not work, as I get SQLCODE -171. But can anyone let me know if I can pass :WS_SCORE like above or in any other way using COALESCE?
Thanks. |
|