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: PL SQL variable/scope question

Re: PL SQL variable/scope question

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 15 Sep 2001 19:36:35 +0100
Message-ID: <1000578832.134.0.nnrp-07.9e984b29@news.demon.co.uk>

The problem is that the CR in the
cursor loop is NOT the CR that you
have declared as a variable, it is an
implicitly created loop variable.

If you want to do this, one option (of
several) is to do something like:

open find_rows
loop

    fetch find_rows into CR;
    exit when find_rows%notfound;
    subr
end loop;

--
Jonathan Lewis
http://www.jlcomp.demon.co.uk

Host to The Co-Operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases

Screen saver or Life saver: http://www.ud.com
Use spare CPU to assist in cancer research.

Jay Scheiner wrote in message <3ba27a3e.10208625_at_news.starpower.net>...

>I am having trouble figuring out why this isn't working (this is a
>shortened version to clarify my problem)
>
>create procedure misc as
>cursor find_rows .....;
>cr table%rowtype;
>x number(10);
>procedure subr as
>begin
> x := cr.item
>end subr;
>--
>for cr in find_rows loop
> subr;
>end loop;
>
>The problem is that inside the subroutine the cursor row (cr) seems to
>be empty. Do I need to refer to it differently? Pass it as a
>parameter? Declare it as global (how)? Thanks for any help on this.
Received on Sat Sep 15 2001 - 13:36:35 CDT

Original text of this message

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