Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sequences and cursors

Re: sequences and cursors

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 11 Dec 2003 01:54:25 -0800
Message-ID: <F001.005D978F.20031211015425@fatcity.com>

That won't help, as the cursor would still be held open in the pl/sql cursor cache - despite the explicit close.

It's also more efficient to use the implicit cursor in pl/sql for a single row fetch in the user's version of Oracle.

Regards

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

  The educated person is not the person   who can answer the questions, but the   person who can question the answers -- T. Schick Jr

One-day tutorials:
http://www.jlcomp.demon.co.uk/tutorial.html

Three-day seminar:
see http://www.jlcomp.demon.co.uk/seminar.html ____UK___November

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

> What tool are you using? HAve you considered putting select from the
> sequence in an explicit cursor, open it, fetch it and close it again?
> What Have in mind is something like this:
>
> declare
> cursor csr is
> select sai.nextval from dual;
> num integer :=0;
> ind integer :=10;
> begin
> while (ind>=0) loop
> open csr;
> fetch csr into num;
> close csr;
> dbms_output.put_line('Sai is:'||num);
> ind:=ind-1;
> end loop;
> end;
> /
>
>
> Here is the output:
>
> QL> /
> Sai is:13
> Sai is:14
> Sai is:15
> Sai is:16
> Sai is:17
> Sai is:18
> Sai is:19
> Sai is:20
> Sai is:21
> Sai is:22
> Sai is:23
>
> PL/SQL procedure successfully completed.
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Lewis
  INET: jonathan_at_jlcomp.demon.co.uk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Dec 11 2003 - 03:54:25 CST

Original text of this message

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