SQL CASE Statement in ProC [message #481049] |
Fri, 29 October 2010 12:40 |
mjm22
Messages: 54 Registered: January 2010 Location: Singapore
|
Member |
|
|
Hi,
I think I know the answer to this as I have come across similar issues in ProC where standard PL/SQL syntax does not work correctly when run in an EXEC SQL block.
Basically I have a cursor declared and then do a batch fetch. It is quite a large bit of SQL so I won't complicate this post by including it here.
The Cursor SQL has a CASE statement in the select that determines a generated END DTM column as a calculation on the start DTM, depending on another returned column (i.e. End DTM is Either START DTM + 2 hours or START DTM + 5 hours, etc).
However, If I run the cursor PL/SQL via Toad, SQL*PLUS, etc I get the required results. If I run the Pro*C code (against the same data), the ELSE option of the CASE command is always implemented and the values are incorrect.
Like I say, I think that this is because the CASE statement isn't supported correctly in Pro*C but I just thought I would check on here to confirm. If that is the case then I guess I will have to recode using a DECODE.
|
|
|
|