?
Solved

oracle case

Posted on 2011-03-08
4
Medium Priority
?
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 248 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 504 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 248 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 504 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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.
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

764 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