in 9i
SELECT CASE
WHEN state = 'CA' THEN 'Almost Bankrupt'
WHEN state = 'CT' THEN 'Ridiculously High Tax Rates for no particular reason'
WHEN state = 'PA' THEN 'We never stop fixing our roads'
WHEN state = 'NJ' THEN 'We have the best drivers'
END
FROM (SELECT 'CA' state FROM dual)
/
works ...
Raj
--------------------------------------------------------------------------------
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !
-----Original Message-----
From: Guang Mei [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 07, 2003 4:34 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: ** is there PL/SQL for case
I am not sure in 9i. But in 8i I think you can use "case" in sql but not in pl/sql. You have to use if elsif in pl/sql.
Guang
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of A Joshi
Sent: Thursday, August 07, 2003 4:24 PM
To: Multiple recipients of list ORACLE-L
Subject: ** is there PL/SQL for case
Hi,
Is there a statement in pl/SQL like case or is if elsif the only way. Meaning if I need to transalate state depending on input number as follows :
1 - CA
2 - OR
3 - WA
4 - AR
Can I have one statement like case 'state# :
1: state := 'CA'
2: state := 'OR'
etc.
or do i have to do :
IF state# = 1 THEN
state := 'CA';
ELSIF state# = 2 THEN
state := 'OR';
etc
Thank You.
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
********************************************************************This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*********************************************************************2
