WHERE CURRENT OF cursor within the

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

Poston Thu, 11 Nov 2004 3:58 pm

Could someone explain to me using the WHERE CURRENT OF???

Thank you!!!
tfg
Location: Novo Hamburgo - RS

Poston Thu, 11 Nov 2004 4:04 pm

The Where Current OF if uses when he wants to do an UPDATE on the current record of the cursor.

Here's a basic example:
Code: Select all
declare
  cursor cur1 is select i, c from test_for_cursor for update;
begin
  for aa in cur1 loop
    if aa.i>12 then
      update test_for_cursor set i=i*2, c=upper(c) where current of cur1;
    end if;
  end loop;
end;
Note that it is not necessary to place key or anything.
You can do the same if you retrieve the ROWID in the column, then just make a
Code: Select all
WHERE rowid= vur1.rowid
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


  • See also
    Replies
    Views
    Last Post


    Return to SQL

    Who is online

    Users browsing this forum: No registered users and 3 guests