Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: case when ... then expression
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