日期:2014-05-16  浏览次数:20633 次

存储过程中package的使用
-- 结合空间中的 存储过程实例,学习package的用处

1. TYPES

CREATE OR REPLACE PACKAGE "TYPES"
AS
TYPE cursor_type IS REF CURSOR;
END;
2. ERR
CREATE OR REPLACE PACKAGE "ERR"
AS
        UPDATED_BY_OTHER_USER CONSTANT NUMBER := -20001;
         -- ERROR CODE = ORA-20001
DELETED_BY_OTHER_USER CONSTANT NUMBER := -20002;
         -- ERROR CODE = ORA-20002
DUPLICATE_CODE CONSTANT NUMBER :=-20003; -- ERROR CODE = ORA-20003
INVALID_ERROR_CODE CONSTANT NUMBER := -20990;
         -- ERROR CODE = ORA-20990
        UNIQUE_CONSTRAIT CONSTANT NUMBER := -00001;

RECORD_IS_LOCKED EXCEPTION;
PRAGMA EXCEPTION_INIT(RECORD_IS_LOCKED, -54);

PROCEDURE RAISE_ERR(error_code_in NUMBER);
--FUNCTION GET_ERR_MSG(error_code_in NUMBER) RETURN VARCHAR2;

END;