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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to use a row * AS a ROWTYPE parameter for a stored FUNCTION in a SELECT statement

Re: How to use a row * AS a ROWTYPE parameter for a stored FUNCTION in a SELECT statement

From: Roger Redford <dba_222_at_yahoo.com>
Date: 19 Aug 2004 06:10:14 -0700
Message-ID: <a8c29269.0408190510.47f6b6ab@posting.google.com>


I don't think you can do this in sqlplus.

In PLSQL, declare the same type in a procedure. Populate it.

Then pass the type into the function.

johnlin_at_chttl.com.tw (John Lin) wrote in message news:<a73bcad1.0408182052.1a2e3f6f_at_posting.google.com>...
> Dear all,
>
> Suppose I have a FUNCTION as below:
>
> CREATE OR REPLACE FUNCTION test (x myTable%ROWTYPE) RETURN INTEGER
> AS BEGIN RETURN 1; END;
>
> How can I pass a whole row to it in a SELECT statement? For example:
>
> SELECT test(*) FROM myTable; -- doesn't work
>
> SELECT test(t.*) FROM myTable t; -- doesn't work
>
> What is the correct way to achieve this?
> Thank you very much.
>
> John Lin
>
> P.S. For the following statement:
>
> SELECT t.*, SYSDATE, t.* FROM myTable t;
>
> it works to treat * as a whole row. Don't know why it won't for test(t.*).
Received on Thu Aug 19 2004 - 08:10:14 CDT

Original text of this message

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