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: Function w/Record Param in SELECT?

Re: Function w/Record Param in SELECT?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/12/18
Message-ID: <32b75fd3.7284875@dcsun4>#1/1

No you can't, it would be sort of neat but it is not part of the syntax.

You can, if you want do the following:

select pkg.f( rowid ) from T
/

create package pkg

   function f( trow in rowid ) returns varchar2;    pragma restrict_references( f, wnds, rnps, wnps ); end;
/

create package body pkg

function f ( trow in p_rowid ) returns varchar2 is

        TblRow Tbl%ROWTYPE ;
begin

	select * into tbl%rowtype from T where rowid = p_rowid;
        .....
     	return something;

end;

end;
/

On Tue, 17 Dec 1996 17:15:10 -0500, Barry Johnson <BJohnson_at_WorldBank.Org> wrote:

>Running V7.1.5, I gather I can do this:
>
> CREATE PACKAGE/BODY Pkg...
>
> FUNCTION F( TRow Tbl%ROWTYPE ) RETURNS VARCHAR2 ...
>
> END Pkg ;
>
> DECLARE
> TblRow Tbl%ROWTYPE ;
> BEGIN
> SELECT * INTO TblRow FROM Tbl ;
> ... Pkg.F( TblRow ) ...
> END ;
>
>Is there a way to short-circuit this with something like?!?:
>
> SELECT Pkg.F( * ) FROM Tbl ;
>
>That is, I want to call the function from the SELECT and pass it
>the entire row without having some temp, transitionary
>variable...guess I'm looking for some symmetry with the
>
> SELECT COUNT( * )...
>
>syntax :-) Alas, as shown doesn't seem to work and I even tried:
>
> SELECT Pkg.F( Tbl.* ) FROM Tbl ;
>
>to no avail...
>
>--
>Barry Johnson - BJohnson_at_WorldBank.Org

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Wed Dec 18 1996 - 00:00:00 CST

Original text of this message

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