ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在sqlplus中调用in out输入输出参数的存储过程

在sqlplus中调用in out输入输出参数的存储过程

原创 Linux操作系统 作者:wisdomone1 时间:2010-06-29 17:08:58 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-666610/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690167