Solved

oracle case

Posted on 2011-03-08
4
333 Views
Last Modified: 2012-05-11
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
Comment
Question by:enrique_aeo
  • 2
4 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 62 total points
ID: 35071984
What is failing?

You do not need the when null then null since the ELSE passed back whatever it is.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 126 total points
ID: 35071989
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
 
LVL 3

Assisted Solution

by:CarlsbergFTW
CarlsbergFTW earned 62 total points
ID: 35071992
The case is correct , it returns null if the LineaCredVencimiento column contains '01/01/1900'
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 126 total points
ID: 35072015
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question