You are wrong ... SQL is NOT a subset of PL/SQL ...
declare
szVar varchar2(50);
begin
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
into szVar
FROM (SELECT 'CA' state FROM dual);
--------------------------------------------------------------------------------
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: A Joshi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 07, 2003 4:55 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: ** is there PL/SQL for case
Guang,
Thanks for your help. Do you have an example you can send me. I thought whatever one can do in sql one can do in pl/sql. meaning sql is a subset of pl/sql. Correct me if I am wrong. Thank You.
Guang Mei <[EMAIL PROTECTED]> wrote:
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
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.*********************************************************************1
