Last cursor line

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Post Reply
User avatar
TBou
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 136
Joined: Thu, 05 Aug 2004 9:33 am
Location: Campo Grande - MS
Thiago Bourscheidt
thiago.info@apoiorural.com.br
Analista de Sistemas

I have a data cursor loaded from a SELECT
a bit heavy,
at first I squeeze the 1st loop with a count and then I ride it again doing the internal procedures and showing on the screen The percentage of execution.
But this way doubles the execution time (Baianagem).

I need to know how to be some cursor function that returns the number of lines that will return to me.
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

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

Unfortunately, just counting ... :-(
charlesmafra
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Thu, 19 Aug 2004 9:45 am
Location: Angola
Contact:
Charles Mafra
Oracle Developer

If your Oracle version is 9 or higher, you can in your cursor include a column with the total lines ... for example ...


WHERE etc ...
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

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

Hello Charlesmafra

ordered it!

Only this Count (*) Over () also works on 8i. But unfortunately, it is an analytical function that only has on the Bank Enterprise Edition. At Standard Edition does not work!
User avatar
leobbg
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 22
Joined: Fri, 29 Oct 2004 10:25 am
Location: PORTO ALEGRE - RS
Leo BBG Consultor Oracle

Bah, it's been a while since I do not enter the forum ein .. good face, so you do not need to open trocamentas times this cursor uses the down scheme that is done and you can continue using the other columns in a good.

Select all

Select last_value( COLUNA ) over() 
,         COLUNA 
,         COLUNA2 
,         COLUNA3 
FROM  TABELA
Embrace! : Wink:
Simone Isabela
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 2
Joined: Tue, 02 Feb 2010 7:20 am
Location: Belo Horizonte - MG

Finally I found a topic about it!

Of the two forms functioned in Oracle 10g:

Select all

select last_value(rownum) over() as total, campos  from tabela

Select all

select count(*) over() as total, campos  from tabela
Thanks guys!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests