by

Example: PLSQL Cursor with parameters updating the current line

Here is a example how to use cursor with parameters in PLSQL accessing each row
of the given table and changing it’s value.

declare
  cursor c_funcionario(p_matricula in number) 
    is (select * from funcionario where matricula = p_matricula) for update;
begin

  for currentFuncionario in c_funcionario(2) loop
    update funcionario set salario = 300 where current of c_funcionario;
  end loop;
  
  commit;
end;

Escreva um comentário

Comment