oracle数据库sql语句10 存储过程
2017-12-08 21:07
357 查看
--创建存储过程
set serveroutput on;
--显示错误
show error;
--根据部门编号,输出该部门人数和平均工资
create or replace procedure pro_m(dno in emp.deptno%type)
as
num number(2);
avgsal emp.sal%type;
begin
select count(*),avg(sal) into num, avgsal from emp where deptno=dno;
dbms_output.put_line(num||' '||avgsal);
end;
/
--执行
exec pro_m(10);
--out 返回数据
create or replace procedure pro_m(id in emp.deptno%type, num out number, avgsal out emp.sal%type)
as
begin
select count(*),avg(sal) into num, avgsal from emp where deptno=id;
end;
/
--执行
declare
num number(2);
avgsal emp.sal%type;
begin
pro_m(10, num, avgsal);
dbms_output.put_line(num||' '||avgsal);
end;
/
set serveroutput on;
--显示错误
show error;
--根据部门编号,输出该部门人数和平均工资
create or replace procedure pro_m(dno in emp.deptno%type)
as
num number(2);
avgsal emp.sal%type;
begin
select count(*),avg(sal) into num, avgsal from emp where deptno=dno;
dbms_output.put_line(num||' '||avgsal);
end;
/
--执行
exec pro_m(10);
--out 返回数据
create or replace procedure pro_m(id in emp.deptno%type, num out number, avgsal out emp.sal%type)
as
begin
select count(*),avg(sal) into num, avgsal from emp where deptno=id;
end;
/
--执行
declare
num number(2);
avgsal emp.sal%type;
begin
pro_m(10, num, avgsal);
dbms_output.put_line(num||' '||avgsal);
end;
/
相关文章推荐
- oracle数据库常用SQL语句(11.29更新)
- oracle数据库的sql语句
- oracle数据库sql语句05
- Oracle数据库SQL语句性能调整的基本原则
- CUBRID学习笔记 18 sql语句的预处理(类似存储过程)
- 常用的sql语句及存储过程
- 查看oracle数据库最近执行了哪些sql语句
- oracle: OCA-047-题解与实验(10)--SQL语句中to_date的用法
- 1.Oracle数据库查看用户锁表和对表解锁的sql语句
- LINQ to SQL语句(20)之存储过程
- 通过Oracle数据库,学SQL语句。
- Oracle数据库SQL语句学习
- LINQ体验(10)——LINQ to SQL语句之开放式并发控制和事务
- 用SQL语句获得一个存储过程返回的表
- Entity Framework Core 执行SQL语句和存储过程
- LINQ to SQL语句(10)之Insert
- 一条SQL语句查询数据库中的所有表、存储过程、触发器
- SQL Server中存储过程比直接运行SQL语句慢的原因
- 用PL/SQL把oracle数据库表里的数据导出成insert语句的形式
- 存储过程__时间段内查询 以字符串形式输入SQL语句