首页 > 数据库技术 > 详细

oracle数据库中的异常处理

时间:2015-07-03 12:09:34      阅读:291      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!