Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: case when ... then expression

Re: case when ... then expression

From: Oleg Fedorov <OFederov_at_hds-mckhboc.com>
Date: 26 Jun 2001 09:30:20 -0700
Message-ID: <1b18fb6a.0106260830.7f374fe4@posting.google.com>

Of course you right, I've made a mistake. Thanks. I just wanted to say that you can use
IF .. THEN .. statements.

The main problem is you cannot use CASE WHEN ... THEN expression directly in PL/SQL block.
You should use EXECUTE IMMEDIATE statement.

Thanks,
Oleg

TurkBear <noone_at_nowhere.com> wrote in message news:<164hjtcfanos2ivo2ranffoubvcddilil3_at_4ax.com>...
> Careful other the > operators in your code...
>
> In your examples , 'Word1' would be inserted if x is any number from 2 up..so
> 'Word2' would never get inserted, and 'Word3 would only get inserted if x=1;
>
> If you reverse the order of the statements, all should be well..When using > as
> a test, check the largest desired number first, then go in descending order...
>
>
> OFederov_at_hds-mckhboc.com (Oleg Fedorov) wrote:
>
> >There are many ways to do that.
> >1)
> >IF x>1 THEN INSERT INTO table(id, word) VALUES (ID,'Word1')
> >ELSIF x>2 THEN INSERT INTO table(id, word) VALUES (ID,'Word2')
> >ELSE INSERT INTO table(id, word) VALUES (ID,'Word3');
Received on Tue Jun 26 2001 - 11:30:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US