Re: PL/SQL

From: Jared Still <jared_at_valleynet.com>
Date: 1996/02/05
Message-ID: <4f5747$9of_at_alpine.valleynet.com>#1/1


Benita Haslett <75041.1664_at_CompuServe.COM> wrote:

>I have a PL/SQL program in which I must read in a large table
>with a cursor and also access the table directly.
>Let's say that this_table had columns x and y; x has not null,
>unique values; y may be null. Each value in
>column y must exist somewhere in the table as an x value.
 

>For each record in this_table fetched with the cursor, if
>current_y is not null, I would like to :
> begin
> select from this_table where x = current_y;
> exception process_error;
> end;
>Is this ok or is it risky?
>Do I have to use aliases, or create a duplicate table?
 

>Thanks in advance, Benita.
 

>--
>Benita

This type of SQL statement is find in SQL*PLUS, but won't work in PL/SQL. Why not create another cursor using this statement?

	cursor newcurs(  curr_y in number )
	is
	select *
	from this_table
	where x = curr_y;

then use a cursor for loop:

	for curr_rec in newcurs(this_table.y) 
	loop
		processing...
	end loop;



Jared Still, Oracle DBA
RxNet, Division of Value Health
"All opinions are mine, not my employers" jared_at_valleynet.com Received on Mon Feb 05 1996 - 00:00:00 CET

Original text of this message