February 2nd, 2004, 12:56 AM
tough time with cursors
I am getting an error to which I am sure is because of a subquery within a cursor declaration. That may sound way wacked out to someone who knows what they are doing, but I was told that you cannot have a variable that hasn't been set yet in the cursor declaration, so I wasn't sure on another way to do it.
Here is the code.
Thanks for any help that you can give me
cursor c_rentalInvoices is
select rid.invoice_number, rid.date_returned
from rental_invoices ri, rental_invoice_details rid
ri. member_number = Select member_number From members Where last_name = p_lastName AND first_name = p_firstName
ri. invoice_number = rid.invoice_number;
February 2nd, 2004, 05:58 PM
you can use the subquery into declaration of cursors, see the following example:
create or replace function no_of_employee(p_deptno in number)
return number is
cursor c_emp is
select * from emp
where deptno = (select deptno from dept where deptno=p_deptno);
February 2nd, 2004, 08:13 PM
so there doens't really seem to be anything missing from the cursor that I am using then. Hmm I guess that is a good thing, I just have to look elsewhere for the problem.
Thanks for the help