您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
oracle-plsql与数据库交互
发布时间:2017-11-23 14:53:35编辑:雪饮阅读()
删除存储过程
SQL> drop procedure p09;
Procedure dropped.
创建与数据库交互的存储过程
创建一个通过部门编号就可以查询该部门名称、部门地址、部门人数、部门人力成本的存储过程。
SQL> create or replace procedure p11(dpnum number) is
2 cnt number;
3 sals number;
4 dn varchar2(14);
5 dl varchar2(13);
6 begin
7 select dname,loc into dn,dl from dept where deptno=dpnum;
8 select count(*),sum(sal) into cnt,sals from emp where deptno=dpnum;
9 dbms_output.put_line(dn||' which at '|| dl ||cnt||'worker,sals is '||sals);
10 end;
11 /
Procedure created.
查询部门编号为10的部门信息
SQL> call p11(10);
ACCOUNTING which at NEW YORK3worker,sals is 8750
Call completed.
关键字词:oracle,plsql,数据库,交互
上一篇:oracle-loop循环