Re: open/fetch/loop in hiring questions

Re: open/fetch/loop in hiring questions

 

  

I usually do this myself...except when I use REF cursors...I could never
get it to work with a cursor for loop. (my example is using a REF cursor).
My sql, and therefore cursor is built on the fly....

I was just answering the original question that was wondering what order
you would use if you used %NOTFOUND....

:-)

Kelly

On Fri, May 31, 2002 at 08:02:52AM -0700, after pounding the keys randomly, Michael Ault came up with....
> Actually, I would suggest a cursor for loop here, then
> there is no need for the open, fetch and close
> statements and it is more efficient.
>
> Mike
> --- Kelly Grigg <[Email Address Removed] wrote:
> > Here's my answer.
> >
> > Open cursor,
> > loop
> > fetch into variable
> > if %NOTFOUND (immediately after the fetch) then exit
> >
> > blah, blah, blah
> >
> > end loop;
> >
> > ----------------------------------------------------
> >
> > Here's a real example out of some code I'm working
> > on:
> >
> > open c_rooms for v_sql;
> >
> > <<table_fill_loop>>
> > LOOP
> >
> > FETCH c_rooms INTO rec_rooms;
> >
> > EXIT WHEN c_rooms%NOTFOUND;
> >
> > htp.tableRowOpen;

------------------

"Oh, you hate your job? Why didn't you say so? There's a support
group for that. It's called EVERYBODY, and they meet at the bar."

------------------

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.3ia

mQENAjyfn4YAAAEH+waMyqOmkhFrbfJqfg4A68a9HuqtQ+Z4djHRRRb59udOrPi4
JvQiwiDILQ11f3Akz+C7x5/0uHc5Bgdgd7CDBYLCEis+404vHH2fXRFgdqyO8bin
pVE2qh511umyZ8Rka5NQdNIspBKy7rpZ+zd8qKM2OAHsRkzhfAaRfMn20ZzqEpa3
zvN62QLHYSjOdhqq1sJo5pS9Vff0/fglcTSyUEWctsrLRqp+IBxn0deA4zKHR7eA
uSpSyyyV0KwsE4fIJQQG5ji59trSSPOFkS+j6ITrcpiDT7rJfK8z+sYQUovC5/2u
WrwCHAEIQa1QZEkGTJ5gE75qt5T8HxQEh634t+EABRG0C0tlbGx5IEdyaWdniQEU
AgUQPJ+fhh8UBIet+LfhAQGqAAf1Gn9P49yPKjhClsOHoW1JWi9gNTfNwx+ROL3R
61pfMlPrb4Q5UN7lYkR7mip0R9CYk5Se8POOxTVAc2KGzQB/xmuYcDPmxuNK4BQ/
vN7PSkrVmoU5kC8KKMOmx0msJWYqo4k6AONtCYP8jHEqgcaBnqE89arVL4/2cAPf
rfyzsdJBFZK4ww5bh2iMVSzrgs1H48I4l8TKX6vlg98n7fr8W/T3tgC22M+9O4u+
lR0yozce862Lx+b8+tw3w6OvxBQfhQXTbLHSQWE9ueSAofQQsichSsGxpCB/0c7s
Hw9CzQAQvyS7PLvPBOz63Qyea5h93YJuAzDijk9smvlvxVI0
=8qS0
-----END PGP PUBLIC KEY BLOCK-----
Oracle LazyDBA home page