the output of select * from test; is 1 ashu 4000 2 bhawana 6000 3 raj 2000 I am trying to the update in the table and the table contents will be: 1 ashu 6000 2 bhawana 4000 3 raj 2000 the code to do the same is under procedure name salary_desc but it is working. create or replace procedure salary_desc is v_empno number; v_sal number; cursor c1 is select salary from test order by salary desc; /*cursor c2 is select salary into v_sal from test order by salary desc;*/ begin for r1 in c1 loop -- dbms_output.put_line(r1.empno); -- dbms_output.put_line(r1.salary); update test set salary = r1.salary where empno = r1.empno; end loop; exception when others then dbms_output.put_line('Error'); end;