Oracle概念:异常和游标
2009-06-09 13:15:38 来源:WEB开发网dbms_output.put_line(‘block 4’);
end;
exception
when NO_DATA_FOUND then
dbms_output.put_line(‘block 3’);
end;
exception
when NO_DATA_FOUND then
dbms_output.put_line(‘block 2’);
end;
exception
when NO_DATA_FOUND then
dbms_output.put_line(‘block 1’);
end;
/
作用域和可视性:
begin
declare
nested_excp exception;
begin
raise nested_excp;
end;
exception
when nested_excp then
dbms_output.put_line('haha');
end;
/
when others then
放在最后
begin
declare
nested_excp exception;
begin
raise nested_excp;
end;
exception
when others then
dbms_output.put_line('haha');
dbms_output.put_line(sqlcode || ‘ is ’ || sqlerrm);
raise;
end;
/
SQLCODE SQLERRM
declare
l_dept departments%rowtype;
begin
l_dept.department_id:=100;
l_dept.department_name:=’HR’;
insert into departments(department_id, department_name)
values(l_dept.department_id, l_dept.department_name);
Exception
When others then
dbms_output.put_line(sqlcode || ‘ is ’ || sqlerrm);
end;
/
declare
l_dept departments%rowtype;
begin
l_dept.department_id:=100;
l_dept.department_name:=’HR’;
insert into departments(department_id, department_name)
values(l_dept.department_id, l_dept.department_name);
Exception
When others then
Raise_application_error(-20001, ‘error message!’);
End;
/
系列文章:
Oracle概念:过程、函数、程序包
Oracle概念:同义词、序列与视图
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
- ››Oracle中在pl/sql developer修改表的两种方式
更多精彩
赞助商链接