Re: PL/SQL

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 21 Jul 2001 21:42:11 GMT
Message-ID: <87ukgtso7ss4cuolk9irqrvj89ba5v0gli_at_4ax.com>


A copy of this was sent to Raymond Lee <mghong_at_pl.jaring.my> (if that email address didn't require changing) On Wed, 16 May 2001 22:37:49 +0800, you wrote:

> Hello
>
>How can I code a PL/SQL with a constant variable.
>For example I have a constant list of status code = "A,B,C,E,F,G,H'
>
>In my package , among some of the module ,I might need this constant
>to perform my status code checking , how can I simplify it ?
>
>Actually can Oracle declare a constant such as this or not
>
>status_code CONSTANT varchar2:=('A','B','C','D','E','F');
>...
>..
>.
>.
>.Procedure check_date
>
> if status NOT IN status_code THEN
> MESSAGE ('AAAA');
>end
>
>Is it possible ?

Use instr, not "IN" for this case:

status_code constant varchar2(25) := '/A/B/C/D/E/F/';

 ....

  if ( nvl(instr( status_code, '/'||status||'/' ),0) = 0 )   then

         message ......

>

--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://asktom.oracle.com/
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sat Jul 21 2001 - 23:42:11 CEST

Original text of this message