title: Procedure to update column values in Oracle
body: <p>With a procedure in Oracle I want to update the code field of all records in a table from an input parameter. For example, if the parameter value is 100:</p>
  
  <p>row 1 with code 256 change to 101<br>
  row 2 with code 368 change to 102<br>
  row 3 with code 624 change to 103</p>
  
  <p>I try this</p>
  
  <pre><code>create or replace PROCEDURE procedure_name (parameter_newcode code%TYPE) AS
   CURSOR cursor_name IS select code from table
                             order by code asc;
    var_newCode code%TYPE;
    BEGIN
    OPEN cursor_name;
    LOOP
    FETCH cursor_name INTO var_newCode;
    EXIT WHEN cursor_name%NOTFOUND;
    var_newCode:=parameter_newcode+1;
    update table set code = var_newCode;
    END LOOP;
    CLOSE cursor_name;
   END procedure_name;
  </code></pre>
  
  <p>but returns the same code for each row (for example, if the parameter is 100 - > 101)</p>