好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

oracle中的异常处理方法

异常处理
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中的异常处理方法

标签:

查看更多关于oracle中的异常处理方法的详细内容...

  阅读:35次

上一篇: sql性能优化

下一篇:数据库分页学习