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: Daniel A. Morgan <Daniel.Morgan_at_attws.com>
Date: Mon, 25 Jun 2001 12:08:48 -0700
Message-ID: <3B378C40.5DFEDFCE@attws.com>

Nicolas MUGNIER wrote:

> Hi,
>
> How can I use the CASE WHEN ... THEN expression in a PL/SQL block ?
>
> I'v the following statement:
> INSERT INTO table(id, word) VALUES (ID, CASE WHEN x>1 THEN 'Word1' WHEN x>2
> THEN 'Word2' ELSE 'Word3' END);
>
> This statement works on command line but it doesn't in a PL/SQL block or in
> a stored procedure.
> Can somebody help me ?
>
> Thanks
>
> nunch

You can't.

You can, however, use DECODE which is Oracle's version of that syntax. It is far less verbose and performs the same function.

Daniel A. Morgan Received on Mon Jun 25 2001 - 14:08:48 CDT

Original text of this message

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