oracle case

This sentence makes my web application to fall, this case right?
CASE LineaCredVencimiento
            WHEN TO_DATE('01/01/1900','DD/MM/YY') THEN null
            WHEN null THEN null
            ELSE LineaCredVencimiento
            end LineaCredVencimiento
enrique_aeoAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sdstuberConnect With a Mentor Commented:
the case itself is fine

depends how you use it

if you try to run that as a standalone statement it will fail.
if you select that case from some table with the LineaCredVencimiento column it should work.
if you try to assign that to a pl/sql variable it will fail.


0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
What is failing?

You do not need the when null then null since the ELSE passed back whatever it is.
0
 
CarlsbergFTWConnect With a Mentor Commented:
The case is correct , it returns null if the LineaCredVencimiento column contains '01/01/1900'
0
 
sdstuberConnect With a Mentor Commented:
WHEN null THEN null

doesn't work at all anyway, if you pass in NULL the WHEN condition will fail because

NULL is NOT equal to NULL  (NULL = NULL is false)
it's also not NOT equal to NULL  (NULL != NULL is false)


so it will appear to work because of the ELSE clause as stated by slightwv

it's safe to do, but not in the way you might think
0
All Courses

From novice to tech pro — start learning today.