在sqlplus中呼叫in out輸入輸出引數的儲存過程

wisdomone1發表於2010-06-29
1  create or replace procedure p_adjust_salary(emp_id number,sal in out number)
  2   is
  3     emp_job varchar2(10);
  4     avg_sal number(8,2);
  5   begin
  6     select job into emp_job from emp where empno=emp_id;
  7     select avg(sal) into avg_sal from emp where job=emp_job;
  8      sal:=(sal + avg_sal)/2;
  9        dbms_output.put_line('now employee salary is:'||sal);
 10      exception when others then
 11        dbms_output.put_line('table not data hehe');
 12*  end;
scott>/
Procedure created.
 

###在sqlplus中呼叫in out輸入輸出引數的儲存過程
scott>declare
  2  p1 number;
  3  p2 number;
  4  begin
  5  p1:=20;
  6  p2:=2;
  7  p_adjust_salary(p1,p2);
  8  dbms_output.put_line(p2);
  9  end;
 10  /
table not data hehe
2
PL/SQL procedure successfully completed.
scott>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-666610/,如需轉載,請註明出處,否則將追究法律責任。

相關文章