Last row in the Cursor

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Mon, 01 Aug 2005 5:10 pm

I have a data Cursor loaded from a select somewhat heavy, at first I play the 1st loop with a count and then I play it again making the internal procedures and showing on the screen the percentage of execution.
but thus doubles the running time (baianagem).

I need to know is there any Cursor function that returns the number of rows that this will call me back.
TBou
Location: Campo Grande - MS

Thiago Bourscheidt
[email protected]
Analista de Sistemas

Poston Mon, 01 Aug 2005 5:35 pm

Unfortunately, only counting ...:-(
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Fri, 05 Aug 2005 4:56 pm

If your version of oracle is 9 or higher, you can in your cursor include a column with the total of lines ... for example ... cursor company is cod_empresa, select nom_empresa, count(*) over () as total_De_registros from company where etc. ..
charlesmafra
Location: Angola

Charles Mafra
Oracle Developer

Poston Fri, 05 Aug 2005 5:16 pm

Hi charlesmafra nice!

Except that count(*) over () also works in 8i. But, unfortunately, is an analytic function that only in the Enterprise Edition. The Standard Edition doesn't work!
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Fri, 02 Sep 2005 2:34 pm

Bah, q while I haven't been to the forum ein ... Nice face, so that you don't have to open thousand of times this cursor uses the schema at low ta and you can continue to use made the other columns.

Code: Select all
Select last_value( COLUNA ) over()
,         COLUNA
,         COLUNA2
,         COLUNA3
FROM  TABELA
hug! : wink:
leobbg
Location: PORTO ALEGRE - RS

Leo BBG Consultor Oracle

Poston Tue, 02 Feb 2010 8:07 am

I finally found a topic about it!

Both ways worked in Oracle 10 g:
Code: Select all
select last_value(rownum) over() as total, campos  from tabela
Code: Select all
select count(*) over() as total, campos  from tabela
thanks, guys!
Simone Isabela
Location: Belo Horizonte - MG



Return to PL/SQL

Who is online

Users browsing this forum: No registered users and 17 guests