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: Jan <janik_at_pobox.sk>
Date: 19 Aug 2004 22:49:33 -0700
Message-ID: <81511301.0408192149.4771b536@posting.google.com>


DECLARE v_ret INTEGER;

BEGIN   FOR c_mytable IN (SELECT * FROM mytable) LOOP

      v_ret:= test(c_mytable);
  END LOOP; END; 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 Fri Aug 20 2004 - 00:49:33 CDT

Original text of this message

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