Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

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
0
enrique_aeo
Asked:
enrique_aeo
  • 2
4 Solutions
 
slightwv (䄆 Netminder) Commented:
What is failing?

You do not need the when null then null since the ELSE passed back whatever it is.
0
 
sdstuberCommented:
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
 
CarlsbergFTWCommented:
The case is correct , it returns null if the LineaCredVencimiento column contains '01/01/1900'
0
 
sdstuberCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now