Solved

oracle case

Posted on 2011-03-08
4
332 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

837 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