create or replace procedure prc_get_sex
(stuname student.name%type)
as
stusex student.sex%type;
begin
select sex into stusex from student where name=stuname;
dbms_output.put_line(‘学生‘ || stuname || ‘的性别为:‘ || stusex);
exception
when too_many_rows then
dbms_output.put_line(‘数据太多‘);
when no_data_found then
dbms_output.put_line(‘没有找到数据‘);
when invalid_cursor then
dbms_output.put_line(‘无效的游标‘);
when zero_divide then
dbms_output.put_line(‘除数为零‘);
when dup_val_on_index then
dbms_output.put_line(‘唯一索引中插入了重复行‘);
when others then
dbms_output.put_line(‘出现异常‘);
end;
begin
prc_get_sex(‘张三‘);
end;
oracle数据库中的异常处理
标签:
本文系统来源:http://www.cnblogs.com/wush-2015/p/4618128.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!