存储过程模拟题

来源:互联网 发布:行业数据哪里找 编辑:程序博客网 时间:2024/04/30 15:56

      创建存储过程,功能是实现在员工信息表中输出指定民族的所有员工的姓名,

 如果无符合条件的员工,则触发异常,输出“无符合条件员工”。

create or replace procedure p2(mz in 员工信息表.民族%type)isname  员工信息表.民族%type;e exception;cursor c1 is select 姓名 from 员工信息表 where民族 = mz ;begin  open c1; fetch c1 into name;if c1%notfound then     raise e;   end if;while c1%found loop        dbms_output.put_line(name);        fetch c1 into name;end loop;exception  when e then    dbms_output.put_line('无符合条件员工');     colse c1; end; 

0 0
原创粉丝点击