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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL function in a SELECT statement

Re: PL/SQL function in a SELECT statement

From: Marc Billiet <Marc.Billiet_at_hae.hydro.com>
Date: Thu, 24 Sep 1998 07:36:09 +0200
Message-ID: <3609DA49.45E@hae.hydro.com>


Bruno Pennec wrote:

I think you'd better write something like:

SELECT column1 FROM table1 WHERE my_function(column2) = 1

And your function should look like:

FUNCTION my_function(p_column2 IN table1.column2%TYPE) RETURN NUMBER IS
BEGIN
  IF p_column2 IN (value1, value2, ..., valuen) THEN     RETURN 1;
  ELSE
    RETURN 0;
  END IF;
END; Marc

>
> I need to do a SELECT statement like :
>
> SELECT column1 FROM table1 WHERE column2 in my_function;
>
> ( where my_function is a PL/SQL function. )
>
> My_function must return a list of items.
> What type must i use for the result of "my_function" ?
> (for example : column2 is a varchar2)
>
> best regards,
>
> bruno
Received on Thu Sep 24 1998 - 00:36:09 CDT

Original text of this message

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