我在
收到错误ERROR at line 1:
ORA-28110: policy function or package VPD1.COLUMN_SEC_PACKAGE has error
以下是我的过程
CREATE OR REPLACE
PACKAGE column_sec_package
AS
FUNCTION test_sec (
owner VARCHAR2,
objname VARCHAR2 )
RETURN VARCHAR2;
END;
CREATE OR REPLACE
PACKAGE body COLUMN_SEC_PACKAGE
IS
FUNCTION TEST_SEC (
OWNER VARCHAR2,
OBJNAME VARCHAR2 )
RETURN VARCHAR2
IS
v_SQL VARCHAR2 ( 2000 ) := '1=0';
BEGIN
IF ( SYS_CONTEXT ( 'USERENV', 'SESSION_USER' ) = 'VPD1' ) THEN
v_SQL := NULL;
END IF;
RETURN V_SQL;
END;
/
BEGIN
DBMS_RLS.ADD_POLICY ( object_schema => 'VPD1', object_name => 'employee',
policy_name => 'VPD1_POLICY_COLUMN1', function_schema => 'VPD1',
policy_function => 'COLUMN_SEC_PACKAGE.TEST_SEC', sec_relevant_cols =>
'salary' ) ;
END;
/
答案 0 :(得分:0)
尝试运行此功能。
CREATE OR REPLACE
PACKAGE column_sec_package
AS
FUNCTION test_sec (
owner VARCHAR2,
objname VARCHAR2 )
RETURN VARCHAR2;
END;
/
CREATE OR REPLACE
PACKAGE body COLUMN_SEC_PACKAGE
IS
FUNCTION TEST_SEC (
OWNER VARCHAR2,
OBJNAME VARCHAR2 )
RETURN VARCHAR2
IS
v_SQL VARCHAR2 ( 2000 ) := '1=0';
BEGIN
IF ( SYS_CONTEXT ( 'USERENV', 'SESSION_USER' ) = 'VPD1' ) THEN
v_SQL := NULL;
END IF;
RETURN V_SQL;
END;
END;
/
BEGIN
DBMS_RLS.ADD_POLICY ( object_schema => 'VPD1', object_name => 'employee',
policy_name => 'VPD1_POLICY_COLUMN1', function_schema => 'VPD1',
policy_function => 'COLUMN_SEC_PACKAGE.TEST_SEC', sec_relevant_cols =>
'salary' ) ;
END;
/