CREATE OR REPLACE PROCEDURE cp_sys_exception
(
i_vprocname VARCHAR2, --存储过程名称
i_exceptioncontent VARCHAR2, --错误描述
i_ierrornum INT --错误位置
)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
t_ierrorcode INT;
BEGIN
t_ierrorcode := 0;
BEGIN
INSERT INTO sys_exception
(exceptionid,username,exceptiontime,exceptioncontent,errornum)
VALUES
(sys_guid(),i_vprocname,SYSDATE,i_exceptioncontent,DECODE(i_ierrornum,NULL,0, i_ierrornum));
EXCEPTION
WHEN OTHERS THEN
t_ierrorcode := SQLCODE;
END;
IF t_ierrorcode <> 0 THEN
ROLLBACK;
ELSE
COMMIT;
END IF;
RETURN;
END;
/*-- Create table
create table SYS_EXCEPTION
(
EXCEPTIONID CHAR(32) not null,
USERNAME VARCHAR2(256),
EXCEPTIONTIME DATE,
EXCEPTIONCONTENT VARCHAR2(4000),
ERRORNUM NUMBER
)
tablespace BDF_BASE
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table SYS_EXCEPTION
add constraint PK_SYS_EXCEPTION primary key (EXCEPTIONID)
using index
tablespace BDF_BASE_IDX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- Create/Recreate indexes
create index SYS_EXCEPTION_IDX01 on SYS_EXCEPTION (EXCEPTIONTIME)
tablespace BDF_BASE_IDX
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);*/
阅读(912) | 评论(0) | 转发(0) |