创建存储过程,功能是实现在员工信息表中输出指定民族的所有员工的姓名,
如果无符合条件的员工,则触发异常,输出“无符合条件员工”。
create or replace procedure p2
(mz in 员工信息表.民族%type)
is
name 员工信息表.民族%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;