Re: Quick (hopefully) pl/sql cursor question

  • From: Jacek Gębal <jgebal@xxxxxxxxx>
  • To: JSweetser@xxxxxxxx
  • Date: Fri, 27 Sep 2019 19:31:43 +0100

If the cursor is implicit in procedure3a like:

FOR x IN (SELECT * FROM DUAL) LOOP
  --do some stuff here
  NULL;
END LOOP;

The cursor is initialized when the PLSQL engine goes into FOR ...LOOP
statement.

Cheers,
Jacek

On Fri, 27 Sep 2019 at 18:27, Sweetser, Joe <JSweetser@xxxxxxxx> wrote:

Greetings,

Does anyone know exactly when an explicit cursor is initialized in
pl/sql?  I understand I may need to supply more info, but I am no pl/sql
wizard and don't know exactly what info is needed.

I have a package with multiple procedures.  One those procedures contains
additional procedures.  And one of those additional procedures has some
cursors.  Sorta like this:

Package
- procedure1
- procedure2
- procedure3
- procedure3a
- cursor 1
- cursor 2

Would the cursors be initialized when procedure3 is called or when
procedure3a is called?  I would guess procedure3a but the developer is
seeing some weirdness where it looks like it's when procedure3 is called.

There is no explicit "open cursor" call.  It is used in a for loop, so I
think oracle opens it automagically.  But, again, I am trying to determine
the initialization.  When is the cursor loaded with data?

Any/all ideas/suggestions welcome.

Thanks,
-joe

This e-mail transmission and any attachments that accompany it may contain
information that is privileged, confidential or otherwise exempt from
disclosure under applicable law and is intended solely for the use of the
individual's to whom it was intended to be addressed. If you have received
this e-mail by mistake, or you are not the intended recipient, any
disclosure, dissemination, distribution, copying or other use or retention
of this communication or its substance is prohibited. If you have received
this communication in error, please immediately reply to the author via
e-mail that you received this message by mistake and also permanently
delete the original and all copies of this e-mail and any attachments from
your computer. Please note that coverage cannot be bound or altered by
sending an email. You must receive written confirmation from a
representative of our firm to put coverage in force or make changes to an
existing policy.
--
//www.freelists.org/webpage/oracle-l



Other related posts: