- 最后登录
- 2018-11-1
- 在线时间
- 377 小时
- 威望
- 29
- 金钱
- 6866
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 891
- 精华
- 4
- 积分
- 29
- UID
- 1
|
2#
发表于 2012-12-7 19:42:09
FYI
- SQL> create table emp(empno int primary key, ename varchar2(2000),depno int);
- Table created.
- SQL> insert into emp values(1,'maclean',2);
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> set serveroutput on;
- create or replace procedure p_test
- is
- begin
- insert into emp(empno,ename,depno) values(1,'maclean',3);
- commit;
- exception
- when others then
- ROLLBACK;
- dbms_output.put_line('SQLCODE: '||SQLCODE);
- dbms_output.put_line('SQLERRM: '||SQLERRM);
- end;
- /
- SQL> exec p_test;
- SQLCODE: -1
- SQLERRM: ORA-00001: unique constraint (SYS.SYS_C004814) violated
- PL/SQL procedure successfully completed.
- create or replace procedure p_test
- is
- begin
- insert into emp(empno,ename,depno) values(1,'maclean',3);
- commit;
- exception
- when others then
- ROLLBACK;
- dbms_output.put_line('SQLCODE: '||SQLCODE);
- dbms_output.put_line('SQLERRM: '||SQLERRM);
-
- DBMS_OUTPUT.PUT_LINE( DBMS_UTILITY.FORMAT_ERROR_BACKTRACE );
- end;
- /
- SQL> exec p_test;
- SQLCODE: -1
- SQLERRM: ORA-00001: unique constraint (SYS.SYS_C004814) violated
- ORA-06512: at "SYS.P_TEST", line 4
复制代码 |
|