Archives of the TeradataForum
Message Posted: Mon, 03 Mar 2008 @ 18:09:30 GMT
Subj: | | Re: Oracle function %ROWTYPE |
|
From: | | Aldrin, John |
The %ROWTYPE is associated with defining a variable that stores the record returned from a cursor based operation. This is typically found
where the code has chosen to do a OPEN / FETCH / CLOSE cursor operations.
I have found that by converting the PL/SQL to use a FOR LOOP construct, it provides the record holder. In the following example, the variable
"cov_row" is in essence what you are trying to implement. This example is an way you get around a "TOO MANY ROWS" exception by reading the first
record returned and ignoring the remainder if they exist.
cov_loop:
FOR cov_row AS cov_cur CURSOR FOR
SELECT cvrg_key
FROM cvrg_dim
WHERE plcy_cvrg_id = :i_plcy_cov_id
DO
SET v_cvrg_key = cov_row.coverage_key;
LEAVE cov_loop;
END FOR cov_loop;
John...
|