sql% rowcount

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 04 Jan 2007 9:48 am

I was wondering if the sql command% rowcount only returns rows procesados by DML statements, it does not work for a select?

ex: select count(*) from <table>
cleberzumba
Location: Brasília-DF

Cleber Zumba de Souza

Poston Thu, 04 Jan 2007 10:12 am

% RowCount returns the number of rows returned from a FETCH on the cursor. If you make a cursor with SELECT COUNT (*), it will return 1, because it is returning only 1 row in the cursor. (how many)

Another thing you can do is tell how many records are affected by an UPDATE. Hence, we use SQL% ROWCOUNT.
Example:
Code: Select all
update SUA_TABELA
  set ok='x'
  where ok='S';
 
  dbms_output.put_line(sql%rowcount);
in this case, the output is the amount of rows that the update did.
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



Return to SQL

Who is online

Users browsing this forum: No registered users and 1 guest



cron