Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Function w/Record Param in SELECT?
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;
/
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
![]() |
![]() |