Oracle April 2020 Critical Patch Advisory - PL/SQL detailed changes

This post is also available in: Português

Oracle April 2020 Critical Patch Advisory changed objects performed by each database patch.

For more details and the catalog, check the main post: Dissecting 200414 BP, PSU, RU and RUR

What exactly changed for each?
(click to see detailed line changes)

Changed Objects

P.S:
> = Added Lines
< = Removed Lines

12.1.0.2

DVSYS.DBMS_MACADM - PACKAGE (BP):
1228a1229,1239
>   /* APIs to authorize a user to execute PREPROCESSOR directive in external
>    * tables.
>    */
>   PROCEDURE authorize_preprocessor
>            ( uname       IN VARCHAR2
>            );
> 
>   PROCEDURE unauthorize_preprocessor
>            ( uname       IN VARCHAR2
>            );
> 
DVSYS.DBMS_MACADM - PACKAGE BODY (BP):
2419a2420,2431
> 
> 
>   PROCEDURE AUTHORIZE_PREPROCESSOR( UNAME IN VARCHAR2 ) IS
>   BEGIN
>     AUTHORIZE_DV_AUTH('PREPROCESSOR', UNAME, NULL, NULL, NULL);
>   END;
> 
>   PROCEDURE UNAUTHORIZE_PREPROCESSOR( UNAME IN VARCHAR2 ) IS
>   BEGIN
>     REVOKE_DV_AUTH('PREPROCESSOR', UNAME, NULL, NULL, NULL);
>   END;
> 
DVSYS.DBA_DV_PREPROCESSOR_AUTH - VIEW (BP):
0a1,5
> SELECT
>     u1.name
> FROM dvsys.dv_auth$ da, sys.user$ u1
> WHERE da.grant_type = 'PREPROCESSOR' and da.grantee_id = u1.user#
> 
SYS.DBMS_SQLDIAG_INTERNAL - PACKAGE (BP):
7a8
> 
8a10,12
>   ERR_INCID_INVALID             CONSTANT NUMBER := -56950;
>   ERR_INVALID_SQLID             CONSTANT NUMBER := -56975;
> 
67a72,73
>   
>   FUNCTION CLOB_TO_SQLPROF_ATTR(CL CLOB) RETURN SQLPROF_ATTR;
72c78,96
<                    HINT_TEXT     IN VARCHAR2,
---
>                    HINT_TEXT     IN CLOB,
>                    NAME          IN VARCHAR2 := NULL,
>                    DESCRIPTION   IN VARCHAR2 := NULL,
>                    CATEGORY      IN VARCHAR2 := 'DEFAULT',
>                    VALIDATE      IN BOOLEAN  := TRUE);
> 
>   
>   PROCEDURE I_CREATE_HINTSET(
>                      SQL_ID        IN VARCHAR2,
>                      HINT_TEXT     IN CLOB,
>                      NAME          IN VARCHAR2 := NULL,
>                      DESCRIPTION   IN VARCHAR2 := NULL,
>                      CATEGORY      IN VARCHAR2 := 'DEFAULT',
>                      VALIDATE      IN BOOLEAN  := TRUE);
> 
>   
>   PROCEDURE I_CREATE_PATCH(
>                    SQL_ID        IN VARCHAR2,
>                    HINT_TEXT     IN CLOB,
81c105
<                    HINT_TEXT     IN VARCHAR2,
---
>                    HINT_TEXT     IN CLOB,
SYS.PRVT_ILM - PACKAGE (BP):
36c36,39
< 
---
>       
>       DICT_ROW_LEVEL_LOCKING CONSTANT NUMBER       := 32;
>       ROW_LVL_LOCKING_PREFIX CONSTANT VARCHAR2(20) := ' ROW LEVEL LOCKING '; 
>   
SYS.DBMS_QOPATCH - PACKAGE BODY (BP):
490a491,496
> 
>   EV_TIMEOUT   BINARY_INTEGER := 18079311;
>   LV_VALUE     BINARY_INTEGER := 120;
> 
>   TIMEOUT_VAL  INTEGER       := 120;
> 
639a646,659
>         DBMS_SYSTEM.READ_EV(EV_TIMEOUT, LV_VALUE);
> 
>          
>          IF LV_VALUE <= 0  THEN
>               TIMEOUT_VAL := 120;
>          ELSIF LV_VALUE > 1800 THEN
>               TIMEOUT_VAL := 1800;
>          ELSE 
>               TIMEOUT_VAL := LV_VALUE;   
>          END IF;
>  
>          IF DO_DEBUG THEN
>            DBMS_OUTPUT.PUT_LINE('run_job timeout set to =' || LV_VALUE || 'timeout =' || TIMEOUT_VAL);
>          END IF;
649c669
<             IF JWTIME > 120 THEN
---
>             IF JWTIME > TIMEOUT_VAL THEN
709c729
<                            || ' time is more than 120Secs');
---
>                            || ' time is more than' || TIMEOUT_VAL ||' Secs');
759d778
< 
1456a1476
> PRAGMA                   AUTONOMOUS_TRANSACTION;
1507a1528,1529
> 
>   COMMIT;
SYS.DBMS_REDEFINITION - PACKAGE BODY (BP):
54a55,57
>   CONS_REDEF_TABLE_API  CONSTANT PLS_INTEGER := 1;
> 
>   
104a108,109
>   
>   
110c115,116
<                              CONT_ERR            IN BOOLEAN) IS
---
>                              CONT_ERR            IN BOOLEAN,
>                              CALLER_FLAGS        IN PLS_INTEGER) IS
121c127,128
<                CONT_ERR         SB1,       CONT_ERR         INDICATOR SB2)
---
>                CONT_ERR         SB1,       CONT_ERR         INDICATOR SB2,
>                CALLER_FLAGS     UB4,       CALLER_FLAGS     INDICATOR SB2)
2922a2930,2993
>   PROCEDURE FINISH_REDEF_TABLE_INT(UNAME          IN VARCHAR2,
>                                    ORIG_TABLE     IN VARCHAR2,
>                                    INT_TABLE      IN VARCHAR2,
>                                    PART_NAME      IN VARCHAR2 := NULL,
>                                    DML_LOCK_TIMEOUT IN PLS_INTEGER := NULL,
>                                    CONTINUE_AFTER_ERRORS  IN BOOLEAN := FALSE,
>                                    CALLER_FLAGS     IN PLS_INTEGER := 0) IS
>     NUM_PARTS        BINARY_INTEGER;
>     TMP_PARTS        DBMS_UTILITY.UNCL_ARRAY;
>     NUM_ITABS        BINARY_INTEGER;
>     TMP_ITABS        DBMS_UTILITY.UNCL_ARRAY;
>     CANON_UNAME      IDENS;
>     CANON_ORIGTAB    IDENS;
>     CANON_INTTAB     IDENS;
>     CANON_PARTNM     IDENS;
>   BEGIN
>     COMMIT WORK;
> 
>     
>     IF (UNAME IS NULL) OR (ORIG_TABLE IS NULL) OR (INT_TABLE IS NULL) THEN
>       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_ARG_ERROR_NUM);
>     END IF;
>     
>     DBMS_UTILITY.COMMA_TO_TABLE(INT_TABLE, NUM_ITABS, TMP_ITABS);
>     CANON_UNAME(1)   := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(UNAME);
>     CANON_ORIGTAB(1) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(ORIG_TABLE);
>     
>     FOR I IN 1..NUM_ITABS LOOP
>        CANON_INTTAB(I) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TMP_ITABS(I));
>     END LOOP;
>     
>     IF (PART_NAME IS NOT NULL) THEN
>        DBMS_UTILITY.COMMA_TO_TABLE(PART_NAME, NUM_PARTS, TMP_PARTS);
>        IF (NUM_ITABS != NUM_PARTS) THEN
>           DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_ARG_ERROR_NUM);
>        END IF;
>        FOR I IN 1..NUM_PARTS LOOP
>           CANON_PARTNM(I) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TMP_PARTS(I));
>        END LOOP;
>     ELSE 
>        CANON_PARTNM(1) := NULL;
>     END IF;    
>     
>     
>     
>     IF (DML_LOCK_TIMEOUT > 1000000 OR
>         DML_LOCK_TIMEOUT < 0) THEN
>       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_DML_TIMEOUT_ERROR_NUM);
>     END IF;
> 
>     FINISH_REDEF_INT(CANON_UNAME, CANON_ORIGTAB, CANON_INTTAB, CANON_PARTNM,
>                      DML_LOCK_TIMEOUT, CONTINUE_AFTER_ERRORS, CALLER_FLAGS);
> 
>   END;
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
2983a3055
>     CALLERFLAG      PLS_INTEGER := CONS_REDEF_TABLE_API;
3472c3544,3545
<     FINISH_REDEF_TABLE(UNAME, TNAME, CANON_INAME);
---
>     FINISH_REDEF_TABLE_INT(UNAME, TNAME, CANON_INAME, NULL, NULL, FALSE, 
>                            CALLERFLAG);
3623a3697,3698
>   
>   
3627c3702
<                                PART_NAME      IN VARCHAR2 := NULL,                               
---
>                                PART_NAME      IN VARCHAR2 := NULL,
3630,3637d3704
<     NUM_PARTS        BINARY_INTEGER;
<     TMP_PARTS        DBMS_UTILITY.UNCL_ARRAY;
<     NUM_ITABS        BINARY_INTEGER;
<     TMP_ITABS        DBMS_UTILITY.UNCL_ARRAY;
<     CANON_UNAME      IDENS;
<     CANON_ORIGTAB    IDENS;
<     CANON_INTTAB     IDENS;
<     CANON_PARTNM     IDENS;
3639,3675c3706,3708
<     COMMIT WORK;
< 
<     
<     IF (UNAME IS NULL) OR (ORIG_TABLE IS NULL) OR (INT_TABLE IS NULL) THEN
<       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_ARG_ERROR_NUM);
<     END IF;
<     
<     DBMS_UTILITY.COMMA_TO_TABLE(INT_TABLE, NUM_ITABS, TMP_ITABS);
<     CANON_UNAME(1)   := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(UNAME);
<     CANON_ORIGTAB(1) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(ORIG_TABLE);
<     
<     FOR I IN 1..NUM_ITABS LOOP
<        CANON_INTTAB(I) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TMP_ITABS(I));
<     END LOOP;
<     
<     IF (PART_NAME IS NOT NULL) THEN
<        DBMS_UTILITY.COMMA_TO_TABLE(PART_NAME, NUM_PARTS, TMP_PARTS);
<        IF (NUM_ITABS != NUM_PARTS) THEN
<           DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_ARG_ERROR_NUM);
<        END IF;
<        FOR I IN 1..NUM_PARTS LOOP
<           CANON_PARTNM(I) := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TMP_PARTS(I));
<        END LOOP;
<     ELSE 
<        CANON_PARTNM(1) := NULL;
<     END IF;    
<     
<     
<     
<     IF (DML_LOCK_TIMEOUT > 1000000 OR
<         DML_LOCK_TIMEOUT < 0) THEN
<       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(INVALID_DML_TIMEOUT_ERROR_NUM);
<     END IF;
< 
<     FINISH_REDEF_INT(CANON_UNAME, CANON_ORIGTAB, CANON_INTTAB, CANON_PARTNM,
<                      DML_LOCK_TIMEOUT, CONTINUE_AFTER_ERRORS);
< 
---
>     FINISH_REDEF_TABLE_INT(UNAME, ORIG_TABLE, INT_TABLE, PART_NAME,
>                            DML_LOCK_TIMEOUT, CONTINUE_AFTER_ERRORS,
>                            0);
SYS.DBMS_SQLDIAG_INTERNAL - PACKAGE BODY (BP):
189a190,238
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION CLOB_TO_SQLPROF_ATTR(CL CLOB) RETURN SQLPROF_ATTR
>   IS
>     SQLPROF_V SQLPROF_ATTR;
>     OFFSET    INTEGER;
>     BUF_500   VARCHAR2(500 CHAR);
>     BUFLEN    INTEGER;
>   BEGIN
>     IF CL IS NULL THEN
>       RETURN NULL;
>     END IF;
> 
>     SQLPROF_V := SQLPROF_ATTR();
>     OFFSET := 1;
> 
>     LOOP
>       BUF_500 := DBMS_LOB.SUBSTR(CL, 500, OFFSET);
>       BUFLEN := LENGTH(BUF_500);
> 
>       IF (BUFLEN > 0) THEN
>         SQLPROF_V.EXTEND(1);
>         SQLPROF_V(SQLPROF_V.COUNT) := BUF_500;
>       END IF;
> 
>       
>       EXIT WHEN (BUFLEN < 500 OR BUFLEN IS NULL);
> 
>       
>       OFFSET := OFFSET + BUFLEN;
>     END LOOP;
> 
>     RETURN SQLPROF_V;
> 
>   END CLOB_TO_SQLPROF_ATTR;
196c245
< 		   HINT_TEXT     IN VARCHAR2,
---
> 		   HINT_TEXT     IN CLOB,
212c261
<     HS := SYS.SQLPROF_ATTR(HINT_TEXT);
---
>     HS := CLOB_TO_SQLPROF_ATTR(HINT_TEXT);
226a276,322
>   PROCEDURE I_CREATE_HINTSET(
> 		   SQL_ID        IN VARCHAR2,
> 		   HINT_TEXT     IN CLOB,
> 		   NAME          IN VARCHAR2 := NULL,
> 		   DESCRIPTION   IN VARCHAR2 := NULL,
> 		   CATEGORY      IN VARCHAR2 := 'DEFAULT',
>                    VALIDATE      IN BOOLEAN  := TRUE)
>   IS
>     SQL_TEXT  CLOB;
>     GETSQLTXTQ VARCHAR2(150);
>   BEGIN
>     
>     COMMIT;
> 
>     
>     DBMS_SMB.CHECK_SMB_PRIV;
> 
>     
>     BEGIN
>     IF SQL_ID IS NOT NULL THEN 
>       GETSQLTXTQ := 'select sql_fulltext from sys.v$sql ' ||
>                      'where upper(sql_id) = upper(:sqlid) and '||
>                      '      rownum = 1 ';
>       EXECUTE IMMEDIATE GETSQLTXTQ INTO SQL_TEXT USING SQL_ID;
>     ELSE
>       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                      SYS.DBMS_SQLDIAG_INTERNAL.ERR_INCID_INVALID);
>     END IF;
>     EXCEPTION 
>       WHEN NO_DATA_FOUND THEN
>         DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                        SYS.DBMS_SQLDIAG_INTERNAL.ERR_INVALID_SQLID);
>       WHEN OTHERS THEN
>         RAISE;
>     END;
> 
>     I_CREATE_HINTSET (SQL_TEXT => SQL_TEXT, 
>                       HINT_TEXT => HINT_TEXT, 
>                       NAME => NAME, 
>                       DESCRIPTION=> DESCRIPTION, 
>                       CATEGORY=> CATEGORY, 
>                       VALIDATE => VALIDATE);
>   END;
> 
>   
>   
>   
229c325
< 		   HINT_TEXT     IN VARCHAR2,
---
> 		   HINT_TEXT     IN CLOB,
245c341
<     HS := SYS.SQLPROF_ATTR(HINT_TEXT);
---
>     HS := CLOB_TO_SQLPROF_ATTR(HINT_TEXT);
256a353,399
>   END;
> 
>   
>   
>   
>   PROCEDURE I_CREATE_PATCH(
> 		   SQL_ID        IN VARCHAR2,
> 		   HINT_TEXT     IN CLOB,
> 		   NAME          IN VARCHAR2 := NULL,
> 		   DESCRIPTION   IN VARCHAR2 := NULL,
> 		   CATEGORY      IN VARCHAR2 := 'DEFAULT',
>                    VALIDATE      IN BOOLEAN  := TRUE)
>   IS
>     SQL_TEXT  CLOB;
>     GETSQLTXTQ VARCHAR2(150);
>   BEGIN
>     
>     COMMIT;
> 
>     
>     DBMS_SMB.CHECK_SMB_PRIV;
> 
>     
>     BEGIN
>     IF SQL_ID IS NOT NULL THEN 
>       GETSQLTXTQ := 'select sql_fulltext from sys.v$sql ' ||
>                      'where upper(sql_id) = upper(:sqlid) and '||
>                      '      rownum = 1';
>       EXECUTE IMMEDIATE GETSQLTXTQ INTO SQL_TEXT USING SQL_ID;
>     ELSE
>       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                      SYS.DBMS_SQLDIAG_INTERNAL.ERR_INCID_INVALID);
>     END IF;
>     EXCEPTION 
>       WHEN NO_DATA_FOUND THEN
>         DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                        SYS.DBMS_SQLDIAG_INTERNAL.ERR_INVALID_SQLID);
>       WHEN OTHERS THEN
>         RAISE;
>     END;
> 
>     I_CREATE_PATCH (SQL_TEXT => SQL_TEXT, 
>                     HINT_TEXT => HINT_TEXT, 
>                     NAME => NAME, 
>                     DESCRIPTION=> DESCRIPTION, 
>                     CATEGORY=> CATEGORY, 
>                     VALIDATE => VALIDATE);
SYS.LOGMNR_DICT_CACHE - PACKAGE BODY (BP):
128a129
> 
134a136,138
> 
> DUPLICATE_FOUND BOOLEAN := FALSE;
> 
136,139c140,167
<    INSERT INTO SYSTEM.LOGMNRC_CONCOL_GG (
<               LOGMNR_UID, CON#, INTCOL#, POS#, SPARE1, COMMIT_SCN) VALUES (
<               LM_LOGMNR_UID, LM_CON#, LM_INTCOL#, LM_POS#, LM_COLFLAGS,
<               LM_COMMIT_SCN);
---
>   BEGIN
>     INSERT INTO SYSTEM.LOGMNRC_CONCOL_GG (
>                LOGMNR_UID, CON#, INTCOL#, POS#, SPARE1, COMMIT_SCN) VALUES (
>                LM_LOGMNR_UID, LM_CON#, LM_INTCOL#, LM_POS#, LM_COLFLAGS,
>                LM_COMMIT_SCN);
>   EXCEPTION
>     WHEN DUP_VAL_ON_INDEX THEN
>       DUPLICATE_FOUND := TRUE;
>   END;
> 
>   
> 
> 
> 
> 
> 
> 
>   IF (DUPLICATE_FOUND = TRUE) THEN
>     UPDATE SYSTEM.LOGMNRC_CONCOL_GG
>       SET  POS#           = LM_POS#,
>            SPARE1         = LM_COLFLAGS,
>            SPARE2         = NULL,
>            SPARE3         = NULL
>      WHERE LOGMNR_UID     = LM_LOGMNR_UID
>      AND   CON#           = LM_CON#
>      AND   INTCOL#        = LM_INTCOL#
>      AND   COMMIT_SCN     = LM_COMMIT_SCN;
>   END IF;
156a185,189
> 
> 
> 
> 
> 
172,173c205
<   CURSOR CONS_C (C_LOGMNR_UID IN NUMBER, C_BASEOBJV# IN NUMBER,
<                              C_BASEOBJ# IN NUMBER) IS
---
>   CURSOR CONS_C (C_LOGMNR_UID IN NUMBER, C_BASEOBJ# IN NUMBER) IS
191,192c223
<           FROM  SYSTEM.LOGMNR_USER$ U, 
<                 SYSTEM.LOGMNR_CDEF$ CD, 
---
>           FROM  SYSTEM.LOGMNR_CDEF$ CD, 
194d224
<                 SYSTEM.LOGMNR_OBJ$ O, 
198,199c228
<                 U.LOGMNR_UID = C_LOGMNR_UID
<                 AND CD.LOGMNR_UID = C_LOGMNR_UID
---
>                 CD.LOGMNR_UID = C_LOGMNR_UID
201d229
<                 AND O.LOGMNR_UID = C_LOGMNR_UID
204c232
<                 AND O.OBJ# = C_BASEOBJ#         
---
>                 AND CD.OBJ# = C_BASEOBJ#         
206d233
<                 AND O.OWNER# = U.USER# 
212,213c239
<                 AND CD.OBJ# = O.OBJ#
<     ORDER BY NAME, POSITION;
---
>     ORDER BY CON#, POSITION;
215,217c241,243
<     CURRENT_CON_NAME VARCHAR2(128);
<     LM_FLAGS NUMBER;
<     LM_CON# NUMBER;
---
>     CURRENT_CON_CON#     NUMBER;
>     LM_FLAGS             NUMBER;
>     LM_CON#              NUMBER;
219,221c245,249
<     LM_CON_NAME VARCHAR2(128);
<     LM_COMMIT_SCN NUMBER;
<     TRACE_LEVEL NUMBER;
---
>     LM_CON_CON#          NUMBER;
>     LM_COMMIT_SCN        NUMBER;
>     TRACE_LEVEL          NUMBER;
>     AS_OF_SCN            NUMBER;
>     IS_DML_EVENT         NUMBER;
226c254
<     CURRENT_CON_NAME := ' ';
---
>     CURRENT_CON_CON# := NULL;
235c263
<     FOR SEL_REC IN CONS_C (LM_LOGMNR_UID, LM_BASEOBJV#,LM_BASEOBJ#) 
---
>     FOR SEL_REC IN CONS_C (LM_LOGMNR_UID, LM_BASEOBJ#) 
237c265
<       LM_CON_NAME := SEL_REC.NAME;
---
>       LM_CON_CON# := SEL_REC.CON#;
242c270,271
<       IF CURRENT_CON_NAME <> LM_CON_NAME THEN
---
>       IF (CURRENT_CON_CON# <> LM_CON_CON#) OR 
>         (CURRENT_CON_CON# IS NULL) THEN
256c285
<         CURRENT_CON_NAME := LM_CON_NAME;
---
>         CURRENT_CON_CON# := LM_CON_CON#;
258c287,288
<                        ':con_name='||CURRENT_CON_NAME||
---
>                        ':con_name='||SEL_REC.NAME|| 
>                        ':con_con#='||CURRENT_CON_CON#||
397a428
> 
403a435,437
> 
> DUPLICATE_FOUND BOOLEAN := FALSE;
> 
405,409c439,448
<    INSERT INTO SYSTEM.LOGMNRC_INDCOL_GG (
<               LOGMNR_UID, OBJ#, INTCOL#, POS#, SPARE1, COMMIT_SCN
<               ) VALUES (
<               LM_LOGMNR_UID, LM_INDEX_OBJ#, LM_INTCOL#, 
<               LM_POS#, LM_COLFLAGS, LM_COMMIT_SCN);
---
>   BEGIN
>     INSERT INTO SYSTEM.LOGMNRC_INDCOL_GG (
>                LOGMNR_UID, OBJ#, INTCOL#, POS#, SPARE1, COMMIT_SCN
>                ) VALUES (
>                LM_LOGMNR_UID, LM_INDEX_OBJ#, LM_INTCOL#, 
>                LM_POS#, LM_COLFLAGS, LM_COMMIT_SCN);
>   EXCEPTION
>     WHEN DUP_VAL_ON_INDEX THEN
>       DUPLICATE_FOUND := TRUE;
>   END;
410a450,471
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   IF (DUPLICATE_FOUND = TRUE) THEN
>     UPDATE SYSTEM.LOGMNRC_INDCOL_GG
>       SET  POS#           = LM_POS#,
>            SPARE1         = LM_COLFLAGS,
>            SPARE2         = NULL,
>            SPARE3         = NULL
>      WHERE LOGMNR_UID     = LM_LOGMNR_UID
>      AND   OBJ#           = LM_INDEX_OBJ#
>      AND   INTCOL#        = LM_INTCOL#
>      AND   COMMIT_SCN     = LM_COMMIT_SCN;
>   END IF;
>   
426a488,496
> 
> 
> 
> 
> 
> 
> 
> 
> 
481c551
<     ORDER BY NAME, POSITION;
---
>     ORDER BY INDEX_OBJ#, POSITION;
483,484c553,554
<     CURRENT_IND_NAME VARCHAR2(128);
<     LM_FLAGS NUMBER;
---
>     CURRENT_IND_OBJ#     NUMBER;
>     LM_FLAGS             NUMBER;
486,488c556,558
<     LM_IND_NAME VARCHAR2(128);
<     LM_COMMIT_SCN NUMBER;
<     TRACE_LEVEL NUMBER;
---
>     LM_IND_OBJ#          NUMBER;
>     LM_COMMIT_SCN        NUMBER;
>     TRACE_LEVEL          NUMBER;
493c563
<     CURRENT_IND_NAME := ' '; 
---
>     CURRENT_IND_OBJ# := NULL;
504c574
<       LM_IND_NAME := SEL_REC.NAME;
---
>       LM_IND_OBJ# := SEL_REC.INDEX_OBJ#;
507,508c577,578
<                      'save_indexes:old='||CURRENT_IND_NAME||':new='||
<                      LM_IND_NAME);
---
>                      'save_indexes:old obj#='||CURRENT_IND_OBJ#
>                      ||':new obj#='||LM_IND_OBJ#);
513c583,584
<       IF CURRENT_IND_NAME <> LM_IND_NAME THEN
---
>       IF (CURRENT_IND_OBJ# <> LM_IND_OBJ#) OR 
>         (CURRENT_IND_OBJ# IS NULL) THEN
515c586
<                     SEL_REC.INDEX_OBJ#, 
---
>                     LM_IND_OBJ#, 
517c588
<                     LM_IND_NAME,
---
>                     SEL_REC.NAME,
527c598
<         CURRENT_IND_NAME := LM_IND_NAME;
---
>         CURRENT_IND_OBJ# := LM_IND_OBJ#;
530c601,602
<                        ':con_name='||CURRENT_IND_NAME||
---
>                        ':ind_name='||SEL_REC.NAME||
>                        ':ind_obj#='||CURRENT_IND_OBJ#||
SYS.PRVT_ILM - PACKAGE BODY (BP):
3420c3420
< 
---
>                       
3434a3435,3442
>                                    
>                                    IF(BITAND(V_ILM_OBJPOLICY_INFO.FLAG,
>                                              DICT_ROW_LEVEL_LOCKING) = 
>                                              DICT_ROW_LEVEL_LOCKING) 
>                                    THEN
>                                   V_COMP_CLAUSE := V_COMP_CLAUSE ||
>                                                 ROW_LVL_LOCKING_PREFIX;
>                                    END IF;
5109,5110c5117
<            TRACE(ILM_DEBUG_ENTRY_EXIT,
<                   'Exiting execute_ilm_policies ');
---
> 
5112,5116d5118
<           BEGIN
<              PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
<              EXCEPTION
<           WHEN OTHERS THEN
<          
5119,5121c5121,5127
<             NULL;
<           END;
<          
---
>           
>           IF (V_TAB_ILMJOB.COUNT > 0) THEN
>             BEGIN
>                PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
>                EXCEPTION
>             WHEN OTHERS THEN
>             
5124c5130,5143
<           PRVT_ILM.UPDATE_TAB_ILMJOB(V_TAB_ILMJOB);
---
>               NULL;
>             END;
>             
> 
> 
>             PRVT_ILM.UPDATE_TAB_ILMJOB(V_TAB_ILMJOB);
>           ELSE
>              
>             UPDATE SYS.ILM_EXECUTION$ ILMEXE
>                SET COMPLETION_TIME  = SYSTIMESTAMP,
>                    EXECUTION_STATE  = ILM_TASK_COMPLETE
>              WHERE ILMEXE.EXECUTION_ID = EXECUTE_ILM_POLICIES.EXECUTION_ID;
>           END IF;              
> 
6942a6962,6974
>     
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
6944,6967c6976,6991
<       SELECT B.EXECUTION_ID,
<              NVL(A.N_COUNT,0),
<              A.COMP_TIME
<         FROM 
<         ( SELECT A.EXECUTION_ID, 
<                  COUNT(*) N_COUNT,
<                  NVL(MAX(B.COMPLETION_TIME), SYSDATE)  COMP_TIME   
<             FROM SYS.ILM_EXECUTION$ A, 
<                  SYS.ILM_RESULTS$ B
<            WHERE EXECUTION_STATE = ILM_TASK_ACTIVE
<              AND A.EXECUTION_ID = B.EXECUTION_ID 
<              AND B.JOB_STATUS NOT IN (ILMJOB_SUCCESS, 
<                                    ILMJOB_FAILED,
<                                    ILMJOB_FAILED_REBUILD_DEP,
<                                    ILMJOB_STOPPED,
<                                    ILMJOB_CREATION_FAILED,
<                                    ILMJOB_STATE_OTHER)
<            GROUP BY A.EXECUTION_ID
<            )A,
<            ILM_EXECUTION$ B
<      WHERE B.EXECUTION_ID = A.EXECUTION_ID (+)
<        AND EXECUTION_STATE = ILM_TASK_ACTIVE
<        AND (ROWNUM <= N_TASKS 
<                 OR N_TASKS = ALL_UNRESOL_TASKS);
---
>       SELECT C.EXECUTION_ID,
>              (SELECT COUNT(*) N_COUNT FROM SYS.ILM_RESULTS$ A
>                WHERE A.EXECUTION_ID = C.EXECUTION_ID
>                  AND A.JOB_STATUS NOT IN (ILMJOB_SUCCESS,
>                                           ILMJOB_FAILED,
>                                           ILMJOB_FAILED_REBUILD_DEP,
>                                           ILMJOB_STOPPED,
>                                           ILMJOB_CREATION_FAILED,
>                                           ILMJOB_STATE_OTHER)) N_COUNT,
>              (SELECT NVL(MAX(B.COMPLETION_TIME), SYSDATE) COMP_TIME
>                 FROM SYS.ILM_RESULTS$ B
>                WHERE B.EXECUTION_ID = C.EXECUTION_ID) COMP_TIME
>         FROM SYS.ILM_EXECUTION$ C
>        WHERE C.EXECUTION_STATE = ILM_TASK_ACTIVE
>          AND (ROWNUM <= N_TASKS
>                   OR N_TASKS = ALL_UNRESOL_TASKS);
6994c7018,7019
<           WHERE V_TABTASKINFO(I).N_UNRESOL = 0;
---
>           WHERE V_TABTASKINFO(I).N_UNRESOL = 0
>             AND EXECUTION_ID = V_TABTASKINFO(I).TASK_ID;
SYS.SYS_PLSQL_1EE1A140_153_1 - TYPE (BP):
0a1,5
> type       SYS_PLSQL_1EE1A140_153_1 as object (DIMOWNER VARCHAR2(30 BYTE),
> DIMNAME VARCHAR2(30 BYTE),
> LVLNAME VARCHAR2(30 BYTE),
> ATREXPR VARCHAR2(100 BYTE));
> 
SYS.SYS_PLSQL_1EE1A140_184_1 - TYPE (BP):
0a1
> type       SYS_PLSQL_1EE1A140_184_1 as table of "SYS"."SYS_PLSQL_1EE1A140_153_1";
SYS.SYS_PLSQL_1EE1A140_DUMMY_1 - TYPE (BP):
0a1
> type       SYS_PLSQL_1EE1A140_DUMMY_1 as table of number;
SYS.DBA_ILMOBJECTS - VIEW (BP):
36,73d35
< minus
< select a.name, e.name, c.name, c.subname,
<        DECODE(c.type#,19, 'TABLE PARTITION',
<                       2,'TABLE',
<                       34,'TABLE SUBPARTITION'),
<        (CASE
<         WHEN bitand(a.FLAG,8) = 8
<              THEN 'TABLESPACE'
<         WHEN (b.obj_typ <> b.obj_typ_orig AND b.obj_typ_orig = 2)
<              THEN 'TABLE'
<         WHEN (b.obj_typ <> b.obj_typ_orig AND b.obj_typ_orig = 19)
<              THEN 'TABLE PARTITION'
<         ELSE 'POLICY NOT INHERITED'
<         END),
<        g.name,
<        (CASE
<         WHEN (bitand(b.FLAG,1)    = 1)
<              THEN 'NO'
<         ELSE 'YES'
<         END),
<        (CASE
<         WHEN (bitand(b.FLAG,64)    = 0)
<              THEN 'NO'
<         ELSE 'YES'
<         END)
<   from sys.ilm$ a,
<        sys.ilmobj$ b,
<        sys.obj$ c,
<        sys.user$ e,
<        sys.redef_object$ f,
<        sys.ts$ g
<  where a.policy#      = b.policy#
<    AND b.obj#         = c.obj#
<    AND c.owner#       = e.user#
<    AND f.obj_type     = 1
<    AND f.int_obj_owner= e.name
<    AND f.int_obj_name = c.name
<    AND g.ts# (+) = a.ts#
SYS.USER_ILMOBJECTS - VIEW (BP):
59,119d58
< minus
< select a.name, d.name, c.name, c.subname,
<        DECODE(c.type#,19, 'TABLE PARTITION',
<                       2,'TABLE',
<                       34,'TABLE SUBPARTITION'),
<        (CASE
<         WHEN bitand(a.FLAG,8) = 8
<              THEN 'TABLESPACE'
<         WHEN (b.obj_typ <> b.obj_typ_orig AND b.obj_typ_orig = 2)
<              THEN 'TABLE'
<         WHEN (b.obj_typ <> b.obj_typ_orig AND b.obj_typ_orig = 19)
<              THEN 'TABLE PARTITION'
<         ELSE 'POLICY NOT INHERITED'
<         END),
<        g.name,
<        (CASE
<         WHEN (bitand(b.FLAG,1)    = 1)
<              THEN 'NO'
<         ELSE 'YES'
<         END),
<        (CASE
<         WHEN (bitand(b.FLAG,64)    = 0)
<              THEN 'NO'
<         ELSE 'YES'
<         END)
<   from sys.ilm$ a,
<        sys.ilmobj$ b,
<        sys.obj$ c,
<        sys.user$ d,
<        (select a.policy#
<           from sys.ilm$ a
<          where bitand(a.flag, 8) = 0
<            and a.owner# = userenv('SCHEMAID')
<         union
<         select a.policy#
<           from sys.ilm$ a ,
<                sys.ts$  b,
<                sys.tsq$ c
<         where  bitand(a.flag, 8) = 8
<           and  a.ts#    = b.ts#
<           and  b.ts#    = c.ts#
<           and  c.user# = userenv('SCHEMAID')
<           and (c.blocks > 0 or c.maxblocks != 0)
<         union
<          select a.policy#
<           from sys.ilm$ a
<         where  bitand(a.flag, 8) = 8
<           and  exists
<          (select null
<             from sys.v$enabledprivs
<            where priv_number = -15 /* UNLIMITED TABLESPACE */)) e,
<          sys.redef_object$ f,
<        sys.ts$ g
<  where a.policy#  = b.policy#
<    AND b.obj#     = c.obj#
<    AND c.owner#   = d.user#
<    AND a.policy#  = e.policy#
<    AND f.obj_type = 1
<    AND f.int_obj_owner= d.name
<    AND f.int_obj_name = c.name
<    AND g.ts# (+) = a.ts#

12.2.0.1

SYS.DBMS_AQJMS_INTERNAL - PACKAGE BODY (RU):
1a2,3
>   MAXCHARSIZE         CONSTANT BINARY_INTEGER := 32767;
>   MAXRAWSIZE          CONSTANT BINARY_INTEGER := 2000;
1249d1250
<     DBMS_AQADM_SYS.WRITE_TRACE('header_field_val: located = ' || LOCATED);
1252d1252
<     DBMS_AQADM_SYS.WRITE_TRACE( 'header_field_val: mtyp = ' || MTYP);
1255d1254
<     DBMS_AQADM_SYS.WRITE_TRACE('header_field_val: located = ' || LOCATED);
1258d1256
<     DBMS_AQADM_SYS.WRITE_TRACE('header_field_val: strlen = ' || STRLEN);
1261d1258
<     DBMS_AQADM_SYS.WRITE_TRACE('header_field_val: located = ' || LOCATED);
1264d1260
<     DBMS_AQADM_SYS.WRITE_TRACE('header_field_val: located = ' || LOCATED);
1268d1263
<   DBMS_AQADM_SYS.WRITE_TRACE( 'header_field_val: ' || FIELD_NAME || ' = ' || LOCATED);
1271a1267,1326
> PROCEDURE ADT_ENCAPSULATE_SMALL(
>         JMS_HEADER           IN    VARCHAR2,
>         JMS_USERPROP         IN    VARCHAR2,
>         JMS_MSG_TYP          IN    NUMBER,
>         HEADER               OUT   AQ$_JMS_HEADER) IS
> MTYP                     NUMBER;
> NAME                     VARCHAR2(32767) ;
> VAL                      VARCHAR2(32767) ;
> STRLEN                   NUMBER;
> COUNTER                  NUMBER := 0 ;
> LOCATED                  VARCHAR2(32767) ;
> AGENT                    SYS.AQ$_AGENT ;
> PROP                     SYS.AQ$_JMS_USERPROPERTY ;
> PROP_LIST                AQ$_JMS_USERPROPARRAY := SYS.AQ$_JMS_USERPROPARRAY() ;
> BEGIN
>   AGENT := SYS.AQ$_AGENT(HEADER_FIELD_VAL(JMS_HEADER, 'JMSReplyTo'), NULL, 0);
>   
>   IF ((JMS_MSG_TYP != 100) AND (JMS_USERPROP IS NOT NULL)) THEN
>     
>     
>     
>     COUNTER  := TO_NUMBER(SUBSTR(JMS_USERPROP,1,INSTR(JMS_USERPROP,',')-1));
>     
>     LOCATED  := SUBSTR(JMS_USERPROP,INSTR(JMS_USERPROP,',')+1);
> 
>     PROP_LIST.EXTEND(COUNTER);
> 
>     FOR I IN 1..COUNTER LOOP
>       
>       STRLEN := TO_NUMBER(SUBSTR(LOCATED,1,INSTR(LOCATED,',')-1));
>       
>       LOCATED  := SUBSTR(LOCATED,INSTR(LOCATED,',')+1);
>       
>       NAME := SUBSTR(LOCATED, 1, STRLEN);
>       
>       LOCATED  := SUBSTR(LOCATED, STRLEN+2);
>       
>       MTYP := TO_NUMBER(SUBSTR(LOCATED, 1, INSTR(LOCATED,',')-1));
>       
>       LOCATED  := SUBSTR(LOCATED, INSTR(LOCATED,',')+1);
>       
>       STRLEN := TO_NUMBER(SUBSTR(LOCATED,1,INSTR(LOCATED,',')-1));
>       
>       LOCATED  := SUBSTR(LOCATED,INSTR(LOCATED,',')+1);
>       
>       VAL := SUBSTR(LOCATED, 1, STRLEN);
>       
>       LOCATED  := SUBSTR(LOCATED,STRLEN+2);
>       IF (MTYP = 20 OR MTYP = 27 OR MTYP = 28) THEN
>         PROP := SYS.AQ$_JMS_USERPROPERTY(NAME, 2, VAL, NULL, MTYP);
>       ELSE
>         PROP := SYS.AQ$_JMS_USERPROPERTY(NAME, 1, NULL, TO_NUMBER(VAL), MTYP);
>       END IF;
>       PROP_LIST(I) := PROP ;
>     END LOOP ;
>     HEADER := SYS.AQ$_JMS_HEADER(AGENT, HEADER_FIELD_VAL(JMS_HEADER, 'JMSType'), NULL, NULL, NULL, NULL, PROP_LIST);
>   ELSE
>     HEADER := SYS.AQ$_JMS_HEADER(AGENT, HEADER_FIELD_VAL(JMS_HEADER, 'JMSType'), NULL, NULL, NULL, NULL, NULL);
>   END IF;
> END ;
1288,1289d1342
<   DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: jms_header ' || JMS_HEADER);
<   DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: jms_msg_typ ' || JMS_MSG_TYP);
1296,1297c1349
< 
<     DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: jms_userprop len ' || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>     
1301,1302d1352
<     DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: located len ' ||  DBMS_LOB.GETLENGTH(LOCATED));
<     DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: counter = ' || COUNTER);
1309d1358
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: Name strlen = ' || STRLEN);
1312d1360
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: located len ' || DBMS_LOB.GETLENGTH(LOCATED));
1315d1362
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: Name = ' || NAME);
1318d1364
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: located len ' || DBMS_LOB.GETLENGTH(LOCATED));
1321d1366
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: mtyp =  ' || MTYP);
1326d1370
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: Value strlen = ' || STRLEN);
1329d1372
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: located len ' || DBMS_LOB.GETLENGTH(LOCATED));
1332d1374
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: Value = ' || VAL);
1335d1376
<       DBMS_AQADM_SYS.WRITE_TRACE('adt_encapsulate: located len ' || DBMS_LOB.GETLENGTH(LOCATED));
1358,1361c1399,1403
<   DBMS_AQADM_SYS.WRITE_TRACE('create_bytes_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_bytes_message: jms_userprop len '
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, DBMS_LOB.SUBSTR(JMS_USERPROP), 
>                           DBMS_AQJMS.JMS_BYTES_MESSAGE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_BYTES_MESSAGE, HEADER) ;
1362a1405
> 
1368,1369d1410
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_BYTES_MESSAGE, HEADER) ;
< 
1371c1412
<     IF (PLODLEN <= 2000) THEN
---
>     IF (PLODLEN <= MAXRAWSIZE) THEN
1378a1420
> 
1379a1422
> 
1390,1393c1433,1436
<   DBMS_AQADM_SYS.WRITE_TRACE('create_text_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_text_message: jms_userprop len ' 
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_TEXT_MESSAGE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_TEXT_MESSAGE, HEADER) ;
1394a1438
> 
1400,1401d1443
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_TEXT_MESSAGE, HEADER) ;
< 
1403c1445
<     IF (PLODLEN <= 2000) THEN
---
>     IF (PLODLEN <= MAXRAWSIZE) THEN
1414d1455
<   DBMS_AQADM_SYS.WRITE_TRACE('create_text_message: payload.TEXT_LEN = ' || PAYLOAD.TEXT_LEN);
1425,1428c1466,1469
<   DBMS_AQADM_SYS.WRITE_TRACE('create_stream_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_stream_message: jms_userprop len ' 
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_STREAM_MESSAGE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_STREAM_MESSAGE, HEADER) ;
1429a1471
> 
1433,1435c1475
<   END IF ;
< 
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_STREAM_MESSAGE, HEADER) ;
---
>   END IF;
1438c1478
<     IF (PLODLEN <= 2000) THEN
---
>     IF (PLODLEN <= MAXRAWSIZE) THEN
1446d1485
<   DBMS_AQADM_SYS.WRITE_TRACE('create_stream_message: payload.BYTES_LEN = ' || PAYLOAD.BYTES_LEN);
1457,1460c1496,1499
<   DBMS_AQADM_SYS.WRITE_TRACE('create_map_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_map_message: jms_userprop len '
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_MAP_MESSAGE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_MAP_MESSAGE, HEADER) ;
1461a1501
> 
1465,1467c1505
<   END IF ;
< 
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_MAP_MESSAGE, HEADER) ;
---
>   END IF;
1470c1508
<     IF (PLODLEN <= 2000) THEN
---
>     IF (PLODLEN <= MAXRAWSIZE) THEN
1478d1515
<   DBMS_AQADM_SYS.WRITE_TRACE( 'create_map_message: payload.BYTES_LEN = ' || PAYLOAD.BYTES_LEN);
1489,1492c1526,1529
<   DBMS_AQADM_SYS.WRITE_TRACE('create_object_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_object_message: jms_userprop len ' 
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_OBJECT_MESSAGE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_OBJECT_MESSAGE, HEADER) ;
1493a1531
> 
1497,1499c1535
<   END IF ;
< 
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, DBMS_AQJMS.JMS_MAP_MESSAGE, HEADER) ;
---
>   END IF;
1502c1538
<     IF (PLODLEN <= 2000) THEN
---
>     IF (PLODLEN <= MAXRAWSIZE) THEN
1510d1545
<   DBMS_AQADM_SYS.WRITE_TRACE( 'create_object_message: payload.BYTES_LEN = ' || PAYLOAD.BYTES_LEN);
1515,1518c1550,1553
<         BYTE_PLOD           IN BLOB,
<         JMS_HEADER          IN VARCHAR2,
<         JMS_USERPROP        IN CLOB,
<         JMS_MSG_TYPE        IN NUMBER) IS
---
>         BYTE_PLOD           IN  BLOB,
>         JMS_HEADER          IN  VARCHAR2,
>         JMS_USERPROP        IN  CLOB,
>         JMS_MSG_TYPE        IN  NUMBER) IS
1522,1525c1557,1561
<   DBMS_AQADM_SYS.WRITE_TRACE('create_jms_message: jms_header ' || JMS_HEADER) ;
<   IF (JMS_USERPROP IS NOT NULL) THEN
<     DBMS_AQADM_SYS.WRITE_TRACE('create_jms_message: jms_userprop len ' 
<                                || DBMS_LOB.GETLENGTH(JMS_USERPROP));
---
>   PLODLEN := DBMS_LOB.GETLENGTH(BYTE_PLOD) ;
>   IF (DBMS_LOB.GETLENGTH(JMS_USERPROP) < MAXCHARSIZE) THEN
>     ADT_ENCAPSULATE_SMALL(JMS_HEADER, JMS_USERPROP, JMS_MSG_TYPE, HEADER) ;
>   ELSE
>     ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, JMS_MSG_TYPE, HEADER) ;
1526a1563
> 
1529,1532c1566,1567
<     DBMS_AQADM_SYS.WRITE_TRACE('create_jms_message: byte_plod len ' || PLODLEN);
<   END IF ;
< 
<   ADT_ENCAPSULATE(JMS_HEADER, JMS_USERPROP, JMS_MSG_TYPE, HEADER) ;
---
>     DBMS_AQADM_SYS.WRITE_TRACE('create_generic_message: byte_plod len ' || PLODLEN);
>   END IF;
1535,1538c1570,1579
<     IF (PLODLEN <= 2000) THEN
<       PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, PLODLEN, 0,
<                                      UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BYTE_PLOD)),
<                                      NULL, NULL, NULL);
---
>     IF (PLODLEN > 0) THEN
>       IF (PLODLEN <= MAXRAWSIZE) THEN
>         PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, PLODLEN, 0,
>                                        UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BYTE_PLOD)),
>                                        NULL, NULL, NULL);
>       ELSE
>         PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, PLODLEN, 0, NULL, NULL,
>                                        TO_CLOB(UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BYTE_PLOD))),
>                                        NULL);
>       END IF;
1540,1542c1581
<       PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, PLODLEN, 0, NULL, NULL,
<                                      TO_CLOB(UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BYTE_PLOD))),
<                                      NULL);
---
>       PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, 0, NULL, NULL, NULL, NULL);
1544d1582
<     DBMS_AQADM_SYS.WRITE_TRACE( 'payload.TEXT_LEN = ' || PAYLOAD.TEXT_LEN);
1546,1551c1584,1593
<     IF (PLODLEN <= 2000) THEN
<       PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, PLODLEN, NULL,
<                                      DBMS_LOB.SUBSTR(BYTE_PLOD), NULL, NULL);
<     ELSE
<       PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, PLODLEN,
<                                      NULL, NULL, NULL, BYTE_PLOD);
---
>     IF (PLODLEN > 0) THEN
>       IF (PLODLEN <= MAXRAWSIZE) THEN
>         PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, PLODLEN, NULL,
>                                        DBMS_LOB.SUBSTR(BYTE_PLOD), NULL, NULL);
>       ELSE
>         PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, PLODLEN,
>                                        NULL, NULL, NULL, BYTE_PLOD);
>       END IF;
>       ELSE
>         PAYLOAD := SYS.AQ$_JMS_MESSAGE(HEADER, 'sender_id', JMS_MSG_TYPE, 0, 0, NULL, NULL, NULL, NULL);
1553d1594
<     DBMS_AQADM_SYS.WRITE_TRACE( 'payload.BYTES_LEN = ' || PAYLOAD.BYTES_LEN);
1582,1584d1622
<   DBMS_AQADM_SYS.WRITE_TRACE( 'bytes_raw ' || BYTES_RAW);
<   DBMS_AQADM_SYS.WRITE_TRACE( 'bytes_lob length ' || DBMS_LOB.GETLENGTH(BYTES_LOB));
< 
1587d1624
<   DBMS_AQADM_SYS.WRITE_TRACE( 'REPLYTO.NAME converted');
1615d1651
<       DBMS_AQADM_SYS.WRITE_TRACE( 'prop_list(i).name converted');
1626d1661
<       DBMS_AQADM_SYS.WRITE_TRACE( 'prop_list(i).str_value converted');
1633d1667
<          DBMS_AQADM_SYS.WRITE_TRACE( 'prop_list(i).num_value converted');
1645,1646d1678
<     DBMS_AQADM_SYS.WRITE_TRACE( 'userprp_formatted length ' 
<                                || DBMS_LOB.GETLENGTH(USERPRP_FORMATTED));
1655d1686
<     DBMS_AQADM_SYS.WRITE_TRACE( 'byte_plod length' || DBMS_LOB.GETLENGTH(BYTE_PLOD));
1664d1694
<     DBMS_AQADM_SYS.WRITE_TRACE( 'text_plod length' || DBMS_LOB.GETLENGTH(BYTE_PLOD));
1666,1667d1695
< 
<   DBMS_AQADM_SYS.WRITE_TRACE( 'header_formatted ' || HEADER_FORMATTED) ;
SYS.DBMS_HEAT_MAP_INTERNAL - PACKAGE BODY (RU):
996c996,997
<   
---
>     HEATMAP VARCHAR2(3);
> 
997a999,1004
>     
>     SELECT VALUE INTO HEATMAP FROM V$PARAMETER WHERE NAME='heat_map';
>     IF (HEATMAP = 'OFF') THEN
>       RETURN;
>     END IF;
> 
SYS.LOGMNR_DICT_CACHE - PACKAGE BODY (RU):
573a574
> 
579a581,583
> 
> DUPLICATE_FOUND BOOLEAN := FALSE;
> 
581,584c585,612
<    INSERT INTO SYSTEM.LOGMNRC_CONCOL_GG (
<               LOGMNR_UID, CON#, INTCOL#, POS#, SPARE1, COMMIT_SCN) VALUES (
<               LM_LOGMNR_UID, LM_CON#, LM_INTCOL#, LM_POS#, LM_COLFLAGS,
<               LM_COMMIT_SCN);
---
>   BEGIN
>     INSERT INTO SYSTEM.LOGMNRC_CONCOL_GG (
>                LOGMNR_UID, CON#, INTCOL#, POS#, SPARE1, COMMIT_SCN) VALUES (
>                LM_LOGMNR_UID, LM_CON#, LM_INTCOL#, LM_POS#, LM_COLFLAGS,
>                LM_COMMIT_SCN);
>   EXCEPTION
>     WHEN DUP_VAL_ON_INDEX THEN
>       DUPLICATE_FOUND := TRUE;
>   END;
> 
>   
> 
> 
> 
> 
> 
> 
>   IF (DUPLICATE_FOUND = TRUE) THEN
>     UPDATE SYSTEM.LOGMNRC_CONCOL_GG
>       SET  POS#           = LM_POS#,
>            SPARE1         = LM_COLFLAGS,
>            SPARE2         = NULL,
>            SPARE3         = NULL
>      WHERE LOGMNR_UID     = LM_LOGMNR_UID
>      AND   CON#           = LM_CON#
>      AND   INTCOL#        = LM_INTCOL#
>      AND   COMMIT_SCN     = LM_COMMIT_SCN;
>   END IF;
603a632,636
> 
> 
> 
> 
> 
654c687
<     ORDER BY NAME, POSITION;
---
>     ORDER BY CON#, POSITION;
656,658c689,691
<     CURRENT_CON_NAME    VARCHAR2(384);
<     LM_FLAGS NUMBER;
<     LM_CON# NUMBER;
---
>     CURRENT_CON_CON#     NUMBER;
>     LM_FLAGS             NUMBER;
>     LM_CON#              NUMBER;
660,662c693,695
<     LM_CON_NAME         VARCHAR2(384);
<     LM_COMMIT_SCN NUMBER;
<     TRACE_LEVEL NUMBER;
---
>     LM_CON_CON#          NUMBER;
>     LM_COMMIT_SCN        NUMBER;
>     TRACE_LEVEL          NUMBER;
669c702
<     CURRENT_CON_NAME := NULL;
---
>     CURRENT_CON_CON# := NULL;
680c713
<       LM_CON_NAME := SEL_REC.NAME;
---
>       LM_CON_CON# := SEL_REC.CON#;
685,686c718,719
<       IF (CURRENT_CON_NAME <> LM_CON_NAME) OR 
<         (CURRENT_CON_NAME IS NULL) THEN
---
>       IF (CURRENT_CON_CON# <> LM_CON_CON#) OR 
>         (CURRENT_CON_CON# IS NULL) THEN
700c733
<         CURRENT_CON_NAME := LM_CON_NAME;
---
>         CURRENT_CON_CON# := LM_CON_CON#;
702c735,736
<                        ':con_name='||CURRENT_CON_NAME||
---
>                        ':con_name='||SEL_REC.NAME|| 
>                        ':con_con#='||CURRENT_CON_CON#||
1305a1340
> 
1311a1347,1349
> 
> DUPLICATE_FOUND BOOLEAN := FALSE;
> 
1313,1317c1351,1366
<    INSERT INTO SYSTEM.LOGMNRC_INDCOL_GG (
<               LOGMNR_UID, OBJ#, INTCOL#, POS#, SPARE1, COMMIT_SCN
<               ) VALUES (
<               LM_LOGMNR_UID, LM_INDEX_OBJ#, LM_INTCOL#, 
<               LM_POS#, LM_COLFLAGS, LM_COMMIT_SCN);
---
>   BEGIN
>     INSERT INTO SYSTEM.LOGMNRC_INDCOL_GG (
>                LOGMNR_UID, OBJ#, INTCOL#, POS#, SPARE1, COMMIT_SCN
>                ) VALUES (
>                LM_LOGMNR_UID, LM_INDEX_OBJ#, LM_INTCOL#, 
>                LM_POS#, LM_COLFLAGS, LM_COMMIT_SCN);
>   EXCEPTION
>     WHEN DUP_VAL_ON_INDEX THEN
>       DUPLICATE_FOUND := TRUE;
>   END;
> 
>   
> 
> 
> 
> 
1318a1368,1383
> 
> 
> 
> 
>   IF (DUPLICATE_FOUND = TRUE) THEN
>     UPDATE SYSTEM.LOGMNRC_INDCOL_GG
>       SET  POS#           = LM_POS#,
>            SPARE1         = LM_COLFLAGS,
>            SPARE2         = NULL,
>            SPARE3         = NULL
>      WHERE LOGMNR_UID     = LM_LOGMNR_UID
>      AND   OBJ#           = LM_INDEX_OBJ#
>      AND   INTCOL#        = LM_INTCOL#
>      AND   COMMIT_SCN     = LM_COMMIT_SCN;
>   END IF;
>   
1335a1401,1409
> 
> 
> 
> 
> 
> 
> 
> 
> 
1391c1465
<     ORDER BY NAME, POSITION;
---
>     ORDER BY INDEX_OBJ#, POSITION;
1393,1394c1467,1468
<     CURRENT_IND_NAME    VARCHAR2(384);
<     LM_FLAGS NUMBER;
---
>     CURRENT_IND_OBJ#     NUMBER;
>     LM_FLAGS             NUMBER;
1396,1398c1470,1472
<     LM_IND_NAME         VARCHAR2(384);
<     LM_COMMIT_SCN NUMBER;
<     TRACE_LEVEL NUMBER;
---
>     LM_IND_OBJ#          NUMBER;
>     LM_COMMIT_SCN        NUMBER;
>     TRACE_LEVEL          NUMBER;
1403c1477
<     CURRENT_IND_NAME := NULL;
---
>     CURRENT_IND_OBJ# := NULL;
1414c1488
<       LM_IND_NAME := SEL_REC.NAME;
---
>       LM_IND_OBJ# := SEL_REC.INDEX_OBJ#;
1417,1418c1491,1492
<                      'save_indexes:old='||CURRENT_IND_NAME||':new='||
<                      LM_IND_NAME);
---
>                      'save_indexes:old obj#='||CURRENT_IND_OBJ#
>                      ||':new obj#='||LM_IND_OBJ#);
1423,1424c1497,1498
<       IF (CURRENT_IND_NAME <> LM_IND_NAME) OR 
<         (CURRENT_IND_NAME IS NULL) THEN
---
>       IF (CURRENT_IND_OBJ# <> LM_IND_OBJ#) OR 
>         (CURRENT_IND_OBJ# IS NULL) THEN
1426c1500
<                     SEL_REC.INDEX_OBJ#, 
---
>                     LM_IND_OBJ#, 
1428c1502
<                     LM_IND_NAME,
---
>                     SEL_REC.NAME,
1438c1512
<         CURRENT_IND_NAME := LM_IND_NAME;
---
>         CURRENT_IND_OBJ# := LM_IND_OBJ#;
1441c1515,1516
<                        ':con_name='||CURRENT_IND_NAME||
---
>                        ':ind_name='||SEL_REC.NAME||
>                        ':ind_obj#='||CURRENT_IND_OBJ#||
SYS.DBMS_FEATURE_JSON - PROCEDURE (RU):
41,48c41,48
<   expr   expr_cur%ROWTYPE;
<   c         clob;
<   TYPE      CurTyp IS REF CURSOR;
<   cur       CurTyp;
<   idxname1   dbms_id;
<   uname1     dbms_id;
<   idxname2   dbms_quoted_id;
<   uname2     dbms_quoted_id;
---
>   expr                  expr_cur%ROWTYPE;
>   c                     clob;
>   TYPE CurTyp           IS REF CURSOR;
>   cur                   CurTyp;
>   idxname1              dbms_id;
>   uname1                dbms_id;
>   idxname2              dbms_quoted_id;
>   uname2                dbms_quoted_id;
99,130c99,106
<   execute immediate 'select max(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_max_rows;
< 
<   execute immediate 'select min(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_min_rows;
< 
<   execute immediate 'select avg(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_avg_rows;
< 
<   if num_max_rows is null then
<     num_max_rows := 0;
<   end if;
< 
<   if num_min_rows is null then
<     num_min_rows := 0;
<   end if;
< 
<   if num_avg_rows is null then
<     num_avg_rows := 0;
<   end if;
---
>   execute immediate 'select nvl(max(d.rowcnt),0), nvl(min(d.rowcnt), 0),
>                      nvl(avg(d.rowcnt),0) from tab$ d,
>                      int$dba_json_columns j where
>                      d.obj# = j.object_id and
>                      j.owner not in
>                      (select distinct username from all_users
>                       where oracle_maintained = ''Y'')'
>   into num_max_rows, num_min_rows, num_avg_rows;
139,150c115,118
<   /* Average length in bytes */
<   execute immediate 'select nvl(avg(avg_col_len),0) from dba_tab_columns t,
<                      dba_json_columns j where t.owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y'')
<                      and t.table_name = j.table_name
<                      and t.column_name = j.column_name'
<   into avgsize_jsoncol;
< 
<   /* Max length in chars */
<   execute immediate 'select nvl(max(char_length),0) from dba_tab_columns t,
<                      dba_json_columns j where t.owner not in
---
>   /* Average length in bytes and max length in chars */
>   execute immediate 'select nvl(avg(avg_col_len),0), nvl(max(char_length),0)
>                      from dba_tab_columns t, dba_json_columns j
>                      where t.owner not in
155c123
<   into maxsize_jsoncol;
---
>   into avgsize_jsoncol, maxsize_jsoncol;

18.0.0.0

SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.9RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.09.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.09.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.09.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.09.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.09.00.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('18.09.01.00', '.');
>   msn  CONSTANT NUMBER := instr('18.09.01.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('18.09.01.00', '.', msn + 1);
29c29
<                            to_number(substr('18.09.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.09.01.00', 1, fsn - 1));
31c31
<                to_number(substr('18.09.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.09.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.09.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.09.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.09.00.00',  psn + 1));
---
>                              to_number(substr('18.09.01.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.8RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.08.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.08.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.08.01.00', '.');
<   msn  CONSTANT NUMBER := instr('18.08.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.08.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('18.08.02.00', '.');
>   msn  CONSTANT NUMBER := instr('18.08.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('18.08.02.00', '.', msn + 1);
29c29
<                            to_number(substr('18.08.01.00', 1, fsn - 1));
---
>                            to_number(substr('18.08.02.00', 1, fsn - 1));
31c31
<                to_number(substr('18.08.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.08.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.08.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.08.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.08.01.00',  psn + 1));
---
>                              to_number(substr('18.08.02.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.09.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.10.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.09.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.09.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.09.00.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('18.10.00.00', '.');
>   msn  CONSTANT NUMBER := instr('18.10.00.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('18.10.00.00', '.', msn + 1);
29c29
<                            to_number(substr('18.09.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.10.00.00', 1, fsn - 1));
31c31
<                to_number(substr('18.09.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.10.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.09.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.10.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.09.00.00',  psn + 1));
---
>                              to_number(substr('18.10.00.00',  psn + 1));
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '18.9.0.0.0';
---
>                                '18.10.0.0.0';
SYS.DBMS_REGISTRY - PACKAGE (18.8RUR):
13c13
<                                '18.8.1.0.0';
---
>                                '18.8.2.0.0';
SYS.DBMS_REGISTRY - PACKAGE (18.9RUR):
13c13
<                                '18.9.0.0.0';
---
>                                '18.9.1.0.0';
SYS.DBMS_RCVMAN - PACKAGE BODY (18.8RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.02.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (18.9RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.09.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.09.01.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.09.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.10.00.00'; 
SYS.DBMS_FEATURE_JSON - PROCEDURE (RU):
41,48c41,48
<   expr   expr_cur%ROWTYPE;
<   c         clob;
<   TYPE      CurTyp IS REF CURSOR;
<   cur       CurTyp;
<   idxname1   dbms_id;
<   uname1     dbms_id;
<   idxname2   dbms_quoted_id;
<   uname2     dbms_quoted_id;
---
>   expr                  expr_cur%ROWTYPE;
>   c                     clob;
>   TYPE CurTyp           IS REF CURSOR;
>   cur                   CurTyp;
>   idxname1              dbms_id;
>   uname1                dbms_id;
>   idxname2              dbms_quoted_id;
>   uname2                dbms_quoted_id;
99,130c99,106
<   execute immediate 'select max(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_max_rows;
< 
<   execute immediate 'select min(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_min_rows;
< 
<   execute immediate 'select avg(num_rows) from dba_tables where
<                      table_name in (select table_name
<                      from dba_json_columns where owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y''))'
<   into num_avg_rows;
< 
<   if num_max_rows is null then
<     num_max_rows := 0;
<   end if;
< 
<   if num_min_rows is null then
<     num_min_rows := 0;
<   end if;
< 
<   if num_avg_rows is null then
<     num_avg_rows := 0;
<   end if;
---
>   execute immediate 'select nvl(max(d.rowcnt),0), nvl(min(d.rowcnt), 0),
>                      nvl(avg(d.rowcnt),0) from tab$ d,
>                      int$dba_json_columns j where
>                      d.obj# = j.object_id and
>                      j.owner not in
>                      (select distinct username from all_users
>                       where oracle_maintained = ''Y'')'
>   into num_max_rows, num_min_rows, num_avg_rows;
139,150c115,118
<   /* Average length in bytes */
<   execute immediate 'select nvl(avg(avg_col_len),0) from dba_tab_columns t,
<                      dba_json_columns j where t.owner not in
<                      (select distinct username from all_users
<                       where oracle_maintained = ''Y'')
<                      and t.table_name = j.table_name
<                      and t.column_name = j.column_name'
<   into avgsize_jsoncol;
< 
<   /* Max length in chars */
<   execute immediate 'select nvl(max(char_length),0) from dba_tab_columns t,
<                      dba_json_columns j where t.owner not in
---
>   /* Average length in bytes and max length in chars */
>   execute immediate 'select nvl(avg(avg_col_len),0), nvl(max(char_length),0)
>                      from dba_tab_columns t, dba_json_columns j
>                      where t.owner not in
155c123
<   into maxsize_jsoncol;
---
>   into avgsize_jsoncol, maxsize_jsoncol;
SYS.CDB_WORKLOAD_CAPTURES - VIEW (RU):
1c1
< SELECT k."ID",k."NAME",k."DBID",k."DBNAME",k."DBVERSION",k."PARALLEL",k."DIRECTORY",k."STATUS",k."START_TIME",k."END_TIME",k."DURATION_SECS",k."START_SCN",k."END_SCN",k."DEFAULT_ACTION",k."FILTERS_USED",k."CAPTURE_SIZE",k."DBTIME",k."DBTIME_TOTAL",k."USER_CALLS",k."USER_CALLS_TOTAL",k."USER_CALLS_UNREPLAYABLE",k."PLSQL_SUBCALL_SIZE",k."PLSQL_CALLS",k."PLSQL_SUBCALLS",k."PLSQL_DBTIME",k."TRANSACTIONS",k."TRANSACTIONS_TOTAL",k."CONNECTS",k."CONNECTS_TOTAL",k."ERRORS",k."AWR_DBID",k."AWR_BEGIN_SNAP",k."AWR_END_SNAP",k."AWR_EXPORTED",k."ERROR_CODE",k."ERROR_MESSAGE",k."DIR_PATH",k."DIR_PATH_SHARED",k."LAST_PROCESSED_VERSION",k."SQLSET_OWNER",k."SQLSET_NAME",k."PLSQL_MODE",k."ENCRYPTION",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_CAPTURES") k
---
> SELECT k."ID",k."NAME",k."DBID",k."DBNAME",k."DBVERSION",k."PARALLEL",k."DIRECTORY",k."STATUS",k."START_TIME",k."END_TIME",k."DURATION_SECS",k."START_SCN",k."END_SCN",k."DEFAULT_ACTION",k."FILTERS_USED",k."CAPTURE_SIZE",k."DBTIME",k."DBTIME_TOTAL",k."USER_CALLS",k."USER_CALLS_TOTAL",k."USER_CALLS_UNREPLAYABLE",k."PLSQL_SUBCALL_SIZE",k."PLSQL_CALLS",k."PLSQL_SUBCALLS",k."PLSQL_DBTIME",k."TRANSACTIONS",k."TRANSACTIONS_TOTAL",k."CONNECTS",k."CONNECTS_TOTAL",k."ERRORS",k."AWR_DBID",k."AWR_BEGIN_SNAP",k."AWR_END_SNAP",k."AWR_EXPORTED",k."ERROR_CODE",k."ERROR_MESSAGE",k."DIR_PATH",k."DIR_PATH_SHARED",k."LAST_PROCESSED_VERSION",k."SQLSET_OWNER",k."SQLSET_NAME",k."PLSQL_MODE",k."ENCRYPTION",k."ENCRYPTION_VERIFIER",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_CAPTURES") k
SYS.CDB_WORKLOAD_REPLAY_FILTER_SET - VIEW (RU):
1c1
< SELECT k."CAPTURE_ID",k."SET_NAME",k."FILTER_NAME",k."ATTRIBUTE",k."VALUE",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_REPLAY_FILTER_SET") k
---
> SELECT k."CAPTURE_ID",k."SET_NAME",k."FILTER_NAME",k."ATTRIBUTE",k."VALUE",k."DEFAULT_ACTION",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_REPLAY_FILTER_SET") k
SYS.DBA_WORKLOAD_CAPTURES - VIEW (RU):
30c30,31
<  , decode(nvl(r.plsql_mode, 0), 0, 'TOP_LEVEL', 1, 'EXTENDED', 2, 'EXTENDED_SYS', 'INVALID')
---
>  , decode( nvl(r.plsql_mode, 0), 0,'TOP_LEVEL', 1,'EXTENDED', 2,'EXTENDED_SYS',
>                                  'INVALID' )
31a33
>  , r.encryption_verifier
SYS.DBA_WORKLOAD_REPLAY_FILTER_SET - VIEW (RU):
1,2c1,7
< select capture_id, set_name, filter_name, attribute, value
<  from WRR$_REPLAY_FILTER_SET
---
> select capture_id, set_name, filter_name, attribute, value, default_action
> from wrr$_replay_filter_set rfs
> UNION ALL
> select NULL, NULL, name, attribute, value, NULL
> from wrr$_filters
> where wrr_id = 0
> and   filter_type = 'REPLAY'

19.0.0.0

AUDSYS.DBMS_AUDIT_MGMT - PACKAGE BODY (RU):
970a971,972
>     M_CURTIMESTAMP      TIMESTAMP := SYSTIMESTAMP;
> 
975a978,990
>       RAISE_ORA_ERROR(46250, 'LAST_ARCHIVE_TIME');
>     END IF;
> 
>     IF AUDIT_TRAIL_TYPE = AUDIT_TRAIL_AUD_STD OR
>        AUDIT_TRAIL_TYPE = AUDIT_TRAIL_FGA_STD OR
>        AUDIT_TRAIL_TYPE = AUDIT_TRAIL_UNIFIED
>     THEN
>       M_CURTIMESTAMP := SYS_EXTRACT_UTC(SYSTIMESTAMP);
>     END IF;
> 
>     IF LAST_ARCHIVE_TIME > M_CURTIMESTAMP THEN
>       WRITE_TRACE_MESSAGE(TRACE_LEVEL_DEBUG, 'last_archive_time with future
>                           timestamp value is not allowed');
CTXSYS.DRIXMD - PACKAGE (RU):
11d10
<   NO_R_MIN_COMP           constant varchar2(30) := '12.2.0.2';
19a19,27
> 
> -- FEATUREs protected by compatible check
> FEATURE_NO_R           constant number := 1;                           -- no $R
> 
> /*------------------------------ ChkCompatible ------------------------------*/
> 
> function ChkCompatible(
>   feature_id  number)
> return boolean;
CTXSYS.DRIPARSE - PACKAGE BODY (RU):
1478,1483c1478,1479
<   
<   
<   
<   IF OPTS.NO_R AND NOT DRVUTL.CHKCOMPATIBLE(DRIXMD.NO_R_MIN_COMP) THEN
<     DRUE.PUSH(DRIG.GU_NOT_GENERALLY_AVAIL);
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>   IF OPTS.NO_R AND NOT DRIXMD.CHKCOMPATIBLE(DRIXMD.FEATURE_NO_R) THEN
>     OPTS.NO_R := FALSE;
2501,2506c2497,2498
<   
<   
<   
<   IF OPTS.NO_R AND NOT DRVUTL.CHKCOMPATIBLE(DRIXMD.NO_R_MIN_COMP) THEN
<     DRUE.PUSH(DRIG.GU_NOT_GENERALLY_AVAIL);
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>   IF OPTS.NO_R AND NOT DRIXMD.CHKCOMPATIBLE(DRIXMD.FEATURE_NO_R) THEN
>     OPTS.NO_R := FALSE;
CTXSYS.DRIREPM - PACKAGE BODY (RU):
972a973,975
>   IF (IDX.IDX_OPTION LIKE '%R%') THEN
>     DESCLN(0,'index option', 'no $R');
>   END IF;
1369a1373,1379
>     
>     IF (INSTR(IDX.IDX_OPTION, 'R') != 0) THEN
>       DRVIMR.WL('    fast_dml');
>     ELSE
>       DRVIMR.WL('    fast_query');
>     END IF;
> 
CTXSYS.DRIXMD - PACKAGE BODY (RU):
55a56,63
> NO_R_MIN_COMP           CONSTANT VARCHAR2(30) := '12.2.0.2';
> NO_R_COMP_EVENT         CONSTANT NUMBER := 30580;
> NO_R_COMP_LEVEL         CONSTANT NUMBER := 131072;
> 
> 
> TYPE VER_ITAB_TYPE IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
> 
> 
60a69,170
> FUNCTION CHKEVENT(
>   EVENT        NUMBER,
>   EVENT_LEVEL  NUMBER)
> RETURN BOOLEAN
> IS
>   LEV          NUMBER;
>   STATUS       BOOLEAN;
> BEGIN
>   LEV := DRIDISP.EXECTRUST_RET1(NULL, NULL, NULL, DRILIST.CMD_ADMIN_ORAEVENT,
>                                 DRILIST.MS_ORAEVENT_GET, EVENT, 0);
> 
>   IF BITAND(LEV, EVENT_LEVEL) = EVENT_LEVEL THEN
>     STATUS := TRUE;
>   ELSE
>     STATUS := FALSE;
>   END IF;
> 
>   RETURN STATUS;
> END CHKEVENT;
> 
> 
> 
> FUNCTION GETCOMPATIBLE 
> RETURN VARCHAR2 
> IS
> BEGIN
>   RETURN DRIDISP.EXECTRUST_RET1(NULL, NULL, NULL, DRILIST.CMD_GET_COMPATIBLE);
> END GETCOMPATIBLE;
> 
> 
> 
> PROCEDURE PARSEVERSION(
>   VERSION_STR  IN VARCHAR2,
>   VERSION_TAB  OUT VER_ITAB_TYPE)
> IS
>   VAL  VARCHAR2(30) := VERSION_STR;
>   SUB  VARCHAR2(30);
>   POS  PLS_INTEGER;
> BEGIN
>   FOR I IN 1..5 LOOP
>     POS := INSTR(VAL, '.');
>     IF POS = 0 THEN
>       POS := LENGTH(VAL) + 1;
>     END IF;
>     SUB := SUBSTR(VAL, 1, POS - 1);
>     VAL := SUBSTR(VAL, POS + 1);
> 
>     VERSION_TAB(I) := NVL(TO_NUMBER(SUB), 0); 
>   END LOOP;
> END PARSEVERSION;
> 
> 
> 
> FUNCTION CHKVERSION(
>   MIN_VERSION_STR  VARCHAR2)
> RETURN BOOLEAN
> IS
>   RES          BOOLEAN;
>   MIN_VERSION  VER_ITAB_TYPE;
>   SYS_VERSION  VER_ITAB_TYPE;
> BEGIN
>   PARSEVERSION(MIN_VERSION_STR, MIN_VERSION);
>   PARSEVERSION(GETCOMPATIBLE, SYS_VERSION);
> 
>   RES := TRUE;
>   FOR I IN 1..5 LOOP
>     IF    SYS_VERSION(I) < MIN_VERSION(I) THEN
>       RES := FALSE;
>       EXIT;
>     ELSIF SYS_VERSION(I) > MIN_VERSION(I) THEN
>       EXIT;
>     END IF;
>   END LOOP;
> 
>   RETURN RES;
> END CHKVERSION;
> 
> 
> 
> FUNCTION CHKCOMPATIBLE(
>   FEATURE_ID  NUMBER)
> RETURN BOOLEAN
> IS
>   STATUS  BOOLEAN := TRUE;
> BEGIN
>   CASE FEATURE_ID
>   WHEN FEATURE_NO_R THEN
>     IF CHKEVENT(NO_R_COMP_EVENT, NO_R_COMP_LEVEL) THEN
>       STATUS := TRUE;
>     ELSE
>       STATUS := CHKVERSION(NO_R_MIN_COMP);
>     END IF;
> 
>   ELSE 
>     STATUS := FALSE;
>   END CASE;
> 
>   RETURN STATUS;
> END CHKCOMPATIBLE;
> 
> 
> 
2310c2420,2421
<   L_NO_R           BOOLEAN := NVL(P_NO_R, DRVUTL.CHKCOMPATIBLE(NO_R_MIN_COMP));
---
>   L_NO_R           BOOLEAN := NVL(P_NO_R, CHKCOMPATIBLE(FEATURE_NO_R));
> 
CTXSYS.DRVDDL - PACKAGE BODY (RU):
2962a2963,2964
>   REMOVE_R       BOOLEAN := FALSE;
>   ADD_R          BOOLEAN := FALSE;
3140,3145c3142
<     IF (IDX.IDX_OPTION LIKE '%P%') THEN
<       DRIXMD.GETALLPARTITIONS(IDX.IDX_ID, IDX.IDX_TABLE#, L_IXP);
<       DRVXTAB.REMOVE_R(IDX, L_IXP);
<     ELSE
<       DRVXTAB.REMOVE_R(IDX, L_IXP);
<     END IF;
---
>     REMOVE_R := TRUE;
3148,3156d3144
<     IF (STORAGE IS NOT NULL) THEN
<       L_PREFREC := DRIPREF.GET_PREF_INFO(STORAGE);
<       IF DRIPREF.GET_ATTRIBUTE_VALUE(L_PREFREC, 'SMALL_R_ROW') = '1' THEN
<         DRUE.PUSH(DRIG.GU_NOT_GENERALLY_AVAIL);
<         RAISE DR_DEF.TEXTILE_ERROR;
<       END IF;
<     END IF;
< 
<     
3160,3165c3148,3155
<     IF (IDX.IDX_OPTION LIKE '%P%') THEN
<       DRIXMD.GETALLPARTITIONS(IDX.IDX_ID, IDX.IDX_TABLE#, L_IXP);
<       DRVXTAB.ADD_R(IDX, L_IXP);
<     ELSE
<       DRVXTAB.ADD_R(IDX, L_IXP);
<     END IF;
---
>     ADD_R := TRUE;
>   END IF;
> 
>   
>   IF BITAND(L_FLAGS, INDEXREPLACEDOINDEX) = INDEXREPLACEDOINDEX AND 
>      METADATAONLY = FALSE THEN
>     REMOVE_R   := FALSE;
>     ADD_R      := FALSE;
3377a3368,3371
>   IF (IDX.IDX_OPTION LIKE '%P%') THEN
>     DRIXMD.GETALLPARTITIONS(IDX.IDX_ID, IDX.IDX_TABLE#, L_IXP);
>   END IF;
> 
3396a3391,3400
>   IF REMOVE_R THEN
>     DRVXTAB.REMOVE_R(IDX, L_IXP);
>   END IF;
> 
>   
>   IF ADD_R THEN
>     DRVXTAB.ADD_R(IDX, L_IXP);
>   END IF;
> 
>   
6432a6437,6439
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6442a6450
>   GOTDMLLOCK := TRUE;
6443a6452
>   GOTOPTLOCK := TRUE;
6444a6454
>   GOTRIOLOCK := TRUE;
6455a6466
>   GOTOPTLOCK := FALSE;
6456a6468
>   GOTDMLLOCK := FALSE;
6457a6470
>   GOTRIOLOCK := FALSE;
6479c6492
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6481a6495,6506
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN 
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6488a6514,6516
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6498a6527
>   GOTDMLLOCK := TRUE;
6499a6529
>   GOTOPTLOCK := TRUE;
6500a6531
>   GOTRIOLOCK := TRUE;
6510a6542
>   GOTOPTLOCK := FALSE;
6511a6544
>   GOTDMLLOCK := FALSE;
6512a6546
>   GOTRIOLOCK := FALSE;
6535c6569
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6537a6572,6583
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6544a6591,6593
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6554a6604
>   GOTDMLLOCK := TRUE;
6555a6606
>   GOTOPTLOCK := TRUE;
6556a6608
>   GOTRIOLOCK := TRUE;
6569a6622
>   GOTOPTLOCK := TRUE;
6570a6624
>   GOTDMLLOCK := TRUE;
6571a6626
>   GOTRIOLOCK := TRUE;
6591c6646
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6593a6649,6660
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6661a6729,6731
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6675a6746
>   GOTDMLLOCK := TRUE; 
6676a6748
>   GOTOPTLOCK := TRUE; 
6677a6750
>   GOTRIOLOCK := TRUE; 
6688a6762
>   GOTOPTLOCK := FALSE;
6689a6764
>   GOTDMLLOCK := FALSE;
6690a6766
>   GOTRIOLOCK := FALSE;
6698c6774
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6702a6779,6790
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6708a6797,6799
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6718a6810
>   GOTDMLLOCK := TRUE;
6719a6812
>   GOTOPTLOCK := TRUE;
6720a6814
>   GOTRIOLOCK := TRUE;
6731a6826
>   GOTOPTLOCK := FALSE;
6732a6828
>   GOTDMLLOCK := FALSE;
6733a6830
>   GOTRIOLOCK := FALSE;
6741c6838
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6743a6841,6852
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6787a6897,6899
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6801a6914
>   GOTDMLLOCK := TRUE;
6802a6916
>   GOTOPTLOCK := TRUE;
6803a6918
>   GOTRIOLOCK := TRUE;
6809a6925
>   GOTOPTLOCK := FALSE;
6815a6932
>   GOTDMLLOCK := FALSE;
6816a6934
>   GOTRIOLOCK := FALSE;
6821c6939
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6825a6944,6955
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
6831a6962,6964
>   GOTOPTLOCK BOOLEAN := FALSE;
>   GOTDMLLOCK BOOLEAN := FALSE;
>   GOTRIOLOCK BOOLEAN := FALSE;
6841a6975
>   GOTDMLLOCK := TRUE;
6842a6977
>   GOTOPTLOCK := TRUE;
6843a6979
>   GOTRIOLOCK := TRUE;
6849a6986
>   GOTOPTLOCK := FALSE;
6855a6993
>   GOTDMLLOCK := FALSE;
6856a6995
>   GOTRIOLOCK := FALSE;
6861c7000
<     RAISE DR_DEF.TEXTILE_ERROR;
---
>     GOTO CLEANUP;
6863a7003,7015
> <<CLEANUP>>
>     IF (IDX.IDX_ID > 0) THEN
>       IF (GOTOPTLOCK) THEN
>         DRIOPT.UNLOCK_OPT(DRIOPT.IGNORE_ERRORS);
>       END IF;
>       IF (GOTDMLLOCK) THEN
>         DRIDML.UNLOCK_DML(DRIDML.IGNORE_ERRORS);
>       END IF;
>       IF (GOTRIOLOCK) THEN
>         DRIRIO.UNLOCK_RIO(DRIRIO.IGNORE_ERRORS);
>       END IF;
>     END IF;
>  
DVSYS.DBMS_MACADM - PACKAGE BODY (RU):
2751c2751,2752
<        (INSTR(TMP2, 'IDENTIFIED/*' ) > 0) OR
---
>        (INSTR(TMP2, 'NO AUTHENTICATION') > 0) OR
>        (INSTR(TMP2, 'ACCOUNT LOCK') > 0) OR
LBACSYS.LBAC_POLICY_ADMIN - PACKAGE (RU):
1c1
< PACKAGE lbac_policy_admin AS
---
> PACKAGE lbac_policy_admin AUTHID CURRENT_USER AS
8a9,10
> PRAGMA SUPPLEMENTAL_LOG_DATA(DEFAULT, NONE);
> 
12d13
< PRAGMA SUPPLEMENTAL_LOG_DATA(APPLY_SCHEMA_POLICY, AUTO_WITH_COMMIT);
17d17
< PRAGMA SUPPLEMENTAL_LOG_DATA(REMOVE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
21d20
< PRAGMA SUPPLEMENTAL_LOG_DATA(ENABLE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
26d24
< PRAGMA SUPPLEMENTAL_LOG_DATA(ALTER_SCHEMA_POLICY, AUTO_WITH_COMMIT);
34,35c32
< PRAGMA SUPPLEMENTAL_LOG_DATA(APPLY_TABLE_POLICY, AUTO_WITH_COMMIT);
<                               
---
> 
40d36
< PRAGMA SUPPLEMENTAL_LOG_DATA(REMOVE_TABLE_POLICY, AUTO_WITH_COMMIT);
43d38
< PRAGMA SUPPLEMENTAL_LOG_DATA(POLICY_SUBSCRIBE, AUTO_WITH_COMMIT);
46d40
< PRAGMA SUPPLEMENTAL_LOG_DATA(POLICY_UNSUBSCRIBE, AUTO_WITH_COMMIT);
51,52c45
< PRAGMA SUPPLEMENTAL_LOG_DATA(ENABLE_TABLE_POLICY, AUTO_WITH_COMMIT);
<                                
---
> 
56d48
< PRAGMA SUPPLEMENTAL_LOG_DATA(DISABLE_TABLE_POLICY, AUTO_WITH_COMMIT);
60d51
< PRAGMA SUPPLEMENTAL_LOG_DATA(DISABLE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
LBACSYS.LBAC_POLICY_ADMIN_INT - PACKAGE (RU):
0a1,74
> PACKAGE lbac_policy_admin_int
> ACCESSIBLE BY (LBACSYS.LBAC_POLICY_ADMIN)
> AS
> 
> 
> 
> 
> 
> 
> PROCEDURE APPLY_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                DEFAULT_OPTIONS IN VARCHAR2 DEFAULT NULL,
>                                USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(APPLY_SCHEMA_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE REMOVE_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                 SCHEMA_NAME IN VARCHAR2,
>                                 DROP_COLUMN IN BOOLEAN DEFAULT FALSE,
>                                 USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(REMOVE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE ENABLE_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                 SCHEMA_NAME IN VARCHAR2,
>                                 USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(ENABLE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE ALTER_SCHEMA_POLICY (POLICY_NAME     IN VARCHAR2,
>                                SCHEMA_NAME     IN VARCHAR2,
>                                DEFAULT_OPTIONS IN VARCHAR2,
>                                USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(ALTER_SCHEMA_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE APPLY_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                               SCHEMA_NAME IN VARCHAR2,
>                               TABLE_NAME  IN VARCHAR2,
>                               TABLE_OPTIONS IN VARCHAR2 DEFAULT NULL,
>                               LABEL_FUNCTION IN VARCHAR2 DEFAULT NULL,
>                               PREDICATE IN VARCHAR2 DEFAULT NULL,
>                               USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(APPLY_TABLE_POLICY, AUTO_WITH_COMMIT);
>                               
> PROCEDURE REMOVE_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                TABLE_NAME  IN VARCHAR2,
>                                DROP_COLUMN IN BOOLEAN DEFAULT FALSE,
>                                USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(REMOVE_TABLE_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE POLICY_SUBSCRIBE(POLICY_NAME IN VARCHAR2,
>                            USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(POLICY_SUBSCRIBE, AUTO_WITH_COMMIT);
> 
> PROCEDURE POLICY_UNSUBSCRIBE(POLICY_NAME IN VARCHAR2,
>                              USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(POLICY_UNSUBSCRIBE, AUTO_WITH_COMMIT);
> 
> PROCEDURE ENABLE_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                TABLE_NAME  IN VARCHAR2,
>                                USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(ENABLE_TABLE_POLICY, AUTO_WITH_COMMIT);
>                                
> PROCEDURE DISABLE_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                                 SCHEMA_NAME IN VARCHAR2,
>                                 TABLE_NAME  IN VARCHAR2,
>                                 USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(DISABLE_TABLE_POLICY, AUTO_WITH_COMMIT);
> 
> PROCEDURE DISABLE_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                  SCHEMA_NAME IN VARCHAR2,
>                                  USERNAME IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(DISABLE_SCHEMA_POLICY, AUTO_WITH_COMMIT);
> 
> END LBAC_POLICY_ADMIN_INT;
LBACSYS.SA_USER_ADMIN - PACKAGE (RU):
1c1,3
< PACKAGE sa_user_admin AS
---
> PACKAGE sa_user_admin AUTHID CURRENT_USER AS
> 
> PRAGMA SUPPLEMENTAL_LOG_DATA(DEFAULT, NONE);
90d91
< PRAGMA SUPPLEMENTAL_LOG_DATA(SET_USER_PRIVS, AUTO_WITH_COMMIT);
96d96
< PRAGMA SUPPLEMENTAL_LOG_DATA(SET_PROG_PRIVS, AUTO_WITH_COMMIT);
100,101d99
< PRAGMA SUPPLEMENTAL_LOG_DATA(DROP_USER_ACCESS, AUTO_WITH_COMMIT);
< 
LBACSYS.SA_USER_ADMIN_INT - PACKAGE (RU):
0a1,122
> PACKAGE sa_user_admin_int
> ACCESSIBLE BY (LBACSYS.SA_USER_ADMIN)
> AS
> 
> PROCEDURE SET_LEVELS       (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             MAX_LEVEL        IN VARCHAR2,
>                             MIN_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             DEF_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             ROW_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2);
>                             
> PROCEDURE SET_COMPARTMENTS (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             READ_COMPS       IN VARCHAR2,
>                             WRITE_COMPS      IN VARCHAR2 DEFAULT NULL,
>                             DEF_COMPS        IN VARCHAR2 DEFAULT NULL,
>                             ROW_COMPS        IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE ALTER_COMPARTMENTS (POLICY_NAME IN VARCHAR2,
>                               USER_NAME   IN VARCHAR2,
>                               COMPS       IN VARCHAR2,
>                               ACCESS_MODE IN VARCHAR2 DEFAULT NULL,
>                               IN_DEF      IN VARCHAR2 DEFAULT NULL,
>                               IN_ROW      IN VARCHAR2 DEFAULT NULL,
>                               INVOKER_USR IN VARCHAR2);
> 
> PROCEDURE SET_GROUPS       (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             READ_GROUPS      IN VARCHAR2,
>                             WRITE_GROUPS     IN VARCHAR2 DEFAULT NULL,
>                             DEF_GROUPS       IN VARCHAR2 DEFAULT NULL,
>                             ROW_GROUPS       IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE ALTER_GROUPS (POLICY_NAME IN VARCHAR2,
>                              USER_NAME   IN VARCHAR2,
>                              GROUPS      IN VARCHAR2,
>                              ACCESS_MODE IN VARCHAR2 DEFAULT NULL,
>                              IN_DEF      IN VARCHAR2 DEFAULT NULL,
>                              IN_ROW      IN VARCHAR2 DEFAULT NULL,
>                              INVOKER_USR IN VARCHAR2);
>                             
> PROCEDURE ADD_COMPARTMENTS (POLICY_NAME  IN VARCHAR2,
>                             USER_NAME    IN VARCHAR2,
>                             COMPS        IN VARCHAR2,
>                             ACCESS_MODE  IN VARCHAR2 DEFAULT SA_UTL.READ_ONLY,
>                             IN_DEF       IN VARCHAR2 DEFAULT 'Y',
>                             IN_ROW       IN VARCHAR2 DEFAULT 'N',
>                             INVOKER_USR  IN VARCHAR2);
> 
> PROCEDURE DROP_COMPARTMENTS (POLICY_NAME      IN VARCHAR2,
>                              USER_NAME        IN VARCHAR2,
>                              COMPS            IN VARCHAR2,
>                              INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE DROP_ALL_COMPARTMENTS 
>                            (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2);
> 
> 
> PROCEDURE ADD_GROUPS       (POLICY_NAME  IN VARCHAR2,
>                             USER_NAME    IN VARCHAR2,
>                             GROUPS       IN VARCHAR2,
>                             ACCESS_MODE  IN VARCHAR2 DEFAULT NULL,
>                             IN_DEF       IN VARCHAR2 DEFAULT NULL,
>                             IN_ROW       IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR  IN VARCHAR2);
> 
> PROCEDURE DROP_GROUPS      (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             GROUPS           IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE DROP_ALL_GROUPS  (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE SET_USER_LABELS
>                            (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             MAX_READ_LABEL   IN VARCHAR2,
>                             MAX_WRITE_LABEL  IN VARCHAR2 DEFAULT NULL,
>                             MIN_WRITE_LABEL  IN VARCHAR2 DEFAULT NULL,
>                             DEF_LABEL        IN VARCHAR2 DEFAULT NULL,
>                             ROW_LABEL        IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2);
> 
> PROCEDURE SET_DEFAULT_LABEL
>                            (POLICY_NAME IN VARCHAR2,
>                             USER_NAME   IN VARCHAR2,
>                             DEF_LABEL   IN VARCHAR2,
>                             INVOKER_USR IN VARCHAR2);
> 
> PROCEDURE SET_ROW_LABEL
>                            (POLICY_NAME IN VARCHAR2,
>                             USER_NAME   IN VARCHAR2,
>                             ROW_LABEL   IN VARCHAR2,
>                             INVOKER_USR IN VARCHAR2);
> 
> PROCEDURE SET_USER_PRIVS (POLICY_NAME IN VARCHAR2,
>                           USER_NAME   IN VARCHAR2,
>                           PRIVILEGES  IN VARCHAR2,
>                           INVOKER_USR IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(SET_USER_PRIVS, AUTO_WITH_COMMIT);
> 
> PROCEDURE SET_PROG_PRIVS (POLICY_NAME       IN VARCHAR2,
>                           SCHEMA_NAME       IN VARCHAR2,
>                           PROGRAM_UNIT_NAME IN VARCHAR2,
>                           PRIVILEGES        IN VARCHAR2,
>                           INVOKER_USR       IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(SET_PROG_PRIVS, AUTO_WITH_COMMIT);
> 
> PROCEDURE DROP_USER_ACCESS (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2);
> PRAGMA SUPPLEMENTAL_LOG_DATA(DROP_USER_ACCESS, AUTO_WITH_COMMIT);
> 
> 
> END SA_USER_ADMIN_INT;
LBACSYS.LBAC_POLICY_ADMIN - PACKAGE BODY (RU):
8,61c8,10
< 
< PRODUCT            CONSTANT VARCHAR2(30) := 'TRUSTED';
< FACILITY           CONSTANT VARCHAR2(30) := 'LBAC';
< NO_POLICY_EC       CONSTANT PLS_INTEGER := 12416;
< NO_PROG_EC         CONSTANT PLS_INTEGER := 12417;
< NO_USER_EC         CONSTANT PLS_INTEGER := 12418;
< INVALID_PARAMS_EC  CONSTANT PLS_INTEGER := 12427;
< STARTUP_FAILURE_EC CONSTANT PLS_INTEGER := 12409;
< LBAC_ERROR_EC      CONSTANT PLS_INTEGER := 12432;
< UNAUTH_OPERATION   CONSTANT PLS_INTEGER := 12407;
< POLICY_ADMIN_EC    CONSTANT PLS_INTEGER := 12446;
< INVALID_SCHEMA_EC  CONSTANT PLS_INTEGER := 12425;
< ALTER_SCHEMA_EC    CONSTANT PLS_INTEGER := 12448;
< INTERNAL_ERROR_EC  CONSTANT PLS_INTEGER := 12414;
< 
< 
< APPLY_ACTION     CONSTANT PLS_INTEGER := 1;
< REMOVE_ACTION    CONSTANT PLS_INTEGER := 2;
< SET_ACTION       CONSTANT PLS_INTEGER := 4;
< GRANT_ACTION     CONSTANT PLS_INTEGER := 8;
< REVOKE_ACTION    CONSTANT PLS_INTEGER := 16;
< EXISTS_ACTION    CONSTANT PLS_INTEGER := 32;
< 
< 
< 
< APPLY_POLICY_ACTION    CONSTANT PLS_INTEGER := 1;
< REMOVE_POLICY_ACTION   CONSTANT PLS_INTEGER := 2;
< ENABLE_POLICY_ACTION   CONSTANT PLS_INTEGER := 5;
< DISABLE_POLICY_ACTION  CONSTANT PLS_INTEGER := 6;
< POLICY_SUB_ACTION      CONSTANT PLS_INTEGER := 7;
< POLICY_UNSUB_ACTION    CONSTANT PLS_INTEGER := 8;
< ALTER_POLICY_ACTION    CONSTANT PLS_INTEGER := 13;
< 
< 
< 
< AUDINFO_OBJOWNER CONSTANT PLS_INTEGER := 0;
< AUDINFO_OBJNAME  CONSTANT PLS_INTEGER := 1;
< 
< PROCEDURE APPLY_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
<                                         SCHEMA_NAME IN VARCHAR2,
<                                         DEFAULT_OPTIONS IN VARCHAR2)
< IS LANGUAGE C 
<    NAME "zlluasp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
<      POLICY_NAME    INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME    INDICATOR SB2,
<      DEFAULT_OPTIONS STRING, DEFAULT_OPTIONS LENGTH SIZE_T,
<      DEFAULT_OPTIONS INDICATOR SB2
<      );
---
> NOT_ALLOWED_EC CONSTANT PLS_INTEGER := 42908;
> PRODUCT CONSTANT VARCHAR2(12) := 'TRUSTED';
> LBAC_FACILITY CONSTANT VARCHAR2(12) := 'LBAC';
67,69c16
< 
< SCH_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
71,115c18,24
<   
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYSUBSCRIBED(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy not OID subscribed');
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, APPLY_ACTION) = FALSE
<     THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
<     END IF; 
<   END IF;
< 
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);  
<     APPLY_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, DEFAULT_OPTIONS);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<   IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, 0)) THEN
<     LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<     LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<   END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.APPLY_SCHEMA_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                     DEFAULT_OPTIONS, USERNAME);
118,133d26
< PROCEDURE REMOVE_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
<                                          SCHEMA_NAME IN VARCHAR2,
<                                          DROP_COLUMN IN BOOLEAN)
< IS LANGUAGE C 
<    NAME "zllursp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
<      POLICY_NAME    INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME    INDICATOR SB2,
<      DROP_COLUMN UB1
<      );
< 
138,140c31
< 
< SCH_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
142,181c33,39
<   
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, REMOVE_ACTION) = FALSE
<     THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
<     END IF; 
<   END IF;
< 
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     REMOVE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, DROP_COLUMN);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<   IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, 0)) THEN
<     LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<     LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<   END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.REMOVE_SCHEMA_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                      DROP_COLUMN, USERNAME);
184,197d41
< PROCEDURE ENABLE_SCHEMA_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
<                                          SCHEMA_NAME    IN VARCHAR2)
<    IS LANGUAGE C 
<    NAME "zlluesp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
<      POLICY_NAME INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME INDICATOR SB2
<      );
< 
200,201c44
< SCH_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
203,241c46,52
<   
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
<     END IF; 
<   END IF;
<   
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     ENABLE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.ENABLE_SCHEMA_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                      USERNAME);
244d54
< 
248,254c58,59
< IS 
< 
< POL_NUM         PLS_INTEGER;
< USR_CNT         PLS_INTEGER;
< NEW_OPTIONS     PLS_INTEGER;
< SCH_NAME        VARCHAR2(128);
< 
---
> IS
> USERNAME VARCHAR2(128);
256,316c61,64
< 
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
<     END IF; 
<   END IF;
< 
< 
<   IF SCH_NAME IS NULL THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<             PRODUCT, FACILITY, INVALID_PARAMS_EC, 'schema name');
<   END IF;
<   IF SCH_NAME IN ('SYS', 'LBACSYS', 'SYSTEM') THEN
<     LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, FACILITY, INVALID_SCHEMA_EC);
<   END IF;
< 
< 
<   POL_NUM:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
< 
< 
<   SELECT COUNT(*) INTO USR_CNT
<   FROM SYS.ALL_USERS
<   WHERE USERNAME = SCH_NAME;
<   IF (USR_CNT != 1) THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<       PRODUCT, FACILITY, NO_PROG_EC, SCH_NAME);
<   END IF;
<    
<   IF DEFAULT_OPTIONS IS NULL THEN
<      NEW_OPTIONS := NULL;
<   ELSE
<      
<      IF INSTR(UPPER(DEFAULT_OPTIONS),'INVERSE_GROUP',1,1) > 0 THEN
<        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<           PRODUCT, FACILITY, LBAC_ERROR_EC, ' invalid  option string');
<      END IF;
< 
<      NEW_OPTIONS := LBACSYS.LBAC_CACHE.OPTION_NUMBER(DEFAULT_OPTIONS); 
<   END IF;
< 
< 
< 
<   UPDATE LBACSYS.OLS$POLS SET OPTIONS = NEW_OPTIONS
<   WHERE POL#=POL_NUM AND OWNER = SCH_NAME;
< 
< 
< 
< 
<   IF SQL%ROWCOUNT = 0 THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, FACILITY, 
<       ALTER_SCHEMA_EC, POLICY_NAME, SCH_NAME);
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
318,334c66,67
< 
<   COMMIT;
<  
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ALTER_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ALTER_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   LBACSYS.LBAC_POLICY_ADMIN_INT.ALTER_SCHEMA_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                     DEFAULT_OPTIONS, USERNAME);
337,363d69
< 
< PROCEDURE APPLY_TABLE_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
<                               SCHEMA_NAME    IN VARCHAR2,
<                               TABLE_NAME     IN VARCHAR2,
<                               TABLE_OPTIONS  IN VARCHAR2,
<                               LABEL_FUNCTION IN VARCHAR2,
<                               PREDICATE      IN VARCHAR2)
< IS LANGUAGE C 
<    NAME "zlluatp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
<      POLICY_NAME INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME INDICATOR SB2, 
<      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
<      TABLE_NAME  INDICATOR SB2,
<      TABLE_OPTIONS  STRING, TABLE_OPTIONS LENGTH SIZE_T,
<      TABLE_OPTIONS INDICATOR SB2,
<      LABEL_FUNCTION STRING, LABEL_FUNCTION LENGTH SIZE_T,
<      LABEL_FUNCTION INDICATOR SB2,
<      PREDICATE      STRING, PREDICATE LENGTH SIZE_T,
<      PREDICATE INDICATOR SB2
<      );
< 
371,373c77
< SCH_NAME     VARCHAR2(128);
< TAB_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
375,424c79,87
< 
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
<                                              TAB_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYSUBSCRIBED(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy not OID subscribed');
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, APPLY_ACTION) = FALSE
<     THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
<     END IF; 
<   END IF;
< 
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     APPLY_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME, TABLE_OPTIONS,
<                                 LABEL_FUNCTION, PREDICATE );
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.APPLY_TABLE_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                    TABLE_NAME, TABLE_OPTIONS,
>                                                    LABEL_FUNCTION, PREDICATE,
>                                                    USERNAME);
427,443d89
< PROCEDURE ENABLE_TABLE_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
<                               SCHEMA_NAME    IN VARCHAR2,
<                               TABLE_NAME     IN VARCHAR2)
<    IS LANGUAGE C 
<    NAME "zlluetp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
<      POLICY_NAME INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME INDICATOR SB2, 
<      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
<      TABLE_NAME  INDICATOR SB2
<      );
< 
447,449c93
< SCH_NAME     VARCHAR2(128);
< TAB_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
451,494c95,101
<   
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
<                                              TAB_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   END IF;
<   
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     ENABLE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;  
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.ENABLE_TABLE_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                     TABLE_NAME, USERNAME);
497,516d103
<                               
< PROCEDURE REMOVE_TABLE_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
<                                SCHEMA_NAME IN VARCHAR2,
<                                TABLE_NAME  IN VARCHAR2,
<                                DROP_COLUMN IN BOOLEAN)
< IS LANGUAGE C 
<    NAME "zllurtp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<              CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
<      POLICY_NAME    INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME    INDICATOR SB2,
<      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
<      TABLE_NAME     INDICATOR SB2,
<      DROP_COLUMN    UB1, DROP_COLUMN INDICATOR SB2
<      );
<                               
522,525c109
< 
< SCH_NAME     VARCHAR2(128);
< TAB_NAME     VARCHAR2(128);
<  
---
> USERNAME VARCHAR2(128);
527,571c111,118
< 
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
<                                              TAB_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, REMOVE_ACTION) = FALSE
<     THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF; 
<   END IF;
< 
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     REMOVE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME, DROP_COLUMN);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.REMOVE_TABLE_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                     TABLE_NAME, DROP_COLUMN,
>                                                     USERNAME);
576,587c123,128
< UNSUPPORTED_OP_EC    CONSTANT PLS_INTEGER := 12408;
< 
< BEGIN
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<     LBACSYS.LBAC_CACHE.OID_SUBSCRIBE(POLICY_NAME);
<   ELSE
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, UNSUPPORTED_OP_EC, 'OID not enabled');
---
> USERNAME VARCHAR2(128);
> BEGIN 
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
589,601c130
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_SUB_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_SUB_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   LBACSYS.LBAC_POLICY_ADMIN_INT.POLICY_SUBSCRIBE(POLICY_NAME, USERNAME);
606,609c135
< UNSUPPORTED_OP_EC    CONSTANT PLS_INTEGER := 12408;
< POLICY_IN_USE_TABLE  PLS_INTEGER;
< POLICY_IN_USE_SCHEMA PLS_INTEGER;
< 
---
> USERNAME VARCHAR2(128);
611,632c137,140
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<     SELECT COUNT(*) INTO POLICY_IN_USE_SCHEMA
<         FROM LBACSYS.OLS$POL P, LBACSYS.OLS$POLS S
<         WHERE P.POL_NAME = UPPER(POLICY_NAME)
<           AND P.POL# = S.POL#;
<     SELECT COUNT(*) INTO POLICY_IN_USE_TABLE
<         FROM LBACSYS.OLS$POL P, LBACSYS.OLS$POLT PT
<         WHERE P.POL_NAME = UPPER(POLICY_NAME)
<           AND P.POL# = PT.POL#;
< 
<     IF POLICY_IN_USE_TABLE <> 0 OR POLICY_IN_USE_SCHEMA <> 0 THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy in use');
<     END IF;
<     LBACSYS.LBAC_CACHE.OID_UNSUBSCRIBE(POLICY_NAME);
<   ELSE
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, UNSUPPORTED_OP_EC, 'OID not enabled');
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
634,646c142
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_UNSUB_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_UNSUB_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   LBACSYS.LBAC_POLICY_ADMIN_INT.POLICY_UNSUBSCRIBE(POLICY_NAME, USERNAME);
649,666d144
< 
< PROCEDURE DISABLE_TABLE_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
<                                SCHEMA_NAME IN VARCHAR2,
<                                TABLE_NAME  IN VARCHAR2)
< IS LANGUAGE C 
<    NAME "zlludtp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
<      POLICY_NAME    INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME    INDICATOR SB2,
<      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
<      TABLE_NAME     INDICATOR SB2
<      );
<                               
671,674c149
< 
< SCH_NAME     VARCHAR2(128);
< TAB_NAME     VARCHAR2(128);
<  
---
> USERNAME VARCHAR2(128);
676,719c151,157
<   
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
<                                              TAB_NAME);
< 
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   END IF;
< 
<   BEGIN 
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     DISABLE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.LBAC_POLICY_ADMIN_INT.DISABLE_TABLE_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                      TABLE_NAME, USERNAME);
722,735d159
< PROCEDURE DISABLE_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
<                                           SCHEMA_NAME IN VARCHAR2)
< IS LANGUAGE C 
<    NAME "zlludsp" 
<    LIBRARY LBACSYS.LBAC$USER_LIBT 
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
<      POLICY_NAME    INDICATOR SB2,
<      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
<      SCHEMA_NAME    INDICATOR SB2
<      );
< 
739,741c163
< 
< SCH_NAME     VARCHAR2(128);
< 
---
> USERNAME VARCHAR2(128);
743,831c165,168
< 
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                              SCH_NAME);
<   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   ELSE
<     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<     END IF;
<   END IF;
< 
<   BEGIN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
<     DISABLE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME);
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<   EXCEPTION
<     WHEN OTHERS THEN
<     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
<     RAISE;
<   END;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, ABS(SQLCODE)))
<     THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
< END DISABLE_SCHEMA_POLICY;
< 
< FUNCTION PRIV_NAMES (POLICY_NAME IN VARCHAR2)
< RETURN LBACSYS.LBAC_NAME_LIST IS
< 
< STR_NAME_LIST LBACSYS.LBAC_NAME_LIST;
< 
< BEGIN
< 
<   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<      PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<   END IF;
<   STR_NAME_LIST := NULL;
<   EXECUTE IMMEDIATE 'BEGIN lbacsys.' ||
<             LBAC_CACHE.PACKAGE(POLICY_NAME) ||
<             '.priv_names(:name_List); END;'
<   USING
<        OUT STR_NAME_LIST;
<     
<   IF STR_NAME_LIST IS NULL THEN
<     RETURN NULL;
<   END IF;
<   
<   RETURN STR_NAME_LIST;
< 
< END PRIV_NAMES; 
<     
< FUNCTION LABEL_NAMES (POLICY_NAME IN VARCHAR2,
<                       LABEL_TYPE  IN PLS_INTEGER)
< RETURN LBACSYS.LBAC_NAME_LIST IS
<     
< STR_LABEL_LIST LBACSYS.LBAC_NAME_LIST;
<     
< BEGIN
<     
<   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<      PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
<   END IF;
<   STR_LABEL_LIST := NULL;
<   EXECUTE IMMEDIATE 'BEGIN lbacsys.' ||
<             LBAC_CACHE.PACKAGE(POLICY_NAME) ||
<             '.label_names(:type,:label_List); END;'
<   USING
<        IN LABEL_TYPE,
<        OUT STR_LABEL_LIST; 
< 
<   IF STR_LABEL_LIST IS NULL THEN
<     RETURN NULL;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
833,836c170,172
< 
<   RETURN STR_LABEL_LIST;
< 
< END LABEL_NAMES;
---
>   LBACSYS.LBAC_POLICY_ADMIN_INT.DISABLE_SCHEMA_POLICY(POLICY_NAME, SCHEMA_NAME,
>                                                       USERNAME);
> END DISABLE_SCHEMA_POLICY;
LBACSYS.LBAC_POLICY_ADMIN_INT - PACKAGE BODY (RU):
0a1,856
> PACKAGE BODY lbac_policy_admin_int AS
> 
> 
> 
> 
> 
> 
> 
> PRODUCT            CONSTANT VARCHAR2(30) := 'TRUSTED';
> FACILITY           CONSTANT VARCHAR2(30) := 'LBAC';
> NO_POLICY_EC       CONSTANT PLS_INTEGER := 12416;
> NO_PROG_EC         CONSTANT PLS_INTEGER := 12417;
> NO_USER_EC         CONSTANT PLS_INTEGER := 12418;
> INVALID_PARAMS_EC  CONSTANT PLS_INTEGER := 12427;
> STARTUP_FAILURE_EC CONSTANT PLS_INTEGER := 12409;
> LBAC_ERROR_EC      CONSTANT PLS_INTEGER := 12432;
> UNAUTH_OPERATION   CONSTANT PLS_INTEGER := 12407;
> POLICY_ADMIN_EC    CONSTANT PLS_INTEGER := 12446;
> INVALID_SCHEMA_EC  CONSTANT PLS_INTEGER := 12425;
> ALTER_SCHEMA_EC    CONSTANT PLS_INTEGER := 12448;
> INTERNAL_ERROR_EC  CONSTANT PLS_INTEGER := 12414;
> 
> 
> APPLY_ACTION     CONSTANT PLS_INTEGER := 1;
> REMOVE_ACTION    CONSTANT PLS_INTEGER := 2;
> SET_ACTION       CONSTANT PLS_INTEGER := 4;
> GRANT_ACTION     CONSTANT PLS_INTEGER := 8;
> REVOKE_ACTION    CONSTANT PLS_INTEGER := 16;
> EXISTS_ACTION    CONSTANT PLS_INTEGER := 32;
> 
> 
> 
> APPLY_POLICY_ACTION    CONSTANT PLS_INTEGER := 1;
> REMOVE_POLICY_ACTION   CONSTANT PLS_INTEGER := 2;
> ENABLE_POLICY_ACTION   CONSTANT PLS_INTEGER := 5;
> DISABLE_POLICY_ACTION  CONSTANT PLS_INTEGER := 6;
> POLICY_SUB_ACTION      CONSTANT PLS_INTEGER := 7;
> POLICY_UNSUB_ACTION    CONSTANT PLS_INTEGER := 8;
> ALTER_POLICY_ACTION    CONSTANT PLS_INTEGER := 13;
> 
> 
> 
> AUDINFO_OBJOWNER CONSTANT PLS_INTEGER := 0;
> AUDINFO_OBJNAME  CONSTANT PLS_INTEGER := 1;
> 
> PROCEDURE APPLY_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
>                                         SCHEMA_NAME IN VARCHAR2,
>                                         DEFAULT_OPTIONS IN VARCHAR2,
>                                         USERNAME IN VARCHAR2)
> IS LANGUAGE C 
>    NAME "zlluasp1" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
>      POLICY_NAME    INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME    INDICATOR SB2,
>      DEFAULT_OPTIONS STRING, DEFAULT_OPTIONS LENGTH SIZE_T,
>      DEFAULT_OPTIONS INDICATOR SB2,
>      USERNAME STRING, USERNAME LENGTH SIZE_T,
>      USERNAME INDICATOR SB2
>      );
> 
> PROCEDURE APPLY_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                DEFAULT_OPTIONS IN VARCHAR2 DEFAULT NULL,
>                                USERNAME IN VARCHAR2)
> IS
> 
> SCH_NAME     VARCHAR2(128);
> 
> BEGIN
>   
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYSUBSCRIBED(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy not OID subscribed');
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, APPLY_ACTION) = FALSE
>     THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
>     END IF; 
>   END IF;
> 
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);  
>     APPLY_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME,
>                                  DEFAULT_OPTIONS, USERNAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>   IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, 0)) THEN
>     LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>     LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>   END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END APPLY_SCHEMA_POLICY;
> 
> PROCEDURE REMOVE_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
>                                          SCHEMA_NAME IN VARCHAR2,
>                                          DROP_COLUMN IN BOOLEAN)
> IS LANGUAGE C 
>    NAME "zllursp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
>      POLICY_NAME    INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME    INDICATOR SB2,
>      DROP_COLUMN UB1
>      );
> 
> PROCEDURE REMOVE_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                 SCHEMA_NAME IN VARCHAR2,
>                                 DROP_COLUMN IN BOOLEAN DEFAULT FALSE,
>                                 USERNAME    IN VARCHAR2)
> IS
> 
> SCH_NAME     VARCHAR2(128);
> 
> BEGIN
>   
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, REMOVE_ACTION) = FALSE
>     THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
>     END IF; 
>   END IF;
> 
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     REMOVE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, DROP_COLUMN);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>   IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, 0)) THEN
>     LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>     LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>   END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END REMOVE_SCHEMA_POLICY;
> 
> PROCEDURE ENABLE_SCHEMA_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
>                                          SCHEMA_NAME    IN VARCHAR2)
>    IS LANGUAGE C 
>    NAME "zlluesp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
>      POLICY_NAME INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME INDICATOR SB2
>      );
> 
> PROCEDURE ENABLE_SCHEMA_POLICY(POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                USERNAME    IN VARCHAR2) IS
> SCH_NAME     VARCHAR2(128);
> 
> BEGIN
>   
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
>     END IF; 
>   END IF;
>   
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     ENABLE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END ENABLE_SCHEMA_POLICY;
> 
> 
> PROCEDURE ALTER_SCHEMA_POLICY (POLICY_NAME     IN VARCHAR2,
>                                SCHEMA_NAME     IN VARCHAR2,
>                                DEFAULT_OPTIONS IN VARCHAR2,
>                                USERNAME        IN VARCHAR2)
> IS 
> 
> POL_NUM         PLS_INTEGER;
> USR_CNT         PLS_INTEGER;
> NEW_OPTIONS     PLS_INTEGER;
> SCH_NAME        VARCHAR2(128);
> 
> BEGIN
> 
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
>     END IF; 
>   END IF;
> 
> 
>   IF SCH_NAME IS NULL THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>             PRODUCT, FACILITY, INVALID_PARAMS_EC, 'schema name');
>   END IF;
>   IF SCH_NAME IN ('SYS', 'LBACSYS', 'SYSTEM') THEN
>     LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, FACILITY, INVALID_SCHEMA_EC);
>   END IF;
> 
> 
>   POL_NUM:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
> 
> 
>   SELECT COUNT(*) INTO USR_CNT
>   FROM SYS.ALL_USERS
>   WHERE USERNAME = SCH_NAME;
>   IF (USR_CNT != 1) THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>       PRODUCT, FACILITY, NO_PROG_EC, SCH_NAME);
>   END IF;
>    
>   IF DEFAULT_OPTIONS IS NULL THEN
>      NEW_OPTIONS := NULL;
>   ELSE
>      
>      IF INSTR(UPPER(DEFAULT_OPTIONS),'INVERSE_GROUP',1,1) > 0 THEN
>        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>           PRODUCT, FACILITY, LBAC_ERROR_EC, ' invalid  option string');
>      END IF;
> 
>      NEW_OPTIONS := LBACSYS.LBAC_CACHE.OPTION_NUMBER(DEFAULT_OPTIONS); 
>   END IF;
> 
> 
> 
>   UPDATE LBACSYS.OLS$POLS SET OPTIONS = NEW_OPTIONS
>   WHERE POL#=POL_NUM AND OWNER = SCH_NAME;
> 
> 
> 
> 
>   IF SQL%ROWCOUNT = 0 THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, FACILITY, 
>       ALTER_SCHEMA_EC, POLICY_NAME, SCH_NAME);
>   END IF;
> 
>   COMMIT;
>  
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ALTER_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ALTER_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END ALTER_SCHEMA_POLICY;
> 
> 
> PROCEDURE APPLY_TABLE_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
>                               SCHEMA_NAME    IN VARCHAR2,
>                               TABLE_NAME     IN VARCHAR2,
>                               TABLE_OPTIONS  IN VARCHAR2,
>                               LABEL_FUNCTION IN VARCHAR2,
>                               PREDICATE      IN VARCHAR2,
>                               INVOKER_USR    IN VARCHAR2)
> IS LANGUAGE C 
>    NAME "zlluatp1" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
>      POLICY_NAME INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME INDICATOR SB2, 
>      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
>      TABLE_NAME  INDICATOR SB2,
>      TABLE_OPTIONS  STRING, TABLE_OPTIONS LENGTH SIZE_T,
>      TABLE_OPTIONS INDICATOR SB2,
>      LABEL_FUNCTION STRING, LABEL_FUNCTION LENGTH SIZE_T,
>      LABEL_FUNCTION INDICATOR SB2,
>      PREDICATE      STRING, PREDICATE LENGTH SIZE_T,
>      PREDICATE INDICATOR SB2,
>      INVOKER_USR    STRING, INVOKER_USR LENGTH SIZE_T,
>      INVOKER_USR INDICATOR SB2
>      );
> 
> PROCEDURE APPLY_TABLE_POLICY (POLICY_NAME    IN VARCHAR2,
>                               SCHEMA_NAME    IN VARCHAR2,
>                               TABLE_NAME     IN VARCHAR2,
>                               TABLE_OPTIONS  IN VARCHAR2 DEFAULT NULL,
>                               LABEL_FUNCTION IN VARCHAR2 DEFAULT NULL,
>                               PREDICATE      IN VARCHAR2 DEFAULT NULL,
>                               USERNAME       IN VARCHAR2
>                               ) IS
> SCH_NAME     VARCHAR2(128);
> TAB_NAME     VARCHAR2(128);
> 
> BEGIN
> 
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
>                                              TAB_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYSUBSCRIBED(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy not OID subscribed');
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, APPLY_ACTION) = FALSE
>     THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME); 
>     END IF; 
>   END IF;
> 
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     APPLY_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME, TABLE_OPTIONS,
>                                 LABEL_FUNCTION, PREDICATE, USERNAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(APPLY_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END APPLY_TABLE_POLICY;
> 
> PROCEDURE ENABLE_TABLE_POLICY_INTERNAL (POLICY_NAME    IN VARCHAR2,
>                               SCHEMA_NAME    IN VARCHAR2,
>                               TABLE_NAME     IN VARCHAR2)
>    IS LANGUAGE C 
>    NAME "zlluetp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T, 
>      POLICY_NAME INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME INDICATOR SB2, 
>      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
>      TABLE_NAME  INDICATOR SB2
>      );
> 
> PROCEDURE ENABLE_TABLE_POLICY(POLICY_NAME IN VARCHAR2,
>                               SCHEMA_NAME IN VARCHAR2,
>                               TABLE_NAME  IN VARCHAR2,
>                               USERNAME    IN VARCHAR2) IS
> SCH_NAME     VARCHAR2(128);
> TAB_NAME     VARCHAR2(128);
> 
> BEGIN
>   
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
>                                              TAB_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   END IF;
>   
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     ENABLE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(ENABLE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;  
>     RAISE;
> END ENABLE_TABLE_POLICY;
> 
>                               
> PROCEDURE REMOVE_TABLE_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                TABLE_NAME  IN VARCHAR2,
>                                DROP_COLUMN IN BOOLEAN)
> IS LANGUAGE C 
>    NAME "zllurtp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>              CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
>      POLICY_NAME    INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME    INDICATOR SB2,
>      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
>      TABLE_NAME     INDICATOR SB2,
>      DROP_COLUMN    UB1, DROP_COLUMN INDICATOR SB2
>      );
>                               
> PROCEDURE REMOVE_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                TABLE_NAME  IN VARCHAR2,
>                                DROP_COLUMN IN BOOLEAN DEFAULT FALSE,
>                                USERNAME    IN VARCHAR2)
> IS
> 
> SCH_NAME     VARCHAR2(128);
> TAB_NAME     VARCHAR2(128);
>  
> BEGIN
> 
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
>                                              TAB_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, REMOVE_ACTION) = FALSE
>     THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF; 
>   END IF;
> 
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     REMOVE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME, DROP_COLUMN);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(REMOVE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END REMOVE_TABLE_POLICY;
> 
> 
> PROCEDURE POLICY_SUBSCRIBE(POLICY_NAME IN VARCHAR2,
>                            USERNAME    IN VARCHAR2) IS
> UNSUPPORTED_OP_EC    CONSTANT PLS_INTEGER := 12408;
> 
> BEGIN
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>     LBACSYS.LBAC_CACHE.OID_SUBSCRIBE(POLICY_NAME);
>   ELSE
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, UNSUPPORTED_OP_EC, 'OID not enabled');
>   END IF;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_SUB_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_SUB_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END POLICY_SUBSCRIBE;
> 
> 
> PROCEDURE POLICY_UNSUBSCRIBE(POLICY_NAME IN VARCHAR2,
>                              USERNAME    IN VARCHAR2) IS
> UNSUPPORTED_OP_EC    CONSTANT PLS_INTEGER := 12408;
> POLICY_IN_USE_TABLE  PLS_INTEGER;
> POLICY_IN_USE_SCHEMA PLS_INTEGER;
> 
> BEGIN
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>     SELECT COUNT(*) INTO POLICY_IN_USE_SCHEMA
>         FROM LBACSYS.OLS$POL P, LBACSYS.OLS$POLS S
>         WHERE P.POL_NAME = UPPER(POLICY_NAME)
>           AND P.POL# = S.POL#;
>     SELECT COUNT(*) INTO POLICY_IN_USE_TABLE
>         FROM LBACSYS.OLS$POL P, LBACSYS.OLS$POLT PT
>         WHERE P.POL_NAME = UPPER(POLICY_NAME)
>           AND P.POL# = PT.POL#;
> 
>     IF POLICY_IN_USE_TABLE <> 0 OR POLICY_IN_USE_SCHEMA <> 0 THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, LBAC_ERROR_EC, 'Policy in use');
>     END IF;
>     LBACSYS.LBAC_CACHE.OID_UNSUBSCRIBE(POLICY_NAME);
>   ELSE
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, UNSUPPORTED_OP_EC, 'OID not enabled');
>   END IF;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_UNSUB_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(POLICY_UNSUB_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END POLICY_UNSUBSCRIBE;
> 
> 
> PROCEDURE DISABLE_TABLE_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
>                                SCHEMA_NAME IN VARCHAR2,
>                                TABLE_NAME  IN VARCHAR2)
> IS LANGUAGE C 
>    NAME "zlludtp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
>      POLICY_NAME    INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME    INDICATOR SB2,
>      TABLE_NAME     STRING, TABLE_NAME   LENGTH SIZE_T,
>      TABLE_NAME     INDICATOR SB2
>      );
>                               
> PROCEDURE DISABLE_TABLE_POLICY (POLICY_NAME IN VARCHAR2,
>                                 SCHEMA_NAME IN VARCHAR2,
>                                 TABLE_NAME  IN VARCHAR2,
>                                 USERNAME    IN VARCHAR2)
> IS
> 
> SCH_NAME     VARCHAR2(128);
> TAB_NAME     VARCHAR2(128);
>  
> BEGIN
>   
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(TABLE_NAME, 'table name',
>                                              TAB_NAME);
> 
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   END IF;
> 
>   BEGIN 
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     DISABLE_TABLE_POLICY_INTERNAL(POLICY_NAME, SCH_NAME, TAB_NAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJNAME, TAB_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END DISABLE_TABLE_POLICY;
> 
> PROCEDURE DISABLE_SCHEMA_POLICY_INTERNAL (POLICY_NAME IN VARCHAR2,
>                                           SCHEMA_NAME IN VARCHAR2)
> IS LANGUAGE C 
>    NAME "zlludsp" 
>    LIBRARY LBACSYS.LBAC$USER_LIBT 
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME    STRING, POLICY_NAME  LENGTH SIZE_T,
>      POLICY_NAME    INDICATOR SB2,
>      SCHEMA_NAME    STRING, SCHEMA_NAME  LENGTH SIZE_T,
>      SCHEMA_NAME    INDICATOR SB2
>      );
> 
> PROCEDURE DISABLE_SCHEMA_POLICY (POLICY_NAME IN VARCHAR2,
>                                  SCHEMA_NAME IN VARCHAR2,
>                                  USERNAME    IN VARCHAR2)
> IS
> 
> SCH_NAME     VARCHAR2(128);
> 
> BEGIN
> 
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                              SCH_NAME);
>   IF (LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYADMIN(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   ELSE
>     IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>     END IF;
>   END IF;
> 
>   BEGIN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(1);
>     DISABLE_SCHEMA_POLICY_INTERNAL(POLICY_NAME, SCH_NAME);
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>   EXCEPTION
>     WHEN OTHERS THEN
>     LBACSYS.LBAC_CACHE.SET_ALTER_ALLOW(0);
>     RAISE;
>   END;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(DISABLE_POLICY_ACTION, ABS(SQLCODE)))
>     THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCH_NAME);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END DISABLE_SCHEMA_POLICY;
> 
> FUNCTION PRIV_NAMES (POLICY_NAME IN VARCHAR2)
> RETURN LBACSYS.LBAC_NAME_LIST IS
> 
> STR_NAME_LIST LBACSYS.LBAC_NAME_LIST;
> 
> BEGIN
> 
>   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>      PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>   END IF;
>   STR_NAME_LIST := NULL;
>   EXECUTE IMMEDIATE 'BEGIN lbacsys.' ||
>             LBAC_CACHE.PACKAGE(POLICY_NAME) ||
>             '.priv_names(:name_List); END;'
>   USING
>        OUT STR_NAME_LIST;
>     
>   IF STR_NAME_LIST IS NULL THEN
>     RETURN NULL;
>   END IF;
>   
>   RETURN STR_NAME_LIST;
> 
> END PRIV_NAMES; 
>     
> FUNCTION LABEL_NAMES (POLICY_NAME IN VARCHAR2,
>                       LABEL_TYPE  IN PLS_INTEGER)
> RETURN LBACSYS.LBAC_NAME_LIST IS
>     
> STR_LABEL_LIST LBACSYS.LBAC_NAME_LIST;
>     
> BEGIN
>     
>   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>      PRODUCT, FACILITY, POLICY_ADMIN_EC, POLICY_NAME);
>   END IF;
>   STR_LABEL_LIST := NULL;
>   EXECUTE IMMEDIATE 'BEGIN lbacsys.' ||
>             LBAC_CACHE.PACKAGE(POLICY_NAME) ||
>             '.label_names(:type,:label_List); END;'
>   USING
>        IN LABEL_TYPE,
>        OUT STR_LABEL_LIST; 
> 
>   IF STR_LABEL_LIST IS NULL THEN
>     RETURN NULL;
>   END IF;
> 
>   RETURN STR_LABEL_LIST;
> 
> END LABEL_NAMES;
> 
> END LBAC_POLICY_ADMIN_INT;
LBACSYS.SA_SYSDBA - PACKAGE BODY (RU):
6a7,10
> NOT_ALLOWED_EC CONSTANT PLS_INTEGER := 42908;
> PRODUCT CONSTANT VARCHAR2(12) := 'TRUSTED';
> LBAC_FACILITY CONSTANT VARCHAR2(12) := 'LBAC';
> 
14,15c18,22
<   SELECT SYS_CONTEXT('USERENV','CURRENT_USER') INTO USERNAME
<   FROM SYS.DUAL;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
27,28c34,38
<   SELECT SYS_CONTEXT('USERENV','CURRENT_USER') INTO USERNAME
<   FROM SYS.DUAL;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
38,39c48,52
<   SELECT SYS_CONTEXT('USERENV','CURRENT_USER') INTO USERNAME
<   FROM SYS.DUAL;
---
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
44a58
> USERNAME VARCHAR2(128);
45a60,64
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
51a71
> USERNAME VARCHAR2(128);
52a73,77
>   USERNAME := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (USERNAME = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
LBACSYS.SA_USER_ADMIN - PACKAGE BODY (RU):
3,5c3,4
< 
< 
< PRODUCT       CONSTANT VARCHAR2(12) := 'TRUSTED';
---
> NOT_ALLOWED_EC CONSTANT PLS_INTEGER := 42908;
> PRODUCT CONSTANT VARCHAR2(12) := 'TRUSTED';
7,311d5
< SA_FACILITY   CONSTANT VARCHAR2(12) := 'SA';
< SA_PACKAGE    CONSTANT VARCHAR2(12) := 'LBAC$SA';
< INV_BIT       CONSTANT PLS_INTEGER  := 4;
< GRP_BIT       CONSTANT PLS_INTEGER := 2;
< 
< LVER    CONSTANT PLS_INTEGER := 1;  
< LVL_BIT CONSTANT PLS_INTEGER := 0;  
< CMP_BIT CONSTANT PLS_INTEGER := 1;
< LSEP    CONSTANT VARCHAR2(1) := '.'; 
< 
< INVALID_LABEL_LIST_EC   CONSTANT PLS_INTEGER := 12405;
< UNAUTHORIZED_OP_EC      CONSTANT PLS_INTEGER := 12407;
< NO_POLICY_EC            CONSTANT PLS_INTEGER := 12416;
< NO_USER_EC              CONSTANT PLS_INTEGER := 12418;
< NO_OLS_EC               CONSTANT PLS_INTEGER := 12458;
< UNDEFINED_LEVEL_EC      CONSTANT PLS_INTEGER := 12461;
< INVALID_CLRN_RANGE_EC   CONSTANT PLS_INTEGER := 12466;
< UNDEFINED_COMP_EC       CONSTANT PLS_INTEGER := 12462;
< UNDEFINED_GROUP_EC      CONSTANT PLS_INTEGER := 12463;
< SYS_USER_EC             CONSTANT PLS_INTEGER := 12432;
< INVALID_SCHEMA_EC       CONSTANT PLS_INTEGER := 12425;
< INVALID_ARG_EC          CONSTANT PLS_INTEGER := 12427;
< NO_DEFINED_LEVELS_EC    CONSTANT PLS_INTEGER := 12469;
< INVALID_LABEL_EC        CONSTANT PLS_INTEGER := 12470; 
< NO_PROG_EC              CONSTANT PLS_INTEGER := 12417;
< INVALID_COMPS_GRPS_EC   CONSTANT PLS_INTEGER := 12465;
< 
< INVALID_PARAMS_EC  CONSTANT PLS_INTEGER := 12427;
< STARTUP_FAILURE_EC CONSTANT PLS_INTEGER := 12409;
< 
< SET_ACTION       CONSTANT PLS_INTEGER := 4;
< 
< 
< 
< SET_AUTH_ACTION  CONSTANT PLS_INTEGER := 3;
< 
< 
< 
< AUDINFO_OBJOWNER   CONSTANT PLS_INTEGER := 0;
< AUDINFO_GRANTEE    CONSTANT PLS_INTEGER := 2;
< AUDINFO_MAXRD      CONSTANT PLS_INTEGER := 3;
< AUDINFO_MAXWRT     CONSTANT PLS_INTEGER := 4;
< AUDINFO_MINWRT     CONSTANT PLS_INTEGER := 5;
< AUDINFO_PRIVGRNTED CONSTANT PLS_INTEGER := 6;
< AUDINFO_PROGRAM    CONSTANT PLS_INTEGER := 7;
< 
< 
< INSERT_TYPE    CONSTANT PLS_INTEGER := 2;    
< UPDATE_TYPE    CONSTANT PLS_INTEGER := 6;    
< DELETE_TYPE    CONSTANT PLS_INTEGER := 7;    
< 
< 
< TABLE_OBJ_TYPE CONSTANT PLS_INTEGER := 1;  
< PROC_OBJ_TYPE  CONSTANT PLS_INTEGER := 2;  
< 
< USER_OBJ_TYPE  CONSTANT PLS_INTEGER := 3;  
< 
< 
< 
< TYPE LAB_SORT_T IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;
< 
< 
< 
< 
< 
< 
< 
< PROCEDURE CHECK_POLICY(POLICY_NAME IN VARCHAR2) IS
< BEGIN
< 
< 
<   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       UNAUTHORIZED_OP_EC, POLICY_NAME);
<   END IF;
<   
< 
<   IF LBACSYS.LBAC_CACHE.PACKAGE(POLICY_NAME) != SA_PACKAGE THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       NO_POLICY_EC, POLICY_NAME, TRUE);
<   END IF;
<   
< END CHECK_POLICY;
< 
< 
< 
< PROCEDURE CHECK_LEVELS(POLICY_NAME IN VARCHAR2,
<                        USER_NAME IN VARCHAR2) IS
< I_NULL     CHAR(1);
< POL_NUMBER LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
< 
< BEGIN
<     POL_NUMBER := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
< 
<     SELECT NULL INTO I_NULL
<     FROM LBACSYS.OLS$USER_LEVELS
<     WHERE POL# = POL_NUMBER AND USR_NAME = USER_NAME;
< EXCEPTION
<   WHEN NO_DATA_FOUND THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       NO_DEFINED_LEVELS_EC, USER_NAME, POLICY_NAME);
< END CHECK_LEVELS;
< 
< 
< 
< PROCEDURE CHECK_USER(UNAME IN VARCHAR2) IS
< I_NULL CHAR(1);
< 
< BEGIN
<     IF UNAME IN ('SYS','LBACSYS','SYSTEM') THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       INVALID_SCHEMA_EC);
<     END IF;
< END CHECK_USER;
< 
< 
< 
< PROCEDURE CHECK_COMMON(UNAME  IN VARCHAR2,
<                        OBJECT IN VARCHAR2,
<                        OBJTYP IN PLS_INTEGER)
< IS LANGUAGE C
<    NAME "zllsesFedChk"
<    LIBRARY LBACSYS.OLS$SESSION_LIBT
<    PARAMETERS (
<      UNAME STRING, UNAME LENGTH SIZE_T, UNAME INDICATOR SB2,
<      OBJECT STRING, OBJECT LENGTH SIZE_T, OBJECT INDICATOR SB2,
<      OBJTYP UB1, OBJTYP INDICATOR SB2
<      );
< 
< 
< 
< FUNCTION GET_LEVEL (POL_ID     IN PLS_INTEGER, 
<                     LEVEL_CODE IN VARCHAR2)
< RETURN PLS_INTEGER IS
<   LEVEL_NUM LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
< BEGIN
<     IF LEVEL_CODE IS NULL THEN
<        RETURN NULL;
<     ELSE
<        SELECT LEVEL# INTO LEVEL_NUM
<        FROM LBACSYS.OLS$LEVELS
<        WHERE POL# = POL_ID AND CODE = LEVEL_CODE;
<        RETURN LEVEL_NUM;
<     END IF;
<   EXCEPTION
<     WHEN NO_DATA_FOUND THEN 
<        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
<        UNDEFINED_LEVEL_EC, LEVEL_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
< END GET_LEVEL; 
< 
< FUNCTION GET_LEVEL (POL_ID     IN PLS_INTEGER,
<                     LEVEL_NUM  IN PLS_INTEGER)
< RETURN VARCHAR2 IS
<   LEVEL_CODE LBACSYS.OLS$LEVELS.CODE%TYPE;
< BEGIN
<     IF LEVEL_NUM IS NULL THEN
<        RETURN NULL;
<     ELSE
<        SELECT CODE INTO LEVEL_CODE
<        FROM LBACSYS.OLS$LEVELS
<        WHERE POL# = POL_ID AND LEVEL# = LEVEL_NUM;
<        RETURN LEVEL_CODE;
<     END IF;
<   EXCEPTION
<     WHEN NO_DATA_FOUND THEN
<        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<        UNDEFINED_LEVEL_EC, LEVEL_NUM, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
< END GET_LEVEL;
< 
< 
< 
< FUNCTION GET_COMP  (POL_ID     IN PLS_INTEGER, 
<                     COMP_CODE IN VARCHAR2)
< RETURN PLS_INTEGER IS
<   COMP_NUM LBACSYS.OLS$COMPARTMENTS.COMP#%TYPE;
< BEGIN
<   IF COMP_CODE IS NULL THEN
<      RETURN NULL;
<   ELSE
<      SELECT COMP# INTO COMP_NUM
<      FROM LBACSYS.OLS$COMPARTMENTS
<      WHERE POL# = POL_ID AND CODE = COMP_CODE;
<      RETURN COMP_NUM;
<   END IF;
< EXCEPTION
<   WHEN NO_DATA_FOUND THEN 
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
<      UNDEFINED_COMP_EC, COMP_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
< END GET_COMP; 
< 
< 
< 
< FUNCTION GET_GROUP (POL_ID     IN PLS_INTEGER, 
<                     GROUP_CODE IN VARCHAR2)
< RETURN PLS_INTEGER IS
<   GROUP_NUM LBACSYS.OLS$GROUPS.GROUP#%TYPE;
< BEGIN
<   IF GROUP_CODE IS NULL THEN
<      RETURN NULL;
<   ELSE
<      SELECT GROUP# INTO GROUP_NUM
<      FROM LBACSYS.OLS$GROUPS
<      WHERE POL# = POL_ID AND CODE = GROUP_CODE;
<      RETURN GROUP_NUM;
<   END IF;
< EXCEPTION
<   WHEN NO_DATA_FOUND THEN 
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
<      UNDEFINED_GROUP_EC, GROUP_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
< END GET_GROUP; 
< 
< 
< 
< FUNCTION SET_INVERSE_POLICY_BIT(POL_ID PLS_INTEGER)
< RETURN PLS_INTEGER IS
< BEGIN
<   
<   IF LBACSYS.LBAC_CACHE.INVERSE_GROUP(POL_ID) THEN
<     RETURN 4;
<   END IF;
< 
<   RETURN 0;
< END SET_INVERSE_POLICY_BIT;
< 
< FUNCTION TO_PRIVS ( POLICY_NAME VARCHAR2,
<                      PRIVILEGES VARCHAR2)
< RETURN NUMBER IS
<  PRIVS NUMBER := 0;
<  POS        PLS_INTEGER; 
<  REST       VARCHAR2(255);
<  PRIV       VARCHAR2(30);
<  PRIV_NUM   PLS_INTEGER;
<  TYPE PRIV_IDX_TAB  IS TABLE OF  PLS_INTEGER
<  INDEX BY PLS_INTEGER;          
<  PRIV_ARR PRIV_IDX_TAB;
<  I NUMBER;
< 
< BEGIN
<   POS := 0;
<   REST := PRIVILEGES;
<   
<   WHILE REST IS NOT NULL LOOP
<      POS := INSTR(REST,',');
<      IF POS = 0 THEN
<         PRIV:=REST;
<         REST:=NULL;
<      ELSE
<         PRIV:=SUBSTR(REST,1,POS-1);
<         REST:=SUBSTR(REST,POS+1);
<      END IF;
< 
<      EXECUTE IMMEDIATE 'BEGIN LBACSYS.' ||
<            LBACSYS.LBAC_CACHE.PACKAGE(POLICY_NAME) ||
<            '.validate_priv(:priv, :priv_number); END;'
<      USING
<         IN  PRIV,
<         OUT PRIV_NUM;
<      PRIV_ARR(PRIV_NUM) := 1;
< 
<      PRIVS := BITAND(PRIVS,PRIV_NUM); 
< 
<   END LOOP;  
< 
<   
< 
<   FOR I IN 1..7 LOOP
<      IF NOT (PRIV_ARR.EXISTS(I))  THEN
<         PRIV_ARR(I) :=0;
<      END IF;
<   END LOOP;
<   SELECT BIN_TO_NUM(PRIV_ARR(7), PRIV_ARR(6), PRIV_ARR(5), PRIV_ARR(4),
<              PRIV_ARR(3),PRIV_ARR(2),PRIV_ARR(1)) INTO PRIVS FROM SYS.DUAL;
< 
<   RETURN(PRIVS);
< 
< END TO_PRIVS;
< 
< PROCEDURE SET_USER_PRIVS_INTERNAL
<                         (POLICY_NAME IN VARCHAR2,
<                          USER_NAME   IN VARCHAR2,
<                          MR_LABEL    IN VARCHAR2,
<                          MW_LABEL    IN VARCHAR2,
<                          MIN_LABEL   IN VARCHAR2,
<                          READ_LABEL  IN VARCHAR2,
<                          WRITE_LABEL IN VARCHAR2,
<                          ROW_LABEL   IN VARCHAR2,
<                          PRIVS       IN PLS_INTEGER,
<                          STMT_TYPE   IN PLS_INTEGER)
< IS LANGUAGE C
<    NAME "zllusr_sup"
<    LIBRARY LBACSYS.LBAC$USER_LIBT
<    WITH CONTEXT
<    PARAMETERS (
<      CONTEXT,
<      POLICY_NAME STRING, POLICY_NAME LENGTH SIZE_T, POLICY_NAME INDICATOR SB2,
<      USER_NAME STRING, USER_NAME LENGTH SIZE_T, USER_NAME INDICATOR SB2,
<      MR_LABEL STRING, MR_LABEL LENGTH SIZE_T, MR_LABEL INDICATOR SB2,
<      MW_LABEL STRING, MW_LABEL LENGTH SIZE_T, MW_LABEL INDICATOR SB2,
<      MIN_LABEL STRING, MIN_LABEL LENGTH SIZE_T, MIN_LABEL INDICATOR SB2,
<      READ_LABEL STRING, READ_LABEL LENGTH SIZE_T, READ_LABEL INDICATOR SB2,
<      WRITE_LABEL STRING, WRITE_LABEL LENGTH SIZE_T, WRITE_LABEL INDICATOR SB2,
<      ROW_LABEL STRING, ROW_LABEL LENGTH SIZE_T, ROW_LABEL INDICATOR SB2,
<      PRIVS UB4, STMT_TYPE UB1
<      );
322,333c16
< CUNAME        VARCHAR2(1024);
< MINLVL_CODE   LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(MIN_LEVEL);
< MAXLVL_CODE   LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(MAX_LEVEL);
< DLVL_CODE     LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(DEF_LEVEL);
< RLVL_CODE     LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(ROW_LEVEL);
< POLID         LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
< MIN_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
< MAX_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
< DEF_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
< ROW_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
< I_NULL  CHAR(1);
< 
---
> INVOKER_USR VARCHAR2(1024);
335,390c18,26
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<   CHECK_USER(CUNAME);
< 
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   MAX_NUM := GET_LEVEL(POLID, MAXLVL_CODE);
<   IF MINLVL_CODE IS NULL THEN
<     SELECT MIN(LEVEL#) INTO MIN_NUM
<     FROM LBACSYS.OLS$LEVELS
<     WHERE POL#=POLID;
<   ELSE
<     MIN_NUM := GET_LEVEL(POLID, MINLVL_CODE);
<   END IF;
<   IF DLVL_CODE IS NULL THEN
<     DEF_NUM := MAX_NUM;
<   ELSE
<     DEF_NUM := GET_LEVEL(POLID, DLVL_CODE);
<   END IF;
<   IF RLVL_CODE IS NULL THEN
<     ROW_NUM := DEF_NUM;
<   ELSE
<     ROW_NUM := GET_LEVEL(POLID, RLVL_CODE);
<   END IF;
< 
< 
<   IF DEF_NUM < MIN_NUM THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<         INVALID_ARG_EC, 'def_level');
<   END IF;
< 
<   IF DEF_NUM > MAX_NUM THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<       PRODUCT, SA_FACILITY, INVALID_CLRN_RANGE_EC);
<   END IF;
< 
<   IF ROW_NUM < MIN_NUM OR ROW_NUM > DEF_NUM THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
<         INVALID_ARG_EC, 'row_level');
<   END IF;
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_LEVELS(POLID, CUNAME, MAX_NUM, 
<                                   MIN_NUM, DEF_NUM, ROW_NUM);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;  
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_LEVELS(POLICY_NAME, USER_NAME,
>                                        MAX_LEVEL, MIN_LEVEL,
>                                        DEF_LEVEL, ROW_LEVEL,
>                                        INVOKER_USR);
400,402c36
< CUNAME   VARCHAR2(1024);
< POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
< 
---
> INVOKER_USR VARCHAR2(1024);
404,426c38,46
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
< 
<   
<   CHECK_LEVELS(POLICY_NAME, CUNAME);
< 
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<   
<   LBACSYS.LBAC_LGSTNDBY_UTIL.SET_COMPARTMENTS(POLID, CUNAME, READ_COMPS,
<                                       WRITE_COMPS, DEF_COMPS, ROW_COMPS);
< 
<   LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_COMPARTMENTS(POLICY_NAME, USER_NAME,
>                                              READ_COMPS, WRITE_COMPS,
>                                              DEF_COMPS, ROW_COMPS,
>                                              INVOKER_USR);
436,437c56
< CUNAME     VARCHAR2(1024);
< POLID      LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
439,461c58,66
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<   
<   IF (ACCESS_MODE IS NULL) AND (IN_DEF IS NULL) AND (IN_ROW IS NULL) THEN
<     RETURN;  
<   END IF;
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.ALTER_COMPARTMENTS(POLID, CUNAME, COMPS,
<                                           ACCESS_MODE, IN_DEF, IN_ROW);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.ALTER_COMPARTMENTS(POLICY_NAME, USER_NAME,
>                                                COMPS, ACCESS_MODE,
>                                                IN_DEF, IN_ROW,
>                                                INVOKER_USR);
471,473c76
< CUNAME    VARCHAR2(1024);
< POLID     LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
< 
---
> INVOKER_USR VARCHAR2(1024);
475,497c78,86
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
< 
<   
<   CHECK_LEVELS(POLICY_NAME, CUNAME);
< 
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_GROUPS(POLID, CUNAME, READ_GROUPS,
<                                   WRITE_GROUPS, DEF_GROUPS, ROW_GROUPS);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_GROUPS(POLICY_NAME, USER_NAME,
>                                        READ_GROUPS, WRITE_GROUPS,
>                                        DEF_GROUPS, ROW_GROUPS,
>                                        INVOKER_USR);
507,509c96
< CUNAME     VARCHAR2(1024);
< POLID      LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
< 
---
> INVOKER_USR VARCHAR2(1024);
511,533c98,106
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   IF (ACCESS_MODE IS NULL) AND (IN_DEF IS NULL) AND (IN_ROW IS NULL) THEN
<     RETURN;  
<   END IF;
< 
<   
<   BEGIN
<     LBACSYS.LBAC_LGSTNDBY_UTIL.ALTER_GROUPS(POLID, CUNAME, GROUPS,
<                                     ACCESS_MODE, IN_DEF, IN_ROW);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.ALTER_GROUPS(POLICY_NAME, USER_NAME,
>                                          GROUPS, ACCESS_MODE,
>                                          IN_DEF, IN_ROW,
>                                          INVOKER_USR);
543,544c116
< CUNAME     VARCHAR2(1024);
< POLID      LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
546,564c118,126
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<  
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.ADD_COMPARTMENTS(POLID, CUNAME, COMPS,
<                                         ACCESS_MODE, IN_DEF, IN_ROW);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.ADD_COMPARTMENTS(POLICY_NAME, USER_NAME,
>                                              COMPS, ACCESS_MODE,
>                                              IN_DEF, IN_ROW,
>                                              INVOKER_USR);
571,572c133
< CUNAME   VARCHAR2(1024);
< POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
574,577c135,138
< 
<   IF COMPS IS NULL THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       INVALID_ARG_EC, 'comps');
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
579,596c140,141
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_COMPARTMENTS(POLID, CUNAME, COMPS);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   LBACSYS.SA_USER_ADMIN_INT.DROP_COMPARTMENTS(POLICY_NAME, USER_NAME,
>                                               COMPS, INVOKER_USR);
603,604c148
< CUNAME   VARCHAR2(1024);
< POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
606,623c150,156
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_ALL_COMPARTMENTS(POLID, CUNAME);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.DROP_ALL_COMPARTMENTS(POLICY_NAME, USER_NAME,
>                                                   INVOKER_USR);
633,634c166
< CUNAME      VARCHAR2(1024);
< POLID       LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
636,654c168,176
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.ADD_GROUPS(POLID, CUNAME, GROUPS,
<                                   ACCESS_MODE, IN_DEF, IN_ROW); 
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.ADD_GROUPS(POLICY_NAME, USER_NAME,
>                                        GROUPS, ACCESS_MODE,
>                                        IN_DEF, IN_ROW,
>                                        INVOKER_USR);
661,662c183
< CUNAME   VARCHAR2(1024);
< POLID    LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
664,667c185,188
< 
<   IF GROUPS IS NULL THEN
<     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
<       INVALID_ARG_EC, 'groups');
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
669,686c190,191
< 
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_GROUPS(POLID, CUNAME, GROUPS);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   LBACSYS.SA_USER_ADMIN_INT.DROP_GROUPS(POLICY_NAME, USER_NAME,
>                                         GROUPS, INVOKER_USR);
692,693c197
< CUNAME   VARCHAR2(1024);
< POLID    LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
---
> INVOKER_USR VARCHAR2(1024);
695,711c199,205
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   CHECK_USER(CUNAME);
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_ALL_GROUPS(POLID, CUNAME);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.DROP_ALL_GROUPS(POLICY_NAME, USER_NAME,
>                                             INVOKER_USR);
723,732c217
< CUNAME      VARCHAR2(1024);
< POLID       LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
< MAX_RD_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
< MAX_WT_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
< MIN_WT_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
< DF_LAB      LBACSYS.OLS$LAB.ILABEL%TYPE;
< RW_LAB      LBACSYS.OLS$LAB.ILABEL%TYPE;
< MIN_LVL     PLS_INTEGER;
< I_NULL      VARCHAR2(1);
< 
---
> INVOKER_USR VARCHAR2(1024);
734,810c219,227
<   CHECK_POLICY(POLICY_NAME);
< 
<   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   ELSE
<     CUNAME := UPPER(USER_NAME);
<   END IF;
<   CHECK_USER(CUNAME);
< 
<   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
< 
<   CHECK_COMMON(CUNAME, NULL, USER_OBJ_TYPE);
< 
< 
<   MAX_RD_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_READ_LABEL);
< 
< 
<   IF MAX_WRITE_LABEL IS NULL THEN
<      MAX_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_READ_LABEL);
<   ELSE 
<      MAX_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_WRITE_LABEL);
<   END IF;
< 
< 
<   IF MIN_WRITE_LABEL IS NULL THEN
<   
<   
<      SELECT MIN(LEVEL#) INTO MIN_LVL 
<      FROM LBACSYS.OLS$LEVELS
<      WHERE POL# = POLID;
< 
<   ELSE
<      MIN_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MIN_WRITE_LABEL);
<      MIN_LVL := LBACSYS.LBAC$SA_LABELS.LABEL_LEVEL_ONLY(MIN_WT_LAB);
<   END IF;
< 
< 
<   IF DEF_LABEL IS NULL THEN
<     DF_LAB := MAX_RD_LAB;
<   ELSE
<     DF_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, DEF_LABEL);
<   END IF;
< 
< 
<   IF ROW_LABEL IS NULL THEN
<     RW_LAB :=LBACSYS.LBAC$SA_LABELS.COMPUTE_WRITE_LABEL(POLID, MAX_WT_LAB, DF_LAB);
<   ELSE
<     RW_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, ROW_LABEL);
<   END IF;
< 
< 
<   LBACSYS.LBAC_LGSTNDBY_UTIL.SET_USER_LABELS(POLID, CUNAME, MAX_RD_LAB,
<                                      MAX_WT_LAB,
<                                      MIN_LVL, DF_LAB, RW_LAB);  
<   LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
<   COMMIT;
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXRD, MAX_READ_LABEL);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXWRT, MAX_WRITE_LABEL);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MINWRT, MIN_WRITE_LABEL);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXRD, MAX_READ_LABEL);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXWRT, MAX_WRITE_LABEL);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MINWRT, MIN_WRITE_LABEL);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_USER_LABELS(POLICY_NAME, USER_NAME,
>                                             MAX_READ_LABEL, MAX_WRITE_LABEL,
>                                             MIN_WRITE_LABEL, DEF_LABEL,
>                                             ROW_LABEL, INVOKER_USR);
814,941d230
< 
< FUNCTION MAX_READ_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER     PLS_INTEGER;
< CUNAME         LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< MAX_READ_LABEL LBACSYS.OLS$PROFILE.MAX_READ%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT MAX_READ INTO MAX_READ_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN MAX_READ_LABEL;
< END MAX_READ_LABEL;
< 
< FUNCTION MAX_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER      PLS_INTEGER;
< CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< MAX_WRITE_LABEL LBACSYS.OLS$PROFILE.MAX_WRITE%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT MAX_WRITE INTO MAX_WRITE_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN MAX_WRITE_LABEL;
< END MAX_WRITE_LABEL;
< 
< FUNCTION MIN_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER      PLS_INTEGER;
< CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< MIN_WRITE_LABEL LBACSYS.OLS$PROFILE.MIN_WRITE%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT MIN_WRITE INTO MIN_WRITE_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN MIN_WRITE_LABEL;
< END MIN_WRITE_LABEL;
< 
< FUNCTION DEFAULT_READ_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER     PLS_INTEGER;
< CUNAME         LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< DEF_READ_LABEL LBACSYS.OLS$PROFILE.DEF_READ%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT DEF_READ INTO DEF_READ_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN DEF_READ_LABEL;
< END DEFAULT_READ_LABEL;
< 
< FUNCTION DEFAULT_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER      PLS_INTEGER;
< CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< DEF_WRITE_LABEL LBACSYS.OLS$PROFILE.DEF_WRITE%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT DEF_WRITE INTO DEF_WRITE_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN DEF_WRITE_LABEL;
< END DEFAULT_WRITE_LABEL;
< 
< FUNCTION DEFAULT_ROW_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
< RETURN VARCHAR2 IS
< POL_NUMBER    PLS_INTEGER;
< CUNAME        LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< DEF_ROW_LABEL LBACSYS.OLS$PROFILE.DEF_ROW%TYPE;
< BEGIN
<    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
<       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
<             NO_POLICY_EC,POLICY_NAME);
<    END IF;
<    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
< 
<    SELECT DEF_ROW INTO DEF_ROW_LABEL
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
<    U.POL# = P.POL# AND U.PROFID = P.PROFID;
< 
<    RETURN DEF_ROW_LABEL;
< END DEFAULT_ROW_LABEL;
< 
< 
947,951c236,237
<  IS
< UNAME LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< POLID LBACSYS.OLS$POL.POL#%TYPE;
< DEF_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
< 
---
> IS
> INVOKER_USR VARCHAR2(1024);
953,971c239,245
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
<   CHECK_USER(UNAME);
<   POLID:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   DEF_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, DEF_LABEL);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_DEFAULT_LABEL(POLID, UNAME, DEF_LAB);  
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, UNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_DEFAULT_LABEL(POLICY_NAME, USER_NAME,
>                                               DEF_LABEL, INVOKER_USR);
980,983c254
< UNAME LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< POLID LBACSYS.OLS$POL.POL#%TYPE;
< ROW_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
< 
---
> INVOKER_USR VARCHAR2(1024);
985,1003c256,262
<   CHECK_POLICY(POLICY_NAME);
<   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
<   CHECK_USER(UNAME);
<   POLID:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   ROW_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, ROW_LABEL);
< 
<   BEGIN
<     
<     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_ROW_LABEL(POLID, UNAME, ROW_LAB);
< 
<     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, UNAME);
<   EXCEPTION
<     WHEN OTHERS THEN
<       ROLLBACK;
<       RAISE;
<   END;
< 
<   COMMIT;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_ROW_LABEL(POLICY_NAME, USER_NAME,
>                                           ROW_LABEL, INVOKER_USR);
1008,1046d266
< PROCEDURE DROP_LABELS(POLICY_NAME      IN VARCHAR2,
<                       USER_NAME        IN VARCHAR2)
< IS
< CURR_PRIVS     PLS_INTEGER := 0 ;
< POL_NUM        PLS_INTEGER;
< STMT_TYPE      PLS_INTEGER;
< BEGIN
<   CHECK_POLICY(POLICY_NAME);
<   CHECK_USER(USER_NAME);
<   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
< 
<   DELETE FROM LBACSYS.OLS$USER_LEVELS 
<   WHERE USR_NAME = USER_NAME AND POL#=POL_NUM;
< 
<  BEGIN
<    SELECT PRIVS INTO CURR_PRIVS
<    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<    WHERE USR_NAME = USER_NAME AND U.POL# = POL_NUM
<    AND U.POL# = P.POL# AND U.PROFID = P.PROFID;
<  EXCEPTION
<    WHEN NO_DATA_FOUND THEN
<      RETURN;
<  END;
<   
< 
<  IF CURR_PRIVS = 0 THEN
<    STMT_TYPE := DELETE_TYPE;
<  ELSE 
<    STMT_TYPE := UPDATE_TYPE;
<  END IF;
< 
<  LBACSYS.LBAC$SA_LABELS.STORE_USER(POLICY_NAME, USER_NAME,
<                            NULL, NULL, NULL, NULL,
<                            NULL, NULL, CURR_PRIVS, STMT_TYPE);
< END DROP_LABELS;
< 
< 
< 
1050,1062c270
< UNAME            LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
< POL_NUM          PLS_INTEGER;
< OLD_MAX_READ     LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< OLD_MAX_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< OLD_MIN_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< OLD_DEF_READ     LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< OLD_DEF_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< OLD_DEF_ROW      LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
< NO_OLD_PRIVS     BOOLEAN;
< OLD_PRIVS        NUMBER;
< NEW_PRIVS        NUMBER;
< PROFILE_ID       NUMBER;
< STMT_TYPE        PLS_INTEGER;
---
> INVOKER_USR VARCHAR2(1024);
1064,1068c272,275
<   CHECK_POLICY(POLICY_NAME);
<   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
<   ELSE
<     UNAME := UPPER(USER_NAME);
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
1070,1132c277,278
< 
<   
<   
<   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
< 
<   CHECK_COMMON(UNAME, NULL, USER_OBJ_TYPE);
< 
< 
<    NO_OLD_PRIVS := FALSE;
<    BEGIN
<      SELECT MAX_READ, MAX_WRITE, MIN_WRITE, DEF_READ, DEF_WRITE,
<             DEF_ROW, PRIVS
<      INTO OLD_MAX_READ, OLD_MAX_WRITE, OLD_MIN_WRITE, OLD_DEF_READ, 
<           OLD_DEF_WRITE, OLD_DEF_ROW, OLD_PRIVS
<      FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
<      WHERE USR_NAME = UNAME AND U.POL# = POL_NUM 
<            AND U.POL# = P.POL# AND U.PROFID = P.PROFID;
<    EXCEPTION
<      WHEN NO_DATA_FOUND THEN
< 
<        IF PRIVILEGES IS NULL THEN
<          RETURN;
<        ELSE
<          NO_OLD_PRIVS := TRUE;
<          OLD_PRIVS := 0;
<        END IF;
<    END;
< 
< 
< 
<   NEW_PRIVS := TO_PRIVS(POLICY_NAME,PRIVILEGES);
< 
< 
< 
< 
<    IF NO_OLD_PRIVS THEN
<      STMT_TYPE := INSERT_TYPE;
<    ELSIF OLD_MAX_READ IS NULL AND PRIVILEGES IS  NULL THEN
<      STMT_TYPE := DELETE_TYPE;
<    ELSE
<      STMT_TYPE := UPDATE_TYPE;
<    END IF;
< 
<    SET_USER_PRIVS_INTERNAL(POLICY_NAME, UNAME, OLD_MAX_READ, OLD_MAX_WRITE,
<                            OLD_MIN_WRITE, OLD_DEF_READ, OLD_DEF_WRITE,
<                            OLD_DEF_ROW, NEW_PRIVS, STMT_TYPE);
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   LBACSYS.SA_USER_ADMIN_INT.SET_USER_PRIVS(POLICY_NAME, USER_NAME,
>                                            PRIVILEGES, INVOKER_USR);
1141,1149c287
< POL_NUM        PLS_INTEGER;
< PGM_CNT        PLS_INTEGER;
< ROW_CNT        PLS_INTEGER;
< NO_OLD_PRIVS   BOOLEAN;
< OLD_PRIVS      NUMBER;
< NEW_PRIVS      NUMBER;
< CPNAME         LBACSYS.OLS$PROG.PGM_NAME%TYPE;
< CSNAME         LBACSYS.OLS$PROG.OWNER%TYPE;
< 
---
> INVOKER_USR VARCHAR2(1024);
1151,1257c289,296
<    CHECK_POLICY(POLICY_NAME);
<    
<    IF SCHEMA_NAME IS NULL THEN
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<              PRODUCT, SA_FACILITY, INVALID_PARAMS_EC, 'schema name');
<    ELSIF PROGRAM_UNIT_NAME IS NULL THEN
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<              PRODUCT, SA_FACILITY, INVALID_PARAMS_EC, 'program name');
<    END IF;
< 
< 
<    IF (LBACSYS.LBAC_CACHE.FAILEDSTARTUP(POLICY_NAME)) THEN
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<              PRODUCT, SA_FACILITY, STARTUP_FAILURE_EC, POLICY_NAME);
<    END IF;
<    POL_NUM:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
<                                               CSNAME);
<    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(PROGRAM_UNIT_NAME,
<                                      'program unit name', CPNAME);
< 
< 
<   CHECK_COMMON(CSNAME, CPNAME, PROC_OBJ_TYPE);
< 
< 
<    
<    
<    SELECT COUNT(*) INTO PGM_CNT
<    FROM SYS.OBJ$ O, SYS."_BASE_USER" U
<    WHERE O.NAME = CPNAME 
<    AND U.NAME = CSNAME 
<    AND O.OWNER# = U.USER#
<    AND O.TYPE# IN (7,8,9);
< 
<    IF (PGM_CNT != 1) THEN
<      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
<        PRODUCT, SA_FACILITY, NO_PROG_EC, 
<        (SCHEMA_NAME || '.' || PROGRAM_UNIT_NAME));
<    END IF;
< 
< 
<    NO_OLD_PRIVS := FALSE;
<    BEGIN
<      SELECT PRIVS INTO OLD_PRIVS
<      FROM LBACSYS.OLS$PROG
<      WHERE CPNAME = PGM_NAME AND
<            OWNER = CSNAME AND
<            POL# = POL_NUM;
<    EXCEPTION
<      WHEN  NO_DATA_FOUND THEN
< 
<        IF PRIVILEGES IS NULL THEN
<          RETURN;
<        ELSE
<          NO_OLD_PRIVS := TRUE;
<          OLD_PRIVS := NULL;
<        END IF;
<    END;
< 
<    NEW_PRIVS := TO_PRIVS(POLICY_NAME,PRIVILEGES);
< 
< 
< 
< 
<    IF NO_OLD_PRIVS THEN
< 
<      LBACSYS.LBAC_STANDARD.SET_TRUSTED_PROG(CSNAME,CPNAME);
<      INSERT INTO LBACSYS.OLS$PROG VALUES (POL_NUM,CPNAME,
<                           CSNAME, NEW_PRIVS);
<   ELSIF PRIVILEGES IS NULL THEN
<      LBACSYS.LBAC_STANDARD.RESET_TRUSTED_PROG(CSNAME,CPNAME);
<      DELETE FROM LBACSYS.OLS$PROG 
<      WHERE POL#=POL_NUM AND PGM_NAME=CPNAME
<             AND OWNER=CSNAME;
<    ELSE 
< 
<      LBACSYS.LBAC_STANDARD.SET_TRUSTED_PROG(CSNAME,CPNAME);
<      UPDATE LBACSYS.OLS$PROG SET PRIVS = NEW_PRIVS
<      WHERE POL#=POL_NUM AND
<             PGM_NAME=CPNAME AND 
<             OWNER=CSNAME;
<    END IF;
< 
<    COMMIT;  
<    
< 
<    LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME, SET_ACTION, TRUE,
<      'SET PROGRAM PRIVILEGES');
< 
< 
<    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCHEMA_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PROGRAM, PROGRAM_UNIT_NAME);
<      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
<      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<    END IF;
< EXCEPTION
<   WHEN OTHERS THEN
<     
<     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCHEMA_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PROGRAM, PROGRAM_UNIT_NAME);
<       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
<       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
<     END IF;
<     RAISE;
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
>   END IF;
>   LBACSYS.SA_USER_ADMIN_INT.SET_PROG_PRIVS(POLICY_NAME, SCHEMA_NAME,
>                                            PROGRAM_UNIT_NAME, PRIVILEGES,
>                                            INVOKER_USR);
1263,1266c302,303
<                      USER_NAME        IN VARCHAR2) IS
< 
< POL_NUM PLS_INTEGER := 0;
< CUNAME VARCHAR2(1024);
---
>                             USER_NAME        IN VARCHAR2) IS
> INVOKER_USR VARCHAR2(1024);
1268,1271c305,308
<   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
<     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
<   ELSE
<     CUNAME := UPPER(USER_NAME);
---
>   INVOKER_USR := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   IF (INVOKER_USR = 'XS$NULL') THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>                                                NOT_ALLOWED_EC);
1273,1279c310,311
< 
<   DROP_LABELS(POLICY_NAME, CUNAME);
<   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
< 
<   LBACSYS.LBAC$SA_LABELS.STORE_USER(POLICY_NAME, CUNAME,
<                            NULL, NULL, NULL, NULL,
<                            NULL, NULL, 0, DELETE_TYPE);
---
>   LBACSYS.SA_USER_ADMIN_INT.DROP_USER_ACCESS(POLICY_NAME, USER_NAME,
>                                              INVOKER_USR);
LBACSYS.SA_USER_ADMIN_INT - PACKAGE BODY (RU):
0a1,1302
> PACKAGE BODY sa_user_admin_int AS
> 
> 
> 
> PRODUCT       CONSTANT VARCHAR2(12) := 'TRUSTED';
> LBAC_FACILITY CONSTANT VARCHAR2(12) := 'LBAC';
> SA_FACILITY   CONSTANT VARCHAR2(12) := 'SA';
> SA_PACKAGE    CONSTANT VARCHAR2(12) := 'LBAC$SA';
> INV_BIT       CONSTANT PLS_INTEGER  := 4;
> GRP_BIT       CONSTANT PLS_INTEGER := 2;
> 
> LVER    CONSTANT PLS_INTEGER := 1;  
> LVL_BIT CONSTANT PLS_INTEGER := 0;  
> CMP_BIT CONSTANT PLS_INTEGER := 1;
> LSEP    CONSTANT VARCHAR2(1) := '.'; 
> 
> INVALID_LABEL_LIST_EC   CONSTANT PLS_INTEGER := 12405;
> UNAUTHORIZED_OP_EC      CONSTANT PLS_INTEGER := 12407;
> NO_POLICY_EC            CONSTANT PLS_INTEGER := 12416;
> NO_USER_EC              CONSTANT PLS_INTEGER := 12418;
> NO_OLS_EC               CONSTANT PLS_INTEGER := 12458;
> UNDEFINED_LEVEL_EC      CONSTANT PLS_INTEGER := 12461;
> INVALID_CLRN_RANGE_EC   CONSTANT PLS_INTEGER := 12466;
> UNDEFINED_COMP_EC       CONSTANT PLS_INTEGER := 12462;
> UNDEFINED_GROUP_EC      CONSTANT PLS_INTEGER := 12463;
> SYS_USER_EC             CONSTANT PLS_INTEGER := 12432;
> INVALID_SCHEMA_EC       CONSTANT PLS_INTEGER := 12425;
> INVALID_ARG_EC          CONSTANT PLS_INTEGER := 12427;
> NO_DEFINED_LEVELS_EC    CONSTANT PLS_INTEGER := 12469;
> INVALID_LABEL_EC        CONSTANT PLS_INTEGER := 12470; 
> NO_PROG_EC              CONSTANT PLS_INTEGER := 12417;
> INVALID_COMPS_GRPS_EC   CONSTANT PLS_INTEGER := 12465;
> 
> INVALID_PARAMS_EC  CONSTANT PLS_INTEGER := 12427;
> STARTUP_FAILURE_EC CONSTANT PLS_INTEGER := 12409;
> 
> SET_ACTION       CONSTANT PLS_INTEGER := 4;
> 
> 
> 
> SET_AUTH_ACTION  CONSTANT PLS_INTEGER := 3;
> 
> 
> 
> AUDINFO_OBJOWNER   CONSTANT PLS_INTEGER := 0;
> AUDINFO_GRANTEE    CONSTANT PLS_INTEGER := 2;
> AUDINFO_MAXRD      CONSTANT PLS_INTEGER := 3;
> AUDINFO_MAXWRT     CONSTANT PLS_INTEGER := 4;
> AUDINFO_MINWRT     CONSTANT PLS_INTEGER := 5;
> AUDINFO_PRIVGRNTED CONSTANT PLS_INTEGER := 6;
> AUDINFO_PROGRAM    CONSTANT PLS_INTEGER := 7;
> 
> 
> INSERT_TYPE    CONSTANT PLS_INTEGER := 2;    
> UPDATE_TYPE    CONSTANT PLS_INTEGER := 6;    
> DELETE_TYPE    CONSTANT PLS_INTEGER := 7;    
> 
> 
> TABLE_OBJ_TYPE CONSTANT PLS_INTEGER := 1;  
> PROC_OBJ_TYPE  CONSTANT PLS_INTEGER := 2;  
> 
> USER_OBJ_TYPE  CONSTANT PLS_INTEGER := 3;  
> 
> 
> 
> TYPE LAB_SORT_T IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;
> 
> 
> 
> 
> 
> 
> 
> PROCEDURE CHECK_POLICY(POLICY_NAME IN VARCHAR2) IS
> BEGIN
> 
> 
>   IF LBACSYS.LBAC_CACHE.CHECK_POLICYROLE(POLICY_NAME, NULL) = FALSE THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       UNAUTHORIZED_OP_EC, POLICY_NAME);
>   END IF;
>   
> 
>   IF LBACSYS.LBAC_CACHE.PACKAGE(POLICY_NAME) != SA_PACKAGE THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       NO_POLICY_EC, POLICY_NAME, TRUE);
>   END IF;
>   
> END CHECK_POLICY;
> 
> 
> 
> PROCEDURE CHECK_LEVELS(POLICY_NAME IN VARCHAR2,
>                        USER_NAME IN VARCHAR2) IS
> I_NULL     CHAR(1);
> POL_NUMBER LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
> 
> BEGIN
>     POL_NUMBER := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
> 
>     SELECT NULL INTO I_NULL
>     FROM LBACSYS.OLS$USER_LEVELS
>     WHERE POL# = POL_NUMBER AND USR_NAME = USER_NAME;
> EXCEPTION
>   WHEN NO_DATA_FOUND THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       NO_DEFINED_LEVELS_EC, USER_NAME, POLICY_NAME);
> END CHECK_LEVELS;
> 
> 
> 
> PROCEDURE CHECK_USER(UNAME IN VARCHAR2) IS
> I_NULL CHAR(1);
> 
> BEGIN
>     IF UNAME IN ('SYS','LBACSYS','SYSTEM') THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       INVALID_SCHEMA_EC);
>     END IF;
> END CHECK_USER;
> 
> 
> 
> PROCEDURE CHECK_COMMON(UNAME       IN VARCHAR2,
>                        OBJECT      IN VARCHAR2,
>                        OBJTYP      IN PLS_INTEGER,
>                        INVOKER_USR IN VARCHAR2)
> IS LANGUAGE C
>    NAME "zllsesFedChk1"
>    LIBRARY LBACSYS.OLS$SESSION_LIBT
>    PARAMETERS (
>      UNAME STRING, UNAME LENGTH SIZE_T, UNAME INDICATOR SB2,
>      OBJECT STRING, OBJECT LENGTH SIZE_T, OBJECT INDICATOR SB2,
>      OBJTYP UB1, OBJTYP INDICATOR SB2,
>      INVOKER_USR STRING, INVOKER_USR LENGTH SIZE_T,
>      INVOKER_USR INDICATOR SB2
>      );
> 
> 
> 
> FUNCTION GET_LEVEL (POL_ID     IN PLS_INTEGER, 
>                     LEVEL_CODE IN VARCHAR2)
> RETURN PLS_INTEGER IS
>   LEVEL_NUM LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
> BEGIN
>     IF LEVEL_CODE IS NULL THEN
>        RETURN NULL;
>     ELSE
>        SELECT LEVEL# INTO LEVEL_NUM
>        FROM LBACSYS.OLS$LEVELS
>        WHERE POL# = POL_ID AND CODE = LEVEL_CODE;
>        RETURN LEVEL_NUM;
>     END IF;
>   EXCEPTION
>     WHEN NO_DATA_FOUND THEN 
>        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
>        UNDEFINED_LEVEL_EC, LEVEL_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
> END GET_LEVEL; 
> 
> FUNCTION GET_LEVEL (POL_ID     IN PLS_INTEGER,
>                     LEVEL_NUM  IN PLS_INTEGER)
> RETURN VARCHAR2 IS
>   LEVEL_CODE LBACSYS.OLS$LEVELS.CODE%TYPE;
> BEGIN
>     IF LEVEL_NUM IS NULL THEN
>        RETURN NULL;
>     ELSE
>        SELECT CODE INTO LEVEL_CODE
>        FROM LBACSYS.OLS$LEVELS
>        WHERE POL# = POL_ID AND LEVEL# = LEVEL_NUM;
>        RETURN LEVEL_CODE;
>     END IF;
>   EXCEPTION
>     WHEN NO_DATA_FOUND THEN
>        LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>        UNDEFINED_LEVEL_EC, LEVEL_NUM, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
> END GET_LEVEL;
> 
> 
> 
> FUNCTION GET_COMP  (POL_ID     IN PLS_INTEGER, 
>                     COMP_CODE IN VARCHAR2)
> RETURN PLS_INTEGER IS
>   COMP_NUM LBACSYS.OLS$COMPARTMENTS.COMP#%TYPE;
> BEGIN
>   IF COMP_CODE IS NULL THEN
>      RETURN NULL;
>   ELSE
>      SELECT COMP# INTO COMP_NUM
>      FROM LBACSYS.OLS$COMPARTMENTS
>      WHERE POL# = POL_ID AND CODE = COMP_CODE;
>      RETURN COMP_NUM;
>   END IF;
> EXCEPTION
>   WHEN NO_DATA_FOUND THEN 
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
>      UNDEFINED_COMP_EC, COMP_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
> END GET_COMP; 
> 
> 
> 
> FUNCTION GET_GROUP (POL_ID     IN PLS_INTEGER, 
>                     GROUP_CODE IN VARCHAR2)
> RETURN PLS_INTEGER IS
>   GROUP_NUM LBACSYS.OLS$GROUPS.GROUP#%TYPE;
> BEGIN
>   IF GROUP_CODE IS NULL THEN
>      RETURN NULL;
>   ELSE
>      SELECT GROUP# INTO GROUP_NUM
>      FROM LBACSYS.OLS$GROUPS
>      WHERE POL# = POL_ID AND CODE = GROUP_CODE;
>      RETURN GROUP_NUM;
>   END IF;
> EXCEPTION
>   WHEN NO_DATA_FOUND THEN 
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
>      UNDEFINED_GROUP_EC, GROUP_CODE, LBACSYS.LBAC_CACHE.POLICY_NAME(POL_ID));
> END GET_GROUP; 
> 
> 
> 
> FUNCTION SET_INVERSE_POLICY_BIT(POL_ID PLS_INTEGER)
> RETURN PLS_INTEGER IS
> BEGIN
>   
>   IF LBACSYS.LBAC_CACHE.INVERSE_GROUP(POL_ID) THEN
>     RETURN 4;
>   END IF;
> 
>   RETURN 0;
> END SET_INVERSE_POLICY_BIT;
> 
> FUNCTION TO_PRIVS ( POLICY_NAME VARCHAR2,
>                      PRIVILEGES VARCHAR2)
> RETURN NUMBER IS
>  PRIVS NUMBER := 0;
>  POS        PLS_INTEGER; 
>  REST       VARCHAR2(255);
>  PRIV       VARCHAR2(30);
>  PRIV_NUM   PLS_INTEGER;
>  TYPE PRIV_IDX_TAB  IS TABLE OF  PLS_INTEGER
>  INDEX BY PLS_INTEGER;          
>  PRIV_ARR PRIV_IDX_TAB;
>  I NUMBER;
> 
> BEGIN
>   POS := 0;
>   REST := PRIVILEGES;
>   
>   WHILE REST IS NOT NULL LOOP
>      POS := INSTR(REST,',');
>      IF POS = 0 THEN
>         PRIV:=REST;
>         REST:=NULL;
>      ELSE
>         PRIV:=SUBSTR(REST,1,POS-1);
>         REST:=SUBSTR(REST,POS+1);
>      END IF;
> 
>      EXECUTE IMMEDIATE 'BEGIN LBACSYS.' ||
>            LBACSYS.LBAC_CACHE.PACKAGE(POLICY_NAME) ||
>            '.validate_priv(:priv, :priv_number); END;'
>      USING
>         IN  PRIV,
>         OUT PRIV_NUM;
>      PRIV_ARR(PRIV_NUM) := 1;
> 
>      PRIVS := BITAND(PRIVS,PRIV_NUM); 
> 
>   END LOOP;  
> 
>   
> 
>   FOR I IN 1..7 LOOP
>      IF NOT (PRIV_ARR.EXISTS(I))  THEN
>         PRIV_ARR(I) :=0;
>      END IF;
>   END LOOP;
>   SELECT BIN_TO_NUM(PRIV_ARR(7), PRIV_ARR(6), PRIV_ARR(5), PRIV_ARR(4),
>              PRIV_ARR(3),PRIV_ARR(2),PRIV_ARR(1)) INTO PRIVS FROM SYS.DUAL;
> 
>   RETURN(PRIVS);
> 
> END TO_PRIVS;
> 
> PROCEDURE SET_USER_PRIVS_INTERNAL
>                         (POLICY_NAME IN VARCHAR2,
>                          USER_NAME   IN VARCHAR2,
>                          MR_LABEL    IN VARCHAR2,
>                          MW_LABEL    IN VARCHAR2,
>                          MIN_LABEL   IN VARCHAR2,
>                          READ_LABEL  IN VARCHAR2,
>                          WRITE_LABEL IN VARCHAR2,
>                          ROW_LABEL   IN VARCHAR2,
>                          PRIVS       IN PLS_INTEGER,
>                          STMT_TYPE   IN PLS_INTEGER)
> IS LANGUAGE C
>    NAME "zllusr_sup"
>    LIBRARY LBACSYS.LBAC$USER_LIBT
>    WITH CONTEXT
>    PARAMETERS (
>      CONTEXT,
>      POLICY_NAME STRING, POLICY_NAME LENGTH SIZE_T, POLICY_NAME INDICATOR SB2,
>      USER_NAME STRING, USER_NAME LENGTH SIZE_T, USER_NAME INDICATOR SB2,
>      MR_LABEL STRING, MR_LABEL LENGTH SIZE_T, MR_LABEL INDICATOR SB2,
>      MW_LABEL STRING, MW_LABEL LENGTH SIZE_T, MW_LABEL INDICATOR SB2,
>      MIN_LABEL STRING, MIN_LABEL LENGTH SIZE_T, MIN_LABEL INDICATOR SB2,
>      READ_LABEL STRING, READ_LABEL LENGTH SIZE_T, READ_LABEL INDICATOR SB2,
>      WRITE_LABEL STRING, WRITE_LABEL LENGTH SIZE_T, WRITE_LABEL INDICATOR SB2,
>      ROW_LABEL STRING, ROW_LABEL LENGTH SIZE_T, ROW_LABEL INDICATOR SB2,
>      PRIVS UB4, STMT_TYPE UB1
>      );
> 
> 
> 
> 
> PROCEDURE SET_LEVELS       (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             MAX_LEVEL        IN VARCHAR2,
>                             MIN_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             DEF_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             ROW_LEVEL        IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME        VARCHAR2(1024);
> MINLVL_CODE   LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(MIN_LEVEL);
> MAXLVL_CODE   LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(MAX_LEVEL);
> DLVL_CODE     LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(DEF_LEVEL);
> RLVL_CODE     LBACSYS.OLS$LEVELS.CODE%TYPE := UPPER(ROW_LEVEL);
> POLID         LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
> MIN_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
> MAX_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
> DEF_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
> ROW_NUM       LBACSYS.OLS$LEVELS.LEVEL#%TYPE;
> I_NULL  CHAR(1);
> 
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>   CHECK_USER(CUNAME);
> 
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   MAX_NUM := GET_LEVEL(POLID, MAXLVL_CODE);
>   IF MINLVL_CODE IS NULL THEN
>     SELECT MIN(LEVEL#) INTO MIN_NUM
>     FROM LBACSYS.OLS$LEVELS
>     WHERE POL#=POLID;
>   ELSE
>     MIN_NUM := GET_LEVEL(POLID, MINLVL_CODE);
>   END IF;
>   IF DLVL_CODE IS NULL THEN
>     DEF_NUM := MAX_NUM;
>   ELSE
>     DEF_NUM := GET_LEVEL(POLID, DLVL_CODE);
>   END IF;
>   IF RLVL_CODE IS NULL THEN
>     ROW_NUM := DEF_NUM;
>   ELSE
>     ROW_NUM := GET_LEVEL(POLID, RLVL_CODE);
>   END IF;
> 
> 
>   IF DEF_NUM < MIN_NUM THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>         INVALID_ARG_EC, 'def_level');
>   END IF;
> 
>   IF DEF_NUM > MAX_NUM THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>       PRODUCT, SA_FACILITY, INVALID_CLRN_RANGE_EC);
>   END IF;
> 
>   IF ROW_NUM < MIN_NUM OR ROW_NUM > DEF_NUM THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY, 
>         INVALID_ARG_EC, 'row_level');
>   END IF;
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_LEVELS(POLID, CUNAME, MAX_NUM, 
>                                   MIN_NUM, DEF_NUM, ROW_NUM);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;  
> END SET_LEVELS;
> 
> 
> PROCEDURE SET_COMPARTMENTS (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             READ_COMPS       IN VARCHAR2,
>                             WRITE_COMPS      IN VARCHAR2 DEFAULT NULL,
>                             DEF_COMPS        IN VARCHAR2 DEFAULT NULL,
>                             ROW_COMPS        IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME   VARCHAR2(1024);
> POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
> 
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
> 
>   
>   CHECK_LEVELS(POLICY_NAME, CUNAME);
> 
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>   
>   LBACSYS.LBAC_LGSTNDBY_UTIL.SET_COMPARTMENTS(POLID, CUNAME, READ_COMPS,
>                                       WRITE_COMPS, DEF_COMPS, ROW_COMPS);
> 
>   LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END SET_COMPARTMENTS;
> 
> 
> PROCEDURE ALTER_COMPARTMENTS (POLICY_NAME IN VARCHAR2,
>                               USER_NAME   IN VARCHAR2,
>                               COMPS       IN VARCHAR2,
>                               ACCESS_MODE IN VARCHAR2 DEFAULT NULL,
>                               IN_DEF      IN VARCHAR2 DEFAULT NULL,
>                               IN_ROW      IN VARCHAR2 DEFAULT NULL,
>                               INVOKER_USR IN VARCHAR2) IS
> CUNAME     VARCHAR2(1024);
> POLID      LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>   
>   IF (ACCESS_MODE IS NULL) AND (IN_DEF IS NULL) AND (IN_ROW IS NULL) THEN
>     RETURN;  
>   END IF;
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.ALTER_COMPARTMENTS(POLID, CUNAME, COMPS,
>                                           ACCESS_MODE, IN_DEF, IN_ROW);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END ALTER_COMPARTMENTS;
> 
> 
> PROCEDURE SET_GROUPS       (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             READ_GROUPS      IN VARCHAR2,
>                             WRITE_GROUPS     IN VARCHAR2 DEFAULT NULL,
>                             DEF_GROUPS       IN VARCHAR2 DEFAULT NULL,
>                             ROW_GROUPS       IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME    VARCHAR2(1024);
> POLID     LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
> 
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
> 
>   
>   CHECK_LEVELS(POLICY_NAME, CUNAME);
> 
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_GROUPS(POLID, CUNAME, READ_GROUPS,
>                                   WRITE_GROUPS, DEF_GROUPS, ROW_GROUPS);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END SET_GROUPS;
> 
> 
> PROCEDURE ALTER_GROUPS (POLICY_NAME IN VARCHAR2,
>                         USER_NAME   IN VARCHAR2,
>                         GROUPS      IN VARCHAR2,
>                         ACCESS_MODE IN VARCHAR2 DEFAULT NULL,
>                         IN_DEF      IN VARCHAR2 DEFAULT NULL,
>                         IN_ROW      IN VARCHAR2 DEFAULT NULL,
>                         INVOKER_USR IN VARCHAR2) IS           
> CUNAME     VARCHAR2(1024);
> POLID      LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
> 
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   IF (ACCESS_MODE IS NULL) AND (IN_DEF IS NULL) AND (IN_ROW IS NULL) THEN
>     RETURN;  
>   END IF;
> 
>   
>   BEGIN
>     LBACSYS.LBAC_LGSTNDBY_UTIL.ALTER_GROUPS(POLID, CUNAME, GROUPS,
>                                     ACCESS_MODE, IN_DEF, IN_ROW);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END ALTER_GROUPS;
> 
> 
> PROCEDURE ADD_COMPARTMENTS (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             COMPS            IN VARCHAR2,
>                             ACCESS_MODE  IN VARCHAR2 DEFAULT SA_UTL.READ_ONLY,
>                             IN_DEF       IN VARCHAR2 DEFAULT 'Y',
>                             IN_ROW       IN VARCHAR2 DEFAULT 'N',
>                             INVOKER_USR  IN VARCHAR2) IS
> CUNAME     VARCHAR2(1024);
> POLID      LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>  
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.ADD_COMPARTMENTS(POLID, CUNAME, COMPS,
>                                         ACCESS_MODE, IN_DEF, IN_ROW);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END ADD_COMPARTMENTS;
> 
> 
> PROCEDURE DROP_COMPARTMENTS (POLICY_NAME      IN VARCHAR2,
>                              USER_NAME        IN VARCHAR2,
>                              COMPS            IN VARCHAR2,
>                              INVOKER_USR      IN VARCHAR2) IS
> CUNAME   VARCHAR2(1024);
> POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
> BEGIN
> 
>   IF COMPS IS NULL THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       INVALID_ARG_EC, 'comps');
>   END IF;
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_COMPARTMENTS(POLID, CUNAME, COMPS);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END DROP_COMPARTMENTS;
> 
> 
> PROCEDURE DROP_ALL_COMPARTMENTS 
>                            (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME   VARCHAR2(1024);
> POLID    LBACSYS.OLS$USER_COMPARTMENTS.POL#%TYPE;
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_ALL_COMPARTMENTS(POLID, CUNAME);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END DROP_ALL_COMPARTMENTS;
> 
> 
> PROCEDURE ADD_GROUPS       (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             GROUPS           IN VARCHAR2,
>                             ACCESS_MODE  IN VARCHAR2 DEFAULT NULL,
>                             IN_DEF       IN VARCHAR2 DEFAULT NULL,
>                             IN_ROW       IN VARCHAR2 DEFAULT NULL,
>                             INVOKER_USR  IN VARCHAR2) IS
> CUNAME      VARCHAR2(1024);
> POLID       LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
> BEGIN
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.ADD_GROUPS(POLID, CUNAME, GROUPS,
>                                   ACCESS_MODE, IN_DEF, IN_ROW); 
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END ADD_GROUPS;
> 
> 
> PROCEDURE DROP_GROUPS      (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             GROUPS           IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME   VARCHAR2(1024);
> POLID    LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
> BEGIN
> 
>   IF GROUPS IS NULL THEN
>     LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, SA_FACILITY,
>       INVALID_ARG_EC, 'groups');
>   END IF;
> 
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_GROUPS(POLID, CUNAME, GROUPS);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END DROP_GROUPS;
> 
> 
> PROCEDURE DROP_ALL_GROUPS  (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2) IS
> CUNAME   VARCHAR2(1024);
> POLID    LBACSYS.OLS$USER_GROUPS.POL#%TYPE;
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   CHECK_USER(CUNAME);
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.DROP_ALL_GROUPS(POLID, CUNAME);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END DROP_ALL_GROUPS;
> 
> 
> 
> PROCEDURE SET_USER_LABELS (POLICY_NAME      IN VARCHAR2,
>                            USER_NAME        IN VARCHAR2,
>                            MAX_READ_LABEL   IN VARCHAR2,
>                            MAX_WRITE_LABEL  IN VARCHAR2 DEFAULT NULL,
>                            MIN_WRITE_LABEL  IN VARCHAR2 DEFAULT NULL,
>                            DEF_LABEL        IN VARCHAR2 DEFAULT NULL,
>                            ROW_LABEL        IN VARCHAR2 DEFAULT NULL,
>                            INVOKER_USR      IN VARCHAR2) IS
> CUNAME      VARCHAR2(1024);
> POLID       LBACSYS.OLS$USER_LEVELS.POL#%TYPE;
> MAX_RD_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
> MAX_WT_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
> MIN_WT_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
> DF_LAB      LBACSYS.OLS$LAB.ILABEL%TYPE;
> RW_LAB      LBACSYS.OLS$LAB.ILABEL%TYPE;
> MIN_LVL     PLS_INTEGER;
> I_NULL      VARCHAR2(1);
> 
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
> 
>   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   ELSE
>     CUNAME := UPPER(USER_NAME);
>   END IF;
>   CHECK_USER(CUNAME);
> 
>   POLID := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
> 
>   CHECK_COMMON(CUNAME, NULL, USER_OBJ_TYPE, INVOKER_USR);
> 
> 
>   MAX_RD_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_READ_LABEL);
> 
> 
>   IF MAX_WRITE_LABEL IS NULL THEN
>      MAX_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_READ_LABEL);
>   ELSE 
>      MAX_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MAX_WRITE_LABEL);
>   END IF;
> 
> 
>   IF MIN_WRITE_LABEL IS NULL THEN
>   
>   
>      SELECT MIN(LEVEL#) INTO MIN_LVL 
>      FROM LBACSYS.OLS$LEVELS
>      WHERE POL# = POLID;
> 
>   ELSE
>      MIN_WT_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, MIN_WRITE_LABEL);
>      MIN_LVL := LBACSYS.LBAC$SA_LABELS.LABEL_LEVEL_ONLY(MIN_WT_LAB);
>   END IF;
> 
> 
>   IF DEF_LABEL IS NULL THEN
>     DF_LAB := MAX_RD_LAB;
>   ELSE
>     DF_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, DEF_LABEL);
>   END IF;
> 
> 
>   IF ROW_LABEL IS NULL THEN
>     RW_LAB :=LBACSYS.LBAC$SA_LABELS.COMPUTE_WRITE_LABEL(POLID, MAX_WT_LAB, DF_LAB);
>   ELSE
>     RW_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, ROW_LABEL);
>   END IF;
> 
> 
>   LBACSYS.LBAC_LGSTNDBY_UTIL.SET_USER_LABELS(POLID, CUNAME, MAX_RD_LAB,
>                                      MAX_WT_LAB,
>                                      MIN_LVL, DF_LAB, RW_LAB);  
>   LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, CUNAME);
>   COMMIT;
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXRD, MAX_READ_LABEL);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXWRT, MAX_WRITE_LABEL);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MINWRT, MIN_WRITE_LABEL);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXRD, MAX_READ_LABEL);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MAXWRT, MAX_WRITE_LABEL);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_MINWRT, MIN_WRITE_LABEL);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END SET_USER_LABELS;
> 
> 
> 
> FUNCTION MAX_READ_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER     PLS_INTEGER;
> CUNAME         LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> MAX_READ_LABEL LBACSYS.OLS$PROFILE.MAX_READ%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT MAX_READ INTO MAX_READ_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN MAX_READ_LABEL;
> END MAX_READ_LABEL;
> 
> FUNCTION MAX_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER      PLS_INTEGER;
> CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> MAX_WRITE_LABEL LBACSYS.OLS$PROFILE.MAX_WRITE%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT MAX_WRITE INTO MAX_WRITE_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN MAX_WRITE_LABEL;
> END MAX_WRITE_LABEL;
> 
> FUNCTION MIN_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER      PLS_INTEGER;
> CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> MIN_WRITE_LABEL LBACSYS.OLS$PROFILE.MIN_WRITE%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT MIN_WRITE INTO MIN_WRITE_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN MIN_WRITE_LABEL;
> END MIN_WRITE_LABEL;
> 
> FUNCTION DEFAULT_READ_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER     PLS_INTEGER;
> CUNAME         LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> DEF_READ_LABEL LBACSYS.OLS$PROFILE.DEF_READ%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT DEF_READ INTO DEF_READ_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN DEF_READ_LABEL;
> END DEFAULT_READ_LABEL;
> 
> FUNCTION DEFAULT_WRITE_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER      PLS_INTEGER;
> CUNAME          LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> DEF_WRITE_LABEL LBACSYS.OLS$PROFILE.DEF_WRITE%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT DEF_WRITE INTO DEF_WRITE_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN DEF_WRITE_LABEL;
> END DEFAULT_WRITE_LABEL;
> 
> FUNCTION DEFAULT_ROW_LABEL (POLICY_NAME IN VARCHAR2, USER_NAME IN VARCHAR2)
> RETURN VARCHAR2 IS
> POL_NUMBER    PLS_INTEGER;
> CUNAME        LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> DEF_ROW_LABEL LBACSYS.OLS$PROFILE.DEF_ROW%TYPE;
> BEGIN
>    IF LBACSYS.LBAC_CACHE.POLICYEXISTS(POLICY_NAME) = FALSE THEN
>       LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(PRODUCT, LBAC_FACILITY,
>             NO_POLICY_EC,POLICY_NAME);
>    END IF;
>    POL_NUMBER:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
> 
>    SELECT DEF_ROW INTO DEF_ROW_LABEL
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE  USR_NAME = CUNAME AND U.POL# = POL_NUMBER AND
>    U.POL# = P.POL# AND U.PROFID = P.PROFID;
> 
>    RETURN DEF_ROW_LABEL;
> END DEFAULT_ROW_LABEL;
> 
> 
>                             
> PROCEDURE SET_DEFAULT_LABEL
>                            (POLICY_NAME IN VARCHAR2,
>                             USER_NAME   IN VARCHAR2,
>                             DEF_LABEL   IN VARCHAR2,
>                             INVOKER_USR IN VARCHAR2)
>  IS
> UNAME LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> POLID LBACSYS.OLS$POL.POL#%TYPE;
> DEF_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
> 
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
>   CHECK_USER(UNAME);
>   POLID:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   DEF_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, DEF_LABEL);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_DEFAULT_LABEL(POLID, UNAME, DEF_LAB);  
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, UNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END SET_DEFAULT_LABEL;
> 
> 
> 
> PROCEDURE SET_ROW_LABEL
>                            (POLICY_NAME IN VARCHAR2,
>                             USER_NAME   IN VARCHAR2,
>                             ROW_LABEL   IN VARCHAR2,
>                             INVOKER_USR IN VARCHAR2) IS
> UNAME LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> POLID LBACSYS.OLS$POL.POL#%TYPE;
> ROW_LAB  LBACSYS.OLS$LAB.ILABEL%TYPE;
> 
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
>   LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
>   CHECK_USER(UNAME);
>   POLID:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   ROW_LAB := LBACSYS.LBAC$SA_LABELS.TO_LABEL(POLID, ROW_LABEL);
> 
>   BEGIN
>     
>     LBACSYS.LBAC_LGSTNDBY_UTIL.SET_ROW_LABEL(POLID, UNAME, ROW_LAB);
> 
>     LBACSYS.LBAC$SA_LABELS.STORE_USER_LABEL_LIST (POLID, UNAME);
>   EXCEPTION
>     WHEN OTHERS THEN
>       ROLLBACK;
>       RAISE;
>   END;
> 
>   COMMIT;
> END SET_ROW_LABEL;
> 
> 
> 
> PROCEDURE DROP_LABELS(POLICY_NAME      IN VARCHAR2,
>                       USER_NAME        IN VARCHAR2)
> IS
> CURR_PRIVS     PLS_INTEGER := 0 ;
> POL_NUM        PLS_INTEGER;
> STMT_TYPE      PLS_INTEGER;
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
>   CHECK_USER(USER_NAME);
>   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
> 
>   DELETE FROM LBACSYS.OLS$USER_LEVELS 
>   WHERE USR_NAME = USER_NAME AND POL#=POL_NUM;
> 
>  BEGIN
>    SELECT PRIVS INTO CURR_PRIVS
>    FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>    WHERE USR_NAME = USER_NAME AND U.POL# = POL_NUM
>    AND U.POL# = P.POL# AND U.PROFID = P.PROFID;
>  EXCEPTION
>    WHEN NO_DATA_FOUND THEN
>      RETURN;
>  END;
>   
> 
>  IF CURR_PRIVS = 0 THEN
>    STMT_TYPE := DELETE_TYPE;
>  ELSE 
>    STMT_TYPE := UPDATE_TYPE;
>  END IF;
> 
>  LBACSYS.LBAC$SA_LABELS.STORE_USER(POLICY_NAME, USER_NAME,
>                            NULL, NULL, NULL, NULL,
>                            NULL, NULL, CURR_PRIVS, STMT_TYPE);
> END DROP_LABELS;
> 
> 
> 
> PROCEDURE SET_USER_PRIVS (POLICY_NAME IN VARCHAR2,
>                           USER_NAME   IN VARCHAR2,
>                           PRIVILEGES  IN VARCHAR2,
>                           INVOKER_USR IN VARCHAR2) IS
> UNAME            LBACSYS.OLS$USER_LEVELS.USR_NAME%TYPE;
> POL_NUM          PLS_INTEGER;
> OLD_MAX_READ     LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> OLD_MAX_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> OLD_MIN_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> OLD_DEF_READ     LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> OLD_DEF_WRITE    LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> OLD_DEF_ROW      LBACSYS.OLS$LAB.ILABEL%TYPE :=NULL;
> NO_OLD_PRIVS     BOOLEAN;
> OLD_PRIVS        NUMBER;
> NEW_PRIVS        NUMBER;
> PROFILE_ID       NUMBER;
> STMT_TYPE        PLS_INTEGER;
> BEGIN
>   CHECK_POLICY(POLICY_NAME);
>   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', UNAME);
>   ELSE
>     UNAME := UPPER(USER_NAME);
>   END IF;
> 
>   
>   
>   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
> 
>   CHECK_COMMON(UNAME, NULL, USER_OBJ_TYPE, INVOKER_USR);
> 
> 
>    NO_OLD_PRIVS := FALSE;
>    BEGIN
>      SELECT MAX_READ, MAX_WRITE, MIN_WRITE, DEF_READ, DEF_WRITE,
>             DEF_ROW, PRIVS
>      INTO OLD_MAX_READ, OLD_MAX_WRITE, OLD_MIN_WRITE, OLD_DEF_READ, 
>           OLD_DEF_WRITE, OLD_DEF_ROW, OLD_PRIVS
>      FROM LBACSYS.OLS$USER U, LBACSYS.OLS$PROFILE P
>      WHERE USR_NAME = UNAME AND U.POL# = POL_NUM 
>            AND U.POL# = P.POL# AND U.PROFID = P.PROFID;
>    EXCEPTION
>      WHEN NO_DATA_FOUND THEN
> 
>        IF PRIVILEGES IS NULL THEN
>          RETURN;
>        ELSE
>          NO_OLD_PRIVS := TRUE;
>          OLD_PRIVS := 0;
>        END IF;
>    END;
> 
> 
> 
>   NEW_PRIVS := TO_PRIVS(POLICY_NAME,PRIVILEGES);
> 
> 
> 
> 
>    IF NO_OLD_PRIVS THEN
>      STMT_TYPE := INSERT_TYPE;
>    ELSIF OLD_MAX_READ IS NULL AND PRIVILEGES IS  NULL THEN
>      STMT_TYPE := DELETE_TYPE;
>    ELSE
>      STMT_TYPE := UPDATE_TYPE;
>    END IF;
> 
>    SET_USER_PRIVS_INTERNAL(POLICY_NAME, UNAME, OLD_MAX_READ, OLD_MAX_WRITE,
>                            OLD_MIN_WRITE, OLD_DEF_READ, OLD_DEF_WRITE,
>                            OLD_DEF_ROW, NEW_PRIVS, STMT_TYPE);
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_GRANTEE, USER_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END SET_USER_PRIVS;
> 
> 
> 
> PROCEDURE SET_PROG_PRIVS (POLICY_NAME       IN VARCHAR2,
>                           SCHEMA_NAME       IN VARCHAR2,
>                           PROGRAM_UNIT_NAME IN VARCHAR2,
>                           PRIVILEGES        IN VARCHAR2,
>                           INVOKER_USR       IN VARCHAR2) IS
> POL_NUM        PLS_INTEGER;
> PGM_CNT        PLS_INTEGER;
> ROW_CNT        PLS_INTEGER;
> NO_OLD_PRIVS   BOOLEAN;
> OLD_PRIVS      NUMBER;
> NEW_PRIVS      NUMBER;
> CPNAME         LBACSYS.OLS$PROG.PGM_NAME%TYPE;
> CSNAME         LBACSYS.OLS$PROG.OWNER%TYPE;
> 
> BEGIN
>    CHECK_POLICY(POLICY_NAME);
>    
>    IF SCHEMA_NAME IS NULL THEN
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>              PRODUCT, SA_FACILITY, INVALID_PARAMS_EC, 'schema name');
>    ELSIF PROGRAM_UNIT_NAME IS NULL THEN
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>              PRODUCT, SA_FACILITY, INVALID_PARAMS_EC, 'program name');
>    END IF;
> 
> 
>    IF (LBACSYS.LBAC_CACHE.FAILEDSTARTUP(POLICY_NAME)) THEN
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>              PRODUCT, SA_FACILITY, STARTUP_FAILURE_EC, POLICY_NAME);
>    END IF;
>    POL_NUM:=LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(SCHEMA_NAME, 'schema name',
>                                               CSNAME);
>    LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(PROGRAM_UNIT_NAME,
>                                      'program unit name', CPNAME);
> 
> 
>   CHECK_COMMON(CSNAME, CPNAME, PROC_OBJ_TYPE, INVOKER_USR);
> 
> 
>    
>    
>    SELECT COUNT(*) INTO PGM_CNT
>    FROM SYS.OBJ$ O, SYS."_BASE_USER" U
>    WHERE O.NAME = CPNAME 
>    AND U.NAME = CSNAME 
>    AND O.OWNER# = U.USER#
>    AND O.TYPE# IN (7,8,9);
> 
>    IF (PGM_CNT != 1) THEN
>      LBACSYS.LBAC_STANDARD.RAISE_FACILITY_ERROR(
>        PRODUCT, SA_FACILITY, NO_PROG_EC, 
>        (SCHEMA_NAME || '.' || PROGRAM_UNIT_NAME));
>    END IF;
> 
> 
>    NO_OLD_PRIVS := FALSE;
>    BEGIN
>      SELECT PRIVS INTO OLD_PRIVS
>      FROM LBACSYS.OLS$PROG
>      WHERE CPNAME = PGM_NAME AND
>            OWNER = CSNAME AND
>            POL# = POL_NUM;
>    EXCEPTION
>      WHEN  NO_DATA_FOUND THEN
> 
>        IF PRIVILEGES IS NULL THEN
>          RETURN;
>        ELSE
>          NO_OLD_PRIVS := TRUE;
>          OLD_PRIVS := NULL;
>        END IF;
>    END;
> 
>    NEW_PRIVS := TO_PRIVS(POLICY_NAME,PRIVILEGES);
> 
> 
> 
> 
>    IF NO_OLD_PRIVS THEN
> 
>      LBACSYS.LBAC_STANDARD.SET_TRUSTED_PROG(CSNAME,CPNAME);
>      INSERT INTO LBACSYS.OLS$PROG VALUES (POL_NUM,CPNAME,
>                           CSNAME, NEW_PRIVS);
>   ELSIF PRIVILEGES IS NULL THEN
>      LBACSYS.LBAC_STANDARD.RESET_TRUSTED_PROG(CSNAME,CPNAME);
>      DELETE FROM LBACSYS.OLS$PROG 
>      WHERE POL#=POL_NUM AND PGM_NAME=CPNAME
>             AND OWNER=CSNAME;
>    ELSE 
> 
>      LBACSYS.LBAC_STANDARD.SET_TRUSTED_PROG(CSNAME,CPNAME);
>      UPDATE LBACSYS.OLS$PROG SET PRIVS = NEW_PRIVS
>      WHERE POL#=POL_NUM AND
>             PGM_NAME=CPNAME AND 
>             OWNER=CSNAME;
>    END IF;
> 
>    COMMIT;  
>    
> 
>    LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME, SET_ACTION, TRUE,
>      'SET PROGRAM PRIVILEGES');
> 
> 
>    IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, 0)) THEN
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCHEMA_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PROGRAM, PROGRAM_UNIT_NAME);
>      LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
>      LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>    END IF;
> EXCEPTION
>   WHEN OTHERS THEN
>     
>     IF (LBACSYS.LBAC_SERVICES.CHECK_AUDIT(SET_AUTH_ACTION, ABS(SQLCODE))) THEN
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_OBJOWNER, SCHEMA_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PROGRAM, PROGRAM_UNIT_NAME);
>       LBACSYS.LBAC_SERVICES.SET_UGA(AUDINFO_PRIVGRNTED, PRIVILEGES);
>       LBACSYS.LBAC_SERVICES.AUDIT_ACTION(POLICY_NAME);
>     END IF;
>     RAISE;
> END SET_PROG_PRIVS;
> 
> 
> 
> PROCEDURE DROP_USER_ACCESS (POLICY_NAME      IN VARCHAR2,
>                             USER_NAME        IN VARCHAR2,
>                             INVOKER_USR      IN VARCHAR2) IS
> 
> POL_NUM PLS_INTEGER := 0;
> CUNAME VARCHAR2(1024);
> BEGIN
>   IF (NOT LBACSYS.LBAC_CACHE.OID_ENABLED) THEN
>     LBACSYS.LBAC_CACHE.CANONICALIZE_IDENTIFIER(USER_NAME, 'user name', CUNAME);
>   ELSE
>     CUNAME := UPPER(USER_NAME);
>   END IF;
> 
>   DROP_LABELS(POLICY_NAME, CUNAME);
>   POL_NUM := LBACSYS.LBAC_CACHE.POL_NUMBER(POLICY_NAME);
> 
>   LBACSYS.LBAC$SA_LABELS.STORE_USER(POLICY_NAME, CUNAME,
>                            NULL, NULL, NULL, NULL,
>                            NULL, NULL, 0, DELETE_TYPE);
> END DROP_USER_ACCESS;
> 
> END SA_USER_ADMIN_INT;
MDSYS.SDO_3GL - PACKAGE (RU):
485a486,491
>   FUNCTION GENERATE_BUFFER_C(DIMOBJ  IN  MDSYS.SDO_DIM_ARRAY,
>                            GEOMOBJ IN  MDSYS.SDO_GEOMETRY,
>                            DIST    IN  NUMBER)
>   RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC PARALLEL_ENABLE;
> 
> 
MDSYS.RDF_APIS - PACKAGE BODY (RU):
2554c2554
<     GRANT_MODEL_ACCESS_PRIVS(MODEL_NAME, USER_NAME, SYS.ODCIVARCHAR2LIST(PRIVILEGE), USER_VIEW, OPTIONS);
---
>     GRANT_MODEL_ACCESS_PRIVS(MODEL_NAME, USER_NAME, SYS.ODCIVARCHAR2LIST(PRIVILEGE), USER_VIEW, OPTIONS, NETWORK_OWNER, NETWORK_NAME);
2582c2582
<     REVOKE_MODEL_ACCESS_PRIVS(MODEL_NAME, USER_NAME, SYS.ODCIVARCHAR2LIST(PRIVILEGE), USER_VIEW, OPTIONS);
---
>     REVOKE_MODEL_ACCESS_PRIVS(MODEL_NAME, USER_NAME, SYS.ODCIVARCHAR2LIST(PRIVILEGE), USER_VIEW, OPTIONS, NETWORK_OWNER, NETWORK_NAME);
5348c5348,5349
<                                   ' || OBJ_COL_NAME || ')
---
>                                   ' || OBJ_COL_NAME || ',
>                                   :3, :4)
5350c5351
<             USING V_MODEL_NAME_COLON,V_MODEL_NAME;
---
>             USING V_MODEL_NAME_COLON,V_MODEL_NAME,NETWORK_OWNER,NETWORK_NAME;
MDSYS.RDF_APIS_INTERNAL - PACKAGE BODY (RU):
2183c2183
<       IDS := W_FETCHIDLIST(NAMES, 'MODEL_ID','RDF_MODEL_INTERNAL$','MODEL_NAME');
---
>       IDS := W_FETCHIDLIST(NAMES, 'MODEL_ID',(CASE SYS_CONTEXT('USERENV','CURRENT_USER') WHEN NETWORK_OWNER THEN 'RDF_MODEL_INTERNAL$' ELSE 'RDF_MODEL$' END),'MODEL_NAME');
2195a2196
>          IF (SYS_CONTEXT('USERENV','CURRENT_USER') = NETWORK_OWNER) THEN
2200a2202,2208
>          ELSE
>           EXECUTE IMMEDIATE 
>             'select model_name from ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_MODEL$ 
>               where model_id=:1 model_type=:2'
>             INTO MODEL_NAME 
>             USING IDS(IDX),SDO_RDF_INTERNAL.MODEL_TYPE_RDB2RDF;
>          END IF;
7413a7422
>     CLIQUE_VIEW_EXISTS      PLS_INTEGER;
7475a7485,7490
>       ELSE
>         SELECT COUNT(*) INTO CLIQUE_VIEW_EXISTS FROM  SYS.ALL_VIEWS WHERE OWNER=NETWORK_OWNER AND VIEW_NAME=NETWORK_NAME || 'RDFC_' || PRECOMPIDX;
>         IF (CLIQUE_VIEW_EXISTS > 0) THEN
>           VCSAMEASOPTION := ',OPT_SAMEAS=T,INF_ONLY=T,';
>         END IF;
>         
8726a8742
>          BEGIN
8727a8744,8748
>          EXCEPTION WHEN OTHERS THEN
>            RAISE_APPLICATION_ERROR(-20000, 'Unable to read model ' || NAME || ' info from '|| V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model$' ||
>              CHR(10) || SYS.DBMS_UTILITY.FORMAT_ERROR_STACK
>            );
>          END;
MDSYS.SDO_GEOM - PACKAGE BODY (RU):
4238a4239,4240
>          
>          COMMIT;
MDSYS.SDO_RDF - PACKAGE BODY (RU):
17275c17275,17278
<       IF (PKG_LIST(I) = 'S_SDO_RDF_INFO') THEN
---
>       IF (INSTR(U_OPTIONS, ' QUERY_ONLY=T ') > 0) THEN
>         CONTINUE;
>       
>       ELSIF (PKG_LIST(I) = 'S_SDO_RDF_INFO') THEN
17407a17411,17417
>     
>     TYPE CUR_TYPE IS REF CURSOR;
>     RC  CUR_TYPE;
>     RELTABNAME          VARCHAR2(261);
>     
>     ENTAILMENT_TYPE     CONSTANT VARCHAR2(30) := 'ENTAILMENT';
>     ENT_EXISTS          PLS_INTEGER;
17409a17420,17421
>     E_NO_TABLE EXCEPTION;
>     PRAGMA EXCEPTION_INIT (E_NO_TABLE, -942);
17423,17424c17435,17445
<     
<     DYN_SQL_STMT := 
---
>     IF (INSTR(' ' || NLS_UPPER(OPTIONS) || ' ',' ' || ENTAILMENT_TYPE || ' ') > 0) THEN
>       
>       DYN_SQL_STMT := 
>         'select /*+ dynamic_sampling(0) result_cache */ 1 ' || 
>         '  from ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_RULES_INDEX_INFO' || 
>         ' where index_name = :ent';
>       EXECUTE IMMEDIATE DYN_SQL_STMT INTO ENT_EXISTS USING MODEL;
>       MODEL_TYPE := ENTAILMENT_TYPE;
>     ELSE
>       
>       DYN_SQL_STMT := 
17426,17428c17447,17450
<       '  from ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_MODEL$' || 
<       ' where model_name = :mod';
<     EXECUTE IMMEDIATE DYN_SQL_STMT INTO MODEL_ID, MODEL_TYPE, OWNER_NAME, APPTAB_NAME USING MODEL;
---
>         '  from ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_MODEL$' || 
>         ' where model_name = :mod';
>       EXECUTE IMMEDIATE DYN_SQL_STMT INTO MODEL_ID, MODEL_TYPE, OWNER_NAME, APPTAB_NAME USING MODEL;
>     END IF;
17441c17463,17487
<     IF (MODEL_TYPE = SDO_RDF_INTERNAL.MODEL_TYPE_VIRTUAL) THEN
---
>     IF (MODEL_TYPE = ENTAILMENT_TYPE) THEN
>       PRIV := 'READ';
>       DYN_SQL_STMT := OPCODE || ' ' || PRIV || ' on ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDFI_' || MODEL || DIR || Q_UNAME;
>       BEGIN
>         EXECUTE IMMEDIATE DYN_SQL_STMT;
>         EXCEPTION WHEN NO_REVOKE_FOR_NOT_GRANTED THEN NULL;
>       END;
>       DYN_SQL_STMT := OPCODE || ' ' || PRIV || ' on ' || V_PFX_FOR_RDF_OBJ_NAME || 'SEMI_' || MODEL || DIR || Q_UNAME;
>       BEGIN
>         EXECUTE IMMEDIATE DYN_SQL_STMT;
>         EXCEPTION WHEN NO_REVOKE_FOR_NOT_GRANTED THEN NULL;
>       END;
>       DYN_SQL_STMT := OPCODE || ' ' || PRIV || ' on ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDFC_' || MODEL || DIR || Q_UNAME;
>       BEGIN
>         EXECUTE IMMEDIATE DYN_SQL_STMT;
>         EXCEPTION WHEN NO_REVOKE_FOR_NOT_GRANTED OR E_NO_TABLE THEN NULL;
>       END;
>       DYN_SQL_STMT := OPCODE || ' ' || PRIV || ' on ' || V_PFX_FOR_RDF_OBJ_NAME || 'SEMC_' || MODEL || DIR || Q_UNAME;
>       BEGIN
>         EXECUTE IMMEDIATE DYN_SQL_STMT;
>         EXCEPTION WHEN NO_REVOKE_FOR_NOT_GRANTED OR E_NO_TABLE THEN NULL;
>       END;
> 
>       RETURN;
>     ELSIF (MODEL_TYPE = SDO_RDF_INTERNAL.MODEL_TYPE_VIRTUAL) THEN
17487a17534,17554
>         
>         IF (INSTR(' ' || NLS_UPPER(OPTIONS) || ' ',' READ_PRIV_ON_TABLES=T ') > 0) THEN
>         BEGIN
>           OPEN RC FOR 'select distinct tabName from ' || V_PFX_FOR_RDF_OBJ_NAME || RRTABNAME || ' where tabName is NOT NULL';
>           LOOP
>             FETCH RC INTO RELTABNAME;
>             EXIT WHEN RC%NOTFOUND;
>             DYN_SQL_STMT := OPCODE || ' READ on ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(RELTABNAME) || DIR || Q_UNAME;
>             EXECUTE IMMEDIATE DYN_SQL_STMT;
>           END LOOP;
>           CLOSE RC;
>           EXCEPTION 
>           WHEN NO_REVOKE_FOR_NOT_GRANTED THEN 
>             NULL;
>           WHEN OTHERS THEN
>             CLOSE RC;
>             RAISE_APPLICATION_ERROR(-20000, 'Failed: ' || DYN_SQL_STMT ||
>               CHR(10) || '[' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK || CHR(10) || ']'
>             );
>         END;
>         END IF;
17514a17582
>       BEGIN
17521a17590,17593
>       EXCEPTION
>         WHEN NO_DATA_FOUND THEN
>           NULL;
>       END;
MDSYS.SDO_RDF_INTERNAL - PACKAGE BODY (RU):
1176a1177
>   EXCEPTION WHEN OTHERS THEN ROLLBACK;
1198a1200
>   EXCEPTION WHEN OTHERS THEN ROLLBACK;
1543c1545
<     OPTION_LIST      VARCHAR2(32767);
---
>     OPTION_LIST      VARCHAR2(32767) := TRIM(TRANSLATE(FLAGS, CHR(8) || CHR(9) || CHR(10) || CHR(11) || CHR(12), '     '));
1567c1569
<     IF (FLAGS IS NULL) THEN RETURN OPTION_CNT; END IF;
---
>     IF (OPTION_LIST IS NULL) THEN RETURN OPTION_CNT; END IF;
1570c1572
<     OPTION_LIST := NLS_UPPER(TRIM(FLAGS))||' ';
---
>     OPTION_LIST := NLS_UPPER(OPTION_LIST)||' ';
4804a4807,4810
>         IF (INSTR(U_OPTIONS,' QUERY_ONLY=T ') > 0) THEN
>           
>           CHOSEN_ROUTE := SDO_RDF.ROUTE_DIRECT_IR;
>         ELSE
4809a4816
>         END IF;
4828a4836
>     DYN_SQL_STMT LONG;
5001c5009
<       CALLCONTEXT.MODEL_ID := MDSYS.SDO_RDF_INTERNAL.GET_MODEL_ID(CALLCONTEXT.MODEL_NAME,FLAGS=>OPTIONS);
---
>       CALLCONTEXT.MODEL_ID := MDSYS.SDO_RDF_INTERNAL.W_GET_MODEL_ID(CALLCONTEXT.MODEL_NAME,FLAGS=>OPTIONS);
5004c5012
<       M_G_ID := MDSYS.SDO_RDF_INTERNAL.GET_MODEL_ID(CALLCONTEXT.M_G_NAME,FLAGS=>OPTIONS);
---
>       M_G_ID := MDSYS.SDO_RDF_INTERNAL.W_GET_MODEL_ID(CALLCONTEXT.M_G_NAME,FLAGS=>OPTIONS);
14674c14682
<     IF (MDSYS.RDF_APIS_INTERNAL.HAS_VERSION_ENABLED_MODEL(SYS.ODCINUMBERLIST(MOD_ID)) > 0) THEN
---
>     IF (MDSYS.RDF_APIS_INTERNAL.W_HAS_VERSION_ENABLED_MODEL(SYS.ODCINUMBERLIST(MOD_ID)) > 0) THEN
14876c14884
<    GET_VALUE$_TYPE$(M_ID, 
---
>    W_GET_VALUE$_TYPE$(M_ID, 
14900c14908
<       PARSE_SUBJECT_NODE(V_SUBJECT,SV_TYPE,SV_ID,NEW_SV);
---
>       W_PARSE_SUBJECT_NODE(V_SUBJECT,SV_TYPE,SV_ID,NEW_SV);
14909c14917
<       PARSE_OBJECT_NODE(V_OBJECT,LIT_TYPE,LIT_LANG,OV_TYPE,OV_ID,COV_ID,NEW_OV);
---
>       W_PARSE_OBJECT_NODE(V_OBJECT,LIT_TYPE,LIT_LANG,OV_TYPE,OV_ID,COV_ID,NEW_OV);
14917c14925
<       PARSE_PROPERTY_VALUE(V_PROPERTY,PV_TYPE,PV_ID,NEW_PV);
---
>       W_PARSE_PROPERTY_VALUE(V_PROPERTY,PV_TYPE,PV_ID,NEW_PV);
15008c15016
<   GET_VALUE$_TYPE$(M_ID,
---
>     GET_VALUE$_TYPE$(M_ID,
15033c15041
<       PARSE_SUBJECT_NODE(V_SUBJECT,SV_TYPE,SV_ID,NEW_SV);
---
>       W_PARSE_SUBJECT_NODE(V_SUBJECT,SV_TYPE,SV_ID,NEW_SV);
15041c15049
<       PARSE_OBJECT_NODE(V_OBJECT,LIT_TYPE,LIT_LANG,OV_TYPE,OV_ID,COV_ID,NEW_OV);
---
>       W_PARSE_OBJECT_NODE(V_OBJECT,LIT_TYPE,LIT_LANG,OV_TYPE,OV_ID,COV_ID,NEW_OV);
15049c15057
<       PARSE_PROPERTY_VALUE(V_PROPERTY,PV_TYPE,PV_ID,NEW_PV);
---
>       W_PARSE_PROPERTY_VALUE(V_PROPERTY,PV_TYPE,PV_ID,NEW_PV);
15677c15685
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE); 
15689c15697
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE); 
15702c15710
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE); 
15730c15738
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE); 
15989c15997
<     RDF_APIS_INTERNAL.KSDWRF('gmi: model_name=' || MODEL_NAME || ' sep_pos=' || SEP_POS, DEBUG_TRACE);
---
>     
15991,15992c15999,16000
<     MODEL := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(VAL_CVT_RDF_NAME(SUBSTR(MODEL_NAME,1,SEP_POS-1)));
<     SEL_MODEL :='SELECT model_id FROM ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model$ WHERE model_name=:1';
---
>     MODEL := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(SDO_RDF_INTERNAL.VAL_CVT_RDF_NAME(SUBSTR(MODEL_NAME,1,SEP_POS-1)));
>     SEL_MODEL :='SELECT /*+ dynamic_sampling(0) result_cache */ model_id FROM ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model_internal$ WHERE model_name=:1';
15994c16002
<     RDF_APIS_INTERNAL.KSDWRF('gmi: model_name=' || MODEL_NAME || ' m_id=' || M_ID, DEBUG_TRACE);
---
>     
16001c16009
<       PARSE_PROPERTY_VALUE(
---
>       W_PARSE_PROPERTY_VALUE(
18529d18536
<     DYN_SQL_STMT VARCHAR2(4000);
18530a18538,18546
>     
>     TRUNCATE_STMT LONG;
>     SELECT_STMT LONG;
>     INSERT_STMT   LONG;
>     ROWS_PRESENT NUMBER := 0;
>     RETRY_CNT NUMBER := 0;
>     MAX_RETRY_CNT CONSTANT NUMBER := 10;
>     E_RESOURCE_BUSY EXCEPTION;
>     PRAGMA EXCEPTION_INIT (E_RESOURCE_BUSY, -54);
18548,18549c18564
<     
<     DYN_SQL_STMT := 
---
>     TRUNCATE_STMT := 
18551d18565
<     EXECUTE IMMEDIATE DYN_SQL_STMT;
18553,18554c18567,18570
<     
<     DYN_SQL_STMT :=
---
>     SELECT_STMT := 
>       'SELECT COUNT(*) FROM ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_MODEL$_TBL WHERE ROWNUM < 2';
> 
>     INSERT_STMT :=
18562c18578,18604
<     EXECUTE IMMEDIATE DYN_SQL_STMT;
---
> 
> 
>     <<RETRY_REFRESH>>
> 
>     
>     BEGIN
>       EXECUTE IMMEDIATE TRUNCATE_STMT;
>     EXCEPTION
>       WHEN E_RESOURCE_BUSY THEN
>         IF (RETRY_CNT < MAX_RETRY_CNT) THEN
>           RETRY_CNT := RETRY_CNT + 1;
>           DBMS_LOCK.SLEEP(1);
>           GOTO RETRY_REFRESH;
>         END IF;
>     END;
> 
>     
>     EXECUTE IMMEDIATE SELECT_STMT INTO ROWS_PRESENT;
>     IF (ROWS_PRESENT > 0 AND RETRY_CNT < MAX_RETRY_CNT) THEN
>       RETRY_CNT := RETRY_CNT + 1;
>       DBMS_LOCK.SLEEP(1);
>       GOTO RETRY_REFRESH;
>     END IF;
> 
>     
>     EXECUTE IMMEDIATE INSERT_STMT;
> 
18564a18607
> 
18565a18609,18619
>     IF (ROWS_PRESENT > 0) THEN
>       RDF_APIS_INTERNAL.KSDWRF('W_refresh_rdf_model_tbl: RDF_MODEL$_TBL may need manual cleanup to eliminate duplicate rows.' ||
>         NL || DBMS_UTILITY.FORMAT_CALL_STACK);
>     END IF;
>   EXCEPTION 
>     WHEN OTHERS THEN 
>       ROLLBACK;
>       RDF_APIS_INTERNAL.KSDWRF('W_refresh_rdf_model_tbl: IGNORING: RDF_MODEL$_TBL may need manual refresh.' || 
>         NL || DBMS_UTILITY.FORMAT_ERROR_STACK ||
>         NL || '[' || NL || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || NL || ']' ||
>         NL || DBMS_UTILITY.FORMAT_CALL_STACK);
19339c19393,19397
<     EXECUTE IMMEDIATE DYN_SQL_STMT;
---
>     BEGIN
>       EXECUTE IMMEDIATE DYN_SQL_STMT;
>     EXCEPTION WHEN E_PART_NX THEN NULL;
>               WHEN TABLE_NX THEN NULL;
>     END;
19365a19424
> 
20674c20733
<         MDSYS.RDF_APIS_INTERNAL.KSDWRF('RDFCTX vmId ='|| VMID || 'vID_beg vID_end:' || VID_BEG || ' ' || VID_END);
---
>         MDSYS.RDF_APIS_INTERNAL.KSDWRF('RDFCTX vmId ='|| VMID || 'vID_beg vID_end:' || VID_BEG || ' ' || VID_END, DEBUG_TRACE);
25368a25428
>       , 'rdf_rulebase$', 'rdf_precomp$' , 'rdf_precomp_dep$', 'rdf_delta$', 'rdf_ts$', 'rdf_hist$' 
26042c26102
<               select m.model_id, au.user_id, ao.object_id
---
>               select DISTINCT m.model_id, au.user_id, ao.object_id
26330c26390
<                                    '... skipping creation'); 
---
>                                    '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26339c26399
<                                    '... skipping drop'); 
---
>                                    '... skipping drop', DEBUG_TRACE OR IMPORT_MODE); 
26358c26418
<                                    '... skipping creation'); 
---
>                                    '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26393c26453
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26406c26466
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26418c26478
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26430c26490
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26440c26500
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26450c26510
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26471c26531
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26484c26544
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26496c26556
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26508c26568
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26520c26580
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26541c26601
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26554c26614
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26567c26627
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26583c26643
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26602c26662
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26614c26674
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26633c26693
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26647c26707
<             '... skipping populate'); 
---
>             '... skipping populate', DEBUG_TRACE OR IMPORT_MODE); 
26691c26751
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26704c26764
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26716c26776
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26725c26785
<                                    '... skipping drop'); 
---
>                                    '... skipping drop', DEBUG_TRACE OR IMPORT_MODE); 
26737c26797
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26787c26847
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26805c26865
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26819c26879
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26844c26904
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26855c26915
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26866c26926
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26877c26937
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26938c26998
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26952c27012
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26966c27026
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
26995c27055
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27032c27092
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27047c27107
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27061c27121
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27075c27135
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27106c27166
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27126c27186
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27140c27200
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27154c27214
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27167c27227
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27185c27245
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27200c27260
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27217c27277
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27232c27292
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27259c27319
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27280c27340
<               '... skipping creation'); 
---
>               '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27294c27354
<               '... skipping creation'); 
---
>               '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27315c27375
<               '... skipping creation'); 
---
>               '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27384c27444
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27402c27462
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27423c27483
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
27441c27501
<             '... skipping creation'); 
---
>             '... skipping creation', DEBUG_TRACE OR IMPORT_MODE); 
31384c31444
<     V_COMMAND := NLS_UPPER(TRIM(COMMAND));
---
>     V_COMMAND := ' ' || NLS_UPPER(TRIM(COMMAND)) || ' ';
MDSYS.SDO_UTIL - PACKAGE BODY (RU):
2207a2208
>  IS_G3D VARCHAR2(10) := 'FALSE';
2228a2230,2237
>   
>  
>  BEGIN
>    SDO_GEOM.G3D_PARAMETERS(GEOMETRY.SDO_SRID, SM_MJR_AXIS,INV_FLTN,UOM_FACTOR);
>     EXCEPTION WHEN OTHERS THEN
>        SM_MJR_AXIS := NULL;
>        INV_FLTN := NULL;
>  END;
2230d2238
<  SDO_GEOM.G3D_PARAMETERS(GEOMETRY.SDO_SRID, SM_MJR_AXIS,INV_FLTN,UOM_FACTOR);
MDSYS.SDO_RDF_TRIPLE_S - TYPE BODY (RU):
29a30,31
>   CLN_NETWORK_OWNER DBMS_QUOTED_ID;
>   CLN_NETWORK_NAME  VARCHAR2(30);
39c41,58
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NETWORK_OWNER, NETWORK_NAME);
---
>   
>   
>   
>   IF (NETWORK_OWNER IS NOT NULL) THEN
>     CLN_NETWORK_OWNER := SDO_RDF_INTERNAL.VALIDATE_AND_CONVERT_NAME(NETWORK_OWNER);
>   ELSE
>     CLN_NETWORK_OWNER := 'MDSYS';
>   END IF;
>   IF (NETWORK_NAME IS NOT NULL) THEN
>     CLN_NETWORK_NAME := SDO_RDF_INTERNAL.VAL_CVT_RDF_NAME(NETWORK_NAME)||'#';
>   ELSE
>     CLN_NETWORK_NAME := 'ORA$NULL';
>   END IF;
> 
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = CLN_NETWORK_OWNER AND
>           COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_NAME(),'ORA$NULL') = CLN_NETWORK_NAME)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NETWORK_OWNER, NETWORK_NAME);
>   END IF;
134a154,155
>   CLN_NETWORK_OWNER DBMS_QUOTED_ID;
>   CLN_NETWORK_NAME  VARCHAR2(30);
159c180,196
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NETWORK_OWNER, NETWORK_NAME);
---
>   
>   
>   
>   IF (NETWORK_OWNER IS NOT NULL) THEN
>     CLN_NETWORK_OWNER := SDO_RDF_INTERNAL.VALIDATE_AND_CONVERT_NAME(NETWORK_OWNER);
>   ELSE
>     CLN_NETWORK_OWNER := 'MDSYS';
>   END IF;
>   IF (NETWORK_NAME IS NOT NULL) THEN
>     CLN_NETWORK_NAME := SDO_RDF_INTERNAL.VAL_CVT_RDF_NAME(NETWORK_NAME)||'#';
>   ELSE
>     CLN_NETWORK_NAME := 'ORA$NULL';
>   END IF;
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = CLN_NETWORK_OWNER AND
>           COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_NAME(),'ORA$NULL') = CLN_NETWORK_NAME)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NETWORK_OWNER, NETWORK_NAME);
>   END IF;
309c346,349
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
411c451,454
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
486c529,532
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
542c588,591
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
583c632,635
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
648c700,703
<   RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
---
>   IF (NOT(COALESCE(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(),'ORA$NULL') = 'MDSYS' AND
>           SDO_RDF_INTERNAL.GET_NETWORK_NAME() IS NULL)) THEN
>     RDF_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>   END IF;
SYS.DBMS_APP_CONT_ADMIN - PACKAGE (RU):
79c79,80
<                       failover_restore IN VARCHAR2 DEFAULT 'LEVEL1');
---
>                       failover_restore IN VARCHAR2 DEFAULT 'LEVEL1',
>                       replay_initiation_timeout IN BINARY_INTEGER DEFAULT NULL);
84a86
>   --    replay_initiation_timeout - replay initiation timeout
90c92,94
<                        failover_restore IN VARCHAR2 DEFAULT 'AUTO');
---
>                        failover_restore IN VARCHAR2 DEFAULT 'AUTO',
>                        replay_initiation_timeout IN BINARY_INTEGER
>                                                      DEFAULT NULL);
96a101
>   --    replay_initiation_timeout - replay initiation timeout
144a150,163
>   --
>   -- error
>   --    Appropriate error raised by server.
> 
>   PROCEDURE set_draining(service_name IN VARCHAR2,
>                          drain_timeout IN BINARY_INTEGER DEFAULT NULL,
>                          stop_option IN VARCHAR2 DEFAULT NULL);
>   -- This procedure sets session drain timeout and stop_option for the given
>   -- service
>   --
>   -- Input Parameter(s):
>   --    service_name - Service name
>   --    drain_timeout - Integer in second for session drain timeout
>   --    Service stop_option: NONE, TRANSACTIONAL, IMMEDIATE
SYS.DBMS_AUTOTASK_PRVT - PACKAGE (RU):
50c50,51
< PROCEDURE RUN_AUTOTASK(TASK_ID      IN PLS_INTEGER);
---
> PROCEDURE RUN_AUTOTASK(TASK_ID      IN PLS_INTEGER,
>                        MAGIC_NUM    IN NUMBER);
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.6RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.06.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.06.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.06.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.06.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.06.00.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('19.06.01.00', '.');
>   msn  CONSTANT NUMBER := instr('19.06.01.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('19.06.01.00', '.', msn + 1);
29c29
<                            to_number(substr('19.06.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.06.01.00', 1, fsn - 1));
31c31
<                to_number(substr('19.06.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.06.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.06.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.06.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.06.00.00',  psn + 1));
---
>                              to_number(substr('19.06.01.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.5RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.05.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.05.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.05.01.00', '.');
<   msn  CONSTANT NUMBER := instr('19.05.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.05.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('19.05.02.00', '.');
>   msn  CONSTANT NUMBER := instr('19.05.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('19.05.02.00', '.', msn + 1);
29c29
<                            to_number(substr('19.05.01.00', 1, fsn - 1));
---
>                            to_number(substr('19.05.02.00', 1, fsn - 1));
31c31
<                to_number(substr('19.05.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.05.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.05.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.05.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.05.01.00',  psn + 1));
---
>                              to_number(substr('19.05.02.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.06.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.07.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.06.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.06.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.06.00.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('19.07.00.00', '.');
>   msn  CONSTANT NUMBER := instr('19.07.00.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('19.07.00.00', '.', msn + 1);
29c29
<                            to_number(substr('19.06.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.07.00.00', 1, fsn - 1));
31c31
<                to_number(substr('19.06.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.07.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.06.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.07.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.06.00.00',  psn + 1));
---
>                              to_number(substr('19.07.00.00',  psn + 1));
SYS.DBMS_HADOOP_INTERNAL - PACKAGE (RU):
291,318d290
< -- NAME: MERGE_PARTITIONS
< --
< -- DESCRIPTION: Given a local list partitioned Oracle table and details about a
< --              partitioned Hive table, merge the Hive partitions onto the local
< --              Oracle table.
< --
< -- PARAMETERS: partnList - partnList to be added, if any
< --             CLUSTER_ID   - Hadoop cluster id
< --             DB_NAME      - database name
< --             HIVE_TABLE_NAME  - Hive table name
< --             HYPT_TAB_NAME  - Hybrid table name
< --             HYPT_TAB_OWNER - Hybrid table owner
< --             PERFORM_DDL  - If TRUE, merge the Hive partitions to local table
< -- RETURNS:
< --            Any newly added hive partitions since the last sync or
< --            hybrid table creation.
< --
< FUNCTION MERGE_PARTITIONS(
<                      PARTNLIST IN CLOB,
<                      CLUSTER_ID IN VARCHAR2,
<                      DB_NAME IN VARCHAR2,
<                      HIVE_TABLE_NAME IN VARCHAR2,
<                      HYPT_TAB_NAME IN VARCHAR2,
<                      HYPT_TAB_OWNER IN VARCHAR2,
<                      PERFORM_DDL IN BOOLEAN
< ) RETURN CLOB;
< 
< 
SYS.DBMS_JSON0 - PACKAGE (RU):
25a26,27
> FUNCTION  CHECKPK(OWNER VARCHAR2,
>                   TABLENAME VARCHAR2) RETURN BOOLEAN;
SYS.DBMS_REDACT_INT - PACKAGE (RU):
1c1,3
< PACKAGE dbms_redact_int AS
---
> PACKAGE dbms_redact_int 
> ACCESSIBLE BY (SYS.DBMS_REDACT)
> AS
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '19.6.0.0.0';
---
>                                '19.7.0.0.0';
SYS.DBMS_REGISTRY - PACKAGE (19.5RUR):
13c13
<                                '19.5.1.0.0';
---
>                                '19.5.2.0.0';
SYS.DBMS_REGISTRY - PACKAGE (19.6RUR):
13c13
<                                '19.6.0.0.0';
---
>                                '19.6.1.0.0';
SYS.DBMS_REPORT - PACKAGE (RU):
667c667,672
<   --
---
>   --    p_cloud_service_type
>   --                     (OUT)  - 0 NONE
>   --                              1 DWCS (Autonomous Data Warehouse)
>   --                              2 EECS (Exadata Express Cloud Service)
>   --                              3 PAAS (Platform As A Service (MDBCS))
>   --                              4 OLTP (ATP)
678c683,684
<     p_packs                 OUT      NUMBER
---
>     p_packs                 OUT      NUMBER,
>     p_cloud_service_type    OUT      NUMBER
SYS.DBMS_RLS_INT - PACKAGE (RU):
1c1,3
< PACKAGE dbms_rls_int AS
---
> PACKAGE dbms_rls_int 
> ACCESSIBLE BY (SYS.DBMS_RLS)
> AS
21c23,24
<                        CPS             IN BOOLEAN := FALSE);
---
>                        CPS             IN BOOLEAN := FALSE,
>                        INVOKER         IN VARCHAR2 := NULL);
29c32,33
<                        CPS             IN BOOLEAN := FALSE);
---
>                        CPS             IN BOOLEAN := FALSE,
>                        INVOKER         IN VARCHAR2 := NULL);
38c42,43
<                                  CPS             IN BOOLEAN := FALSE);
---
>                                  CPS             IN BOOLEAN := FALSE,
>                                  INVOKER         IN VARCHAR2 := NULL);
43c48,49
<                         CPS           IN BOOLEAN := FALSE);
---
>                         CPS           IN BOOLEAN := FALSE, 
>                         INVOKER         IN VARCHAR2 := NULL);
48c54,55
<                            CPS           IN BOOLEAN := FALSE);
---
>                            CPS           IN BOOLEAN := FALSE,
>                            INVOKER         IN VARCHAR2 := NULL);
54c61,62
<                           CPS           IN BOOLEAN := FALSE);
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER         IN VARCHAR2 := NULL);
59c67,68
<                                 CPS           IN BOOLEAN := FALSE);
---
>                                 CPS           IN BOOLEAN := FALSE,
>                                 INVOKER         IN VARCHAR2 := NULL);
77c86,87
<                                 CPS             IN BOOLEAN := FALSE);
---
>                                 CPS             IN BOOLEAN := FALSE,
>                                 INVOKER         IN VARCHAR2 := NULL);
83c93,94
<                         CPS             IN BOOLEAN := FALSE);
---
>                         CPS             IN BOOLEAN := FALSE,
>                         INVOKER         IN VARCHAR2 := NULL);
88c99,100
<                                 CPS           IN BOOLEAN := FALSE);
---
>                                 CPS           IN BOOLEAN := FALSE,
>                                 INVOKER         IN VARCHAR2 := NULL);
94c106,107
<                                    CPS           IN BOOLEAN := FALSE);
---
>                                    CPS           IN BOOLEAN := FALSE,
>                                    INVOKER         IN VARCHAR2 := NULL);
100c113,114
<                         CPS             IN BOOLEAN := FALSE);
---
>                         CPS             IN BOOLEAN := FALSE,
>                         INVOKER         IN VARCHAR2 := NULL);
106c120,121
<                            CPS           IN BOOLEAN  := FALSE);
---
>                            CPS           IN BOOLEAN  := FALSE,
>                            INVOKER         IN VARCHAR2 := NULL);
113c128,129
<                           CPS           IN BOOLEAN := FALSE);
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER         IN VARCHAR2 := NULL);
120c136,137
<                           CPS           IN BOOLEAN := FALSE);
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER         IN VARCHAR2 := NULL);
SYS.DBMS_SQLTUNE_UTIL2 - PACKAGE (RU):
15a16,22
>   -- Cloud Service Type Constants
>   CLOUD_SERVICE_TYPE_NONE    CONSTANT VARCHAR2(30) := 'NONE';
>   CLOUD_SERVICE_TYPE_ADW     CONSTANT VARCHAR2(30) := 'DWCS';
>   CLOUD_SERVICE_TYPE_EXADATA CONSTANT VARCHAR2(30) := 'EECS';
>   CLOUD_SERVICE_TYPE_PAAS    CONSTANT VARCHAR2(30) := 'PAAS';
>   CLOUD_SERVICE_TYPE_ATP     CONSTANT VARCHAR2(30) := 'OLTP';
> 
351a359,389
>   RETURN BOOLEAN;
> 
>   -------------------------- get_cloud_service_type  --------------------------
>   -- NAME:
>   --     get_cloud_service_type
>   --
>   -- DESCRIPTION:
>   --     return value of _cloud_service_type parameter for cloud service type
>   --
>   -- RETURN:
>   --     NONE: None
>   --     DWCS: Autonomous Data Warehouse
>   --     EECS: Exadata Express Cloud Service
>   --     PAAS: Platform As A Service (MDBCS)
>   --     OLTP: ATP
>   -----------------------------------------------------------------------------
>   FUNCTION get_cloud_service_type
>   RETURN varchar2;
> 
>   --------------------------------- is_adw  -----------------------------------
>   -- NAME:
>   --     is_adw
>   --
>   -- DESCRIPTION:
>   --     check if current DB is Autonomous Data Warehouse
>   --
>   -- RETURN:
>   --     TRUE is current DB is Autonomous Data Warehouse
>   --     FALSE otherwise
>   -----------------------------------------------------------------------------
>   FUNCTION is_adw
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE (RU):
519,520c519,520
<   STAT_SGA_PARAM         CONSTANT BINARY_INTEGER := 160;
<   STAT_PGA_PARAM         CONSTANT BINARY_INTEGER := 161;
---
>   STAT_SGA_TARGET_PARAM_E  CONSTANT BINARY_INTEGER := 160;
>   STAT_PGA_TARGET_PARAM_E  CONSTANT BINARY_INTEGER := 161;
664a665,670
>   STAT_CPU_COUNT_B           CONSTANT BINARY_INTEGER := 310;
>   STAT_CPU_COUNT_E           CONSTANT BINARY_INTEGER := 311;
>   STAT_SGA_TARGET_PARAM_B    CONSTANT BINARY_INTEGER := 312;
>   STAT_PGA_TARGET_PARAM_B    CONSTANT BINARY_INTEGER := 313;
>   STAT_MEMORY_TARGET_B       CONSTANT BINARY_INTEGER := 314;
>   STAT_MEMORY_TARGET_E       CONSTANT BINARY_INTEGER := 315;
SYS.KUPU$UTILITIES_INT - PACKAGE (RU):
967a968,983
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> PROCEDURE SET_KGL_TIME_TO_WAIT_FOR_LOCKS (
>                 LWAIT_TIME IN NUMBER)
>           ACCESSIBLE BY (PACKAGE SYS.KUPW$WORKER);
> 
SYS.PRVTEMX_PERF - PACKAGE (RU):
71a72,97
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION ACTION_CANCEL_SQL_XML(
>     P_SID              IN   NUMBER,
>     P_SERIAL_NUM       IN   NUMBER,
>     P_INST_ID          IN   NUMBER DEFAULT NULL,
>     P_SQL_ID           IN   VARCHAR2,
>     P_SHOW_SQL         IN   NUMBER DEFAULT 0)
>   RETURN XMLTYPE;
SYS.PRVT_ASH_OMX - PACKAGE (RU):
42,44d41
<   
<   
<   
56d52
<     FILTERED        IN NUMBER   := NULL,
95,97d90
<   
<   
<   
110d102
<     FILTERED        IN NUMBER   := NULL,
SYS.PRVT_AWR_VIEWER - PACKAGE (RU):
421a422,423
>   
>   
433a436
>     INCLUDE_SQLS      IN NUMBER         DEFAULT NULL,
887a891,909
>   PROCEDURE CREATE_CONSUMER_GROUP_MAP(
>     P_CON_ID     IN     NUMBER,
>     P_AWR_PERIOD IN OUT NOCOPY PRVT_AWRV_METADATA,
>     P_CGRP_MAP   IN OUT NOCOPY PRVT_AWRV_INSTTAB);
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
917a940,1001
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION REPORT_ADW_WORKLOAD_REALTIME(
>     START_TIME        IN DATE           DEFAULT NULL,
>     END_TIME          IN DATE           DEFAULT NULL,
>     INST_ID_LOW       IN NUMBER         DEFAULT NULL,
>     INST_ID_HIGH      IN NUMBER         DEFAULT NULL,
>     SHOW_SQL          IN NUMBER         DEFAULT 0)
>   RETURN XMLTYPE;
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION REPORT_ADW_WORKLOAD_HISTORICAL(
>     START_TIME        IN DATE           DEFAULT NULL,
>     END_TIME          IN DATE           DEFAULT NULL,
>     DBID              IN NUMBER         DEFAULT NULL,
>     INST_ID           IN NUMBER         DEFAULT NULL,
>     SHOW_SQL          IN NUMBER         DEFAULT 0)
>   RETURN XMLTYPE;
> 
SYS.XS_DATA_SECURITY_INT - PACKAGE (RU):
1c1,3
< PACKAGE XS_DATA_SECURITY_INT AS
---
> PACKAGE XS_DATA_SECURITY_INT 
> ACCESSIBLE BY (SYS.XS_DATA_SECURITY)
> AS
79c81,82
<           ACLMV           IN VARCHAR2 := NULL
---
>           ACLMV           IN VARCHAR2 := NULL,
>           INVOKER         IN VARCHAR2 := NULL
84,87c87,91
<           POLICY IN VARCHAR2,
<           SCHEMA IN VARCHAR2,
<           OBJECT IN VARCHAR2,
<           ENABLE IN BOOLEAN
---
>           POLICY  IN VARCHAR2,
>           SCHEMA  IN VARCHAR2,
>           OBJECT  IN VARCHAR2,
>           ENABLE  IN BOOLEAN,
>           INVOKER IN VARCHAR2
92,94c96,99
<           POLICY IN VARCHAR2,
<           SCHEMA IN VARCHAR2,
<           OBJECT IN VARCHAR2
---
>           POLICY  IN VARCHAR2,
>           SCHEMA  IN VARCHAR2,
>           OBJECT  IN VARCHAR2,
>           INVOKER IN VARCHAR2
SYS.XS_DIAG_INT - PACKAGE (RU):
1c1,3
< PACKAGE XS_DIAG_INT AS
---
> PACKAGE XS_DIAG_INT 
> ACCESSIBLE BY (SYS.XS_DIAG)
> AS
14c16,17
<   FUNCTION VALIDATE_WORKSPACE(MSG_MAX  IN PLS_INTEGER := 1)
---
>   FUNCTION VALIDATE_WORKSPACE(MSG_MAX  IN PLS_INTEGER := 1,
>                               INVOKER  IN VARCHAR2)
20a24
>                            I_INVOKER    IN VARCHAR2,
SYS.DBMS_APP_CONT_ADMIN - PACKAGE BODY (RU):
9a10,12
>   
>   MAX_DRAIN_TIMEOUT                 CONSTANT NUMBER := 28800;
> 
202a206,207
> 
> 
204c209,210
<                     FAILOVER_RESTORE IN VARCHAR2 DEFAULT 'LEVEL1')
---
>                     FAILOVER_RESTORE IN VARCHAR2 DEFAULT 'LEVEL1',
>                     REPLAY_INITIATION_TIMEOUT IN BINARY_INTEGER DEFAULT NULL)
222c228,234
<   L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INIT_TIMEOUT_DEFAULT;
---
>   L_PARAMS('SESSION_STATE_CONSISTENCY') := 'DYNAMIC';
> 
>   IF REPLAY_INITIATION_TIMEOUT IS NULL THEN
>     L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INIT_TIMEOUT_DEFAULT;
>   ELSE
>     L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INITIATION_TIMEOUT;
>   END IF;
237a250,251
> 
> 
239c253,254
<                      FAILOVER_RESTORE IN VARCHAR2 DEFAULT 'AUTO')
---
>                      FAILOVER_RESTORE IN VARCHAR2 DEFAULT 'AUTO',
>                      REPLAY_INITIATION_TIMEOUT IN BINARY_INTEGER DEFAULT NULL)
257c272,278
<   L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INIT_TIMEOUT_DEFAULT;
---
>   L_PARAMS('SESSION_STATE_CONSISTENCY') := 'AUTO';
> 
>   IF REPLAY_INITIATION_TIMEOUT IS NULL THEN
>     L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INIT_TIMEOUT_DEFAULT;
>   ELSE
>     L_PARAMS('REPLAY_INITIATION_TIMEOUT') := REPLAY_INITIATION_TIMEOUT;
>   END IF;
300a322
>   L_PARAMS('SESSION_STATE_CONSISTENCY') := NULL;
379a402,443
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> PROCEDURE SET_DRAINING(SERVICE_NAME IN VARCHAR2,
>                        DRAIN_TIMEOUT IN BINARY_INTEGER DEFAULT NULL,
>                        STOP_OPTION IN VARCHAR2 DEFAULT NULL)
> IS
>   L_PARAMS DBMS_SERVICE.SVC_PARAMETER_ARRAY;
> BEGIN
>   
>   IF (DRAIN_TIMEOUT IS NULL AND STOP_OPTION IS NULL) THEN
>     RAISE_APPLICATION_ERROR(-20000, 'Draining parameter(s) unspecified');
>   END IF;
> 
>   IF (DRAIN_TIMEOUT IS NOT NULL) THEN
>     
>     
>     
>     L_PARAMS('DRAIN_TIMEOUT') := LEAST(DRAIN_TIMEOUT, MAX_DRAIN_TIMEOUT);
>   END IF;
> 
>   IF (STOP_OPTION IS NOT NULL) THEN
>     IF ((UPPER(STOP_OPTION) <> 'NONE') AND
>         (UPPER(STOP_OPTION) <> 'IMMEDIATE') AND 
>         (UPPER(STOP_OPTION) <> 'TRANSACTIONAL')) THEN
>       RAISE_APPLICATION_ERROR(-20000, 'Invalid stop_option parameter');
>     ELSE
>       L_PARAMS('STOP_OPTION') := UPPER(STOP_OPTION);
>     END IF;
>   END IF;
> 
>   
>   MODIFY_SERVICE(SERVICE_NAME, L_PARAMS);
> END SET_DRAINING;
SYS.DBMS_AUTOTASK_PRVT - PACKAGE BODY (RU):
176c176,177
<   TASK_ID      IN PLS_INTEGER
---
>   TASK_ID      IN PLS_INTEGER,
>   MAGIC_NUM    IN NUMBER
184,185c185,188
<     TASK_ID   SB4,
<     TASK_ID   INDICATOR SB2
---
>     TASK_ID         SB4,
>     TASK_ID         INDICATOR SB2,
>     MAGIC_NUM       OCINUMBER,
>     MAGIC_NUM       INDICATOR SB2
SYS.DBMS_AUTO_INDEX_INTERNAL - PACKAGE BODY (RU):
33,35c33,37
<   AI_TRC_PREFIX       VARCHAR2(4)           := 'AI: ';
<   AI_TRC_DBMS_OUTPUT  NUMBER                := 1;
<   AI_TRC_FILE         NUMBER                := 2;
---
>   AI_TRC_PREFIX       CONSTANT VARCHAR2(4)           := 'AI: ';
>   AI_TRC_DBMS_OUTPUT  CONSTANT NUMBER                := 1;
>   AI_TRC_FILE         CONSTANT NUMBER                := 2;
>   
>   AI_TRC_DEFAULT      CONSTANT NUMBER                := 0;
48a51,52
>   
>   AI_CTRL_DEFAULT               CONSTANT NUMBER     := 0;
300,302d303
<   AI_TRACE_DEFAULT              CONSTANT NUMBER := 0;
< 
<   
326,329c327
<                                                       AI_STS_CAPTURE_TASK_OFF;
< 
<   
<   AI_CONTROL_DEFAULT            CONSTANT NUMBER := 0;
---
>                                                       AI_STS_CAPTURE_TASK_ON;
433a432
>   AI_TABLE_SKIP_NONINTTAB       CONSTANT NUMBER     := 6;
826c825
<       TO_CLOB(AI_TRACE_DEFAULT)),
---
>       TO_CLOB(AI_TRC_DEFAULT)),
847c846
<       TO_CLOB(AI_CONTROL_DEFAULT)),
---
>       TO_CLOB(AI_CTRL_DEFAULT)),
877c876
<   TRACE_LEVEL                   NUMBER := AI_CONTROL_DEFAULT;
---
>   TRACE_LEVEL                   NUMBER := AI_TRC_DEFAULT;
3371a3371
>     INT_TAB      VARCHAR2(8);
3384,3387c3384,3392
<            MIN(OWNER), MIN(OBJECT_NAME), MIN(TEMPORARY), COUNT(*) 
<     INTO OWN, TAB, TEMP_TAB, NUM_TAB
<     FROM DBA_OBJECTS O
<     WHERE OBJECT_ID = OBJN AND OBJECT_TYPE = 'TABLE';
---
>       MIN(O.OWNER), MIN(O.OBJECT_NAME), MIN(O.TEMPORARY), COUNT(*),
>       MIN(CASE WHEN (BITAND(T.PROPERTY, POWER(2,90)) = POWER(2,90) OR 
>                  BITAND(T.PROPERTY, 2147483648) = 2147483648) 
>            THEN 'N' ELSE 'Y' END)
>     INTO OWN, TAB, TEMP_TAB, NUM_TAB, INT_TAB
>     FROM DBA_OBJECTS O, SYS.TAB$ T
>     WHERE O.OBJECT_ID = OBJN 
>       AND O.OBJECT_TYPE = 'TABLE'
>       AND O.OBJECT_ID = T.OBJ#;
3396a3402,3408
>     IF (INT_TAB = 'N') THEN
>       LOG_TABLE_SKIPPED(AI_CTX, OBJ_ID, AI_TABLE_SKIP_NONINTTAB, OWN, TAB);
>       RETURN AI_TABLE_SKIP_NONINTTAB;
>     END IF;
> 
>     
>     
4575c4587,4588
<                       AI_TABLE_SKIP_SMALLTAB, AI_TABLE_SKIP_TEMPTAB)) THEN
---
>                       AI_TABLE_SKIP_SMALLTAB, AI_TABLE_SKIP_TEMPTAB,
>                       AI_TABLE_SKIP_NONINTTAB)) THEN
6431a6445,6446
>     STS_COUNT        NUMBER;                     
>     STS_COUNT_STATS  NUMBER;                     
6442c6457
<     CHECK_AUTO_INDEX_ENABLED;
---
>     
6449c6464
<     SELECT COUNT(*) INTO VALID_STS 
---
>     SELECT COUNT(*) INTO STS_COUNT 
6458c6473
<     IF (VALID_STS = 0) THEN
---
>     IF (STS_COUNT = 0) THEN
6468a6484,6492
>     SELECT SUM(STATEMENT_COUNT) INTO STS_COUNT
>     FROM DBA_SQLSET 
>     WHERE CON_DBID = SYS_CONTEXT('userenv','con_dbid');
> 
>     SELECT SUM(NUM_ROWS) INTO STS_COUNT_STATS 
>     FROM DBA_TABLES 
>     WHERE OWNER = 'SYS' AND TABLE_NAME = 'WRI$_SQLSET_STATEMENTS';
> 
> 
6472c6496,6504
<     IF (BITAND(AI_CTRL, AI_CTRL_DIS_OPT_STATS) = 0) THEN
---
>     IF (BITAND(AI_CTRL, AI_CTRL_DIS_OPT_STATS) = 0 AND
>         
>         
>         
>         
>         (STS_COUNT_STATS IS NULL OR 
>          (STS_COUNT IS NOT NULL AND 
>           ABS(STS_COUNT_STATS - STS_COUNT)/(STS_COUNT_STATS+1) > .1))) THEN
> 
6488a6521,6527
>     
>     
>     
>     
>     
>     
>     
6503c6542,6554
<                  and plan_hash_value > 0 #')) P;
---
>                  and plan_hash_value > 0 
>                  and (con_dbid, force_matching_signature) not in
>                      (select /*+ unnest no_merge */ 
>                       sss.con_dbid, sss.force_matching_signature
>                       from wri$_sqlset_definitions ssf, wri$_sqlset_statements sss 
>                       where ssf.id = sss.sqlset_id 
>                         and ssf.con_dbid = sss.con_dbid
>                         and ssf.owner = '#' || AI_STS_OWN ||
>                         q'#' and ssf.name = '#' || AI_STS_NAME ||
>                         q'#' and ssf.con_dbid = sys_context('userenv','con_dbid')
>                         and force_matching_signature > 0
>                       group by sss.con_dbid, sss.sqlset_id, sss.force_matching_signature
>                       having count(*) > 1000) #')) P;
6517c6568,6572
<                              COMMIT_ROWS => 100);
---
>                              UPDATE_CONDITION => 
>                                q'# old.executions != new.executions or 
>                                    old.last_exec_start_time != 
>                                    new.last_exec_start_time #',
>                               COMMIT_ROWS => 100);
8794c8849
<           P_VALUE := AI_TRACE_DEFAULT;
---
>           P_VALUE := AI_TRC_DEFAULT;
8854c8909
<           P_VALUE := AI_CONTROL_DEFAULT;
---
>           P_VALUE := AI_CTRL_DEFAULT;
9421a9477,9480
>     
>     CONFIGURE(AI_PARAM_STS_CAPTURE_TASK, AI_STS_CAPTURE_TASK_DEFAULT, 
>               TRUE, TRUE);
> 
10252,10287c10311,10420
<     SELECT 
<            NVL(SUM(CASE WHEN V.VISIBILITY = 'VISIBLE' THEN 1 ELSE 0 END), 0),
<            NVL(SUM(CASE WHEN V.VISIBILITY = 'INVISIBLE' THEN 1 ELSE 0 END), 0),
<            NVL(SUM(CASE WHEN V.STATUS = 'UNUSABLE' THEN 1 ELSE 0 END), 0),
<            NVL(SUM(CASE WHEN V.VISIBILITY = 'VISIBLE' THEN V.BYTES 
<                                                       ELSE 0 END), 0),
<            NVL(SUM(CASE WHEN V.VISIBILITY = 'INVISIBLE' THEN V.BYTES 
<                                                         ELSE 0 END), 0)
<     INTO   UNUSED_VIS_IDX, UNUSED_INVIS_IDX, UNUSED_UNUSABLE_IDX,
<            UNUSED_SPACE_USED_VIS, UNUSED_SPACE_USED_INVIS
<     FROM   SYS.OBJ$ O, SYS.USER$ USR, 
<            (SELECT I.OWNER, I.INDEX_NAME, I.VISIBILITY, I.STATUS, S.BYTES
<             FROM DBA_INDEXES I, DBA_INDEX_USAGE U, DBA_SEGMENTS S,
<                  DBA_OBJECTS DO
<             WHERE U.NAME (+)= I.INDEX_NAME AND
<                   U.OWNER (+)= I.OWNER AND
<                   I.AUTO = 'NO' AND
<                   I.INDEX_NAME = DO.OBJECT_NAME AND
<                   I.OWNER = DO.OWNER AND
<                   DO.OBJECT_TYPE = 'INDEX' AND
<                   
<                   
<                   (
<                     (U.LAST_USED IS NULL AND DO.CREATED < IDX_RETENTION_TIME)
<                     OR
<                     U.LAST_USED < IDX_RETENTION_TIME
<                   ) AND
<                   I.INDEX_NAME = S.SEGMENT_NAME AND
<                   I.OWNER=S.OWNER AND
<                   S.SEGMENT_TYPE LIKE 'INDEX%'
<             GROUP BY I.OWNER, I.INDEX_NAME, I.VISIBILITY, I.STATUS,
<                      S.BYTES) V
<     WHERE V.OWNER = USR.NAME AND
<           V.INDEX_NAME = O.NAME AND
<           USR.USER# = O.OWNER# AND
<           BITAND(O.FLAGS, DBMS_STATS_INTERNAL.DSC_ORACLE_OWNED_OBJ) = 0;
---
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
>     
> 
>   SELECT 
>          NVL(SUM(CASE WHEN IX.VISIBILITY = 'VISIBLE'   THEN 1 ELSE 0 END),
>              0),
>          NVL(SUM(CASE WHEN IX.VISIBILITY = 'INVISIBLE' THEN 1 ELSE 0 END),
>              0),
>          
>          
>          
>          NVL(SUM(CASE WHEN IX.STATUS = 'UNUSABLE'
>                            OR (IX.STATUS = 'N/A' 
>                                AND (IX.UNUS_PART_CNT       > 0 
>                                     OR IX.UNUS_SUBPART_CNT > 0)) THEN 1
>                       ELSE 0 END),
>              0),
>          NVL(SUM(CASE WHEN IX.VISIBILITY = 'VISIBLE'   THEN IX.BYTES
>                       ELSE 0 END), 0),
>          NVL(SUM(CASE WHEN IX.VISIBILITY = 'INVISIBLE' THEN IX.BYTES
>                       ELSE 0 END), 0)
>   INTO UNUSED_VIS_IDX,
>        UNUSED_INVIS_IDX,
>        UNUSED_UNUSABLE_IDX,
>        UNUSED_SPACE_USED_VIS,
>        UNUSED_SPACE_USED_INVIS
>   FROM (SELECT IXPAR.OWNER       "OWNER",
>                IXPAR.NAME        "NAME",
>                IXPAR.STATUS      "STATUS",
>                IXPAR.VISIBILITY  "VISIBILITY",
>                SUM(IXPAR.BYTES)  "BYTES",
>                
>                
>                SUM(DECODE(NVL(IXPAR.PARTITION_STATUS, 'N/A'), 'UNUSABLE',
>                           1, 0)) "UNUS_PART_CNT",
>                SUM(DECODE(NVL(IXPAR.SUBPARTITION_STATUS, 'N/A'), 'UNUSABLE',
>                           1, 0)) "UNUS_SUBPART_CNT"
>         FROM (SELECT UMIX.OWNER      "OWNER",
>                      UMIX.NAME       "NAME",
>                      UMIX.STATUS     "STATUS",
>                      UMIX.VISIBILITY "VISIBILITY",
>                      SDBSEGS.BYTES   "BYTES",
>                      DBIXP.STATUS    "PARTITION_STATUS",
>                      DBIXSP.STATUS   "SUBPARTITION_STATUS"
>               FROM (SELECT /*+ NO_MERGE */
>                            DBIX.OWNER      "OWNER",
>                            DBIX.INDEX_NAME "NAME",
>                            DBIX.STATUS     "STATUS",
>                            DBIX.VISIBILITY "VISIBILITY"
>                     FROM DBA_INDEXES          "DBIX",
>                          SYS.USER$            "USR",
>                          SYS.OBJ$             "OBJ",
>                          SYS.WRI$_INDEX_USAGE "IXUS"
>                     WHERE DBIX.OWNER      = USR.NAME
>                       AND DBIX.INDEX_NAME = OBJ.NAME
>                       AND USR.USER#       = OBJ.OWNER#
>                       AND OBJ.OBJ#        = IXUS.OBJ#(+)
>                       AND DBIX.AUTO       = 'NO' 
>                       AND OBJ.TYPE#       = 1    
>                       AND OBJ.NAMESPACE   = 4    
>                       AND BITAND(OBJ.FLAGS,
>                                  DBMS_STATS_INTERNAL.DSC_ORACLE_OWNED_OBJ)
>                                           = 0    
>                       AND OBJ.REMOTEOWNER IS NULL
>                       AND OBJ.LINKNAME    IS NULL
>                       AND OBJ.SUBNAME     IS NULL
>                       AND ((IXUS.LAST_USED IS NULL
>                             AND OBJ.CTIME < IDX_RETENTION_TIME)
>                            OR IXUS.LAST_USED < IDX_RETENTION_TIME)
>                    )                     "UMIX",
>                    DBA_IND_PARTITIONS    "DBIXP",
>                    DBA_IND_SUBPARTITIONS "DBIXSP",
>                    SYS_DBA_SEGS          "SDBSEGS"
>               WHERE UMIX.NAME            = DBIXP.INDEX_NAME(+)
>                 AND UMIX.OWNER           = DBIXP.INDEX_OWNER(+)
>                 AND DBIXP.INDEX_NAME     = DBIXSP.INDEX_NAME(+)
>                 AND DBIXP.INDEX_OWNER    = DBIXSP.INDEX_OWNER(+)
>                 AND DBIXP.PARTITION_NAME = DBIXSP.PARTITION_NAME(+)
>                 AND UMIX.NAME            = SDBSEGS.SEGMENT_NAME(+)
>                 AND UMIX.OWNER           = SDBSEGS.OWNER(+) 
>                 AND NVL(DBIXSP.SUBPARTITION_NAME,
>                         NVL(DBIXP.PARTITION_NAME, 'NON-PARTITIONED'))
>                                          =
>                     NVL(SDBSEGS.PARTITION_NAME, 'NON-PARTITIONED')
>              ) "IXPAR"
>         GROUP BY IXPAR.OWNER,
>                  IXPAR.NAME, 
>                  IXPAR.STATUS,
>                  IXPAR.VISIBILITY
>        ) "IX";
SYS.DBMS_AUTO_REPORT - PACKAGE BODY (RU):
3c3,60
<  
---
>   
>   
>   
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION I_ADD_LOCKDOWN_PREDICATES
>   RETURN VARCHAR2
>   IS
>     RETVAL      VARCHAR2(4000);
>   BEGIN
> 
>     
>     IF (SYS.DBMS_SQLTUNE_UTIL2.IS_SYSTEM_DATA_LOCKED = 'YES' AND
>         SYS.DBMS_SQLTUNE_UTIL2.IS_PDB) THEN
> 
>         RETVAL := 
>         q'[  report_summary is not NULL 
>          AND REGEXP_INSTR(report_summary,]' || q'['(\w*<user>C##)']'           
>                                             || q'[, 1, 1, 0, 'i') = 0 
>          AND REGEXP_INSTR(report_summary,]' || q'['(\w*<user>SYS</user>)']'    
>                                             || q'[, 1, 1, 0, 'i') = 0 
>          AND REGEXP_INSTR(report_summary,]' || q'['(\w*<user>SYSTEM</user>)']' 
>                                             || q'[, 1, 1, 0, 'i') = 0 
>          AND REGEXP_INSTR(report_summary,]' || q'['(\w*<service>SYS[$])']'     
>                                             || q'[, 1, 1, 0, 'i') = 0 ]';
> 
>     ELSE
>       RETVAL := '1=1';  
>     END IF;
>    
>     RETURN RETVAL;
> 
>   END I_ADD_LOCKDOWN_PREDICATES;  
> 
406c463,464
<                     where :dt1 <= pe and :dt2 >= ps and v2.rid = r.report_id) v
---
>                     where :dt1 <= pe and :dt2 >= ps and v2.rid = r.report_id
>                     AND   #ADW_FILTER_PREDICATE#) v
479a538,541
> 
>       
>       SUB_QRY := REPLACE(SUB_QRY, '#ADW_FILTER_PREDICATE#',
>                           DBMS_AUTO_REPORT.I_ADD_LOCKDOWN_PREDICATES());  
SYS.DBMS_HADOOP - PACKAGE BODY (RU):
214a215,369
> 
> 
> 
> 
> FUNCTION MERGE_PARTITIONS(
>                      PARTNLIST IN CLOB,
>                      CLUSTER_ID IN VARCHAR2,
>                      DB_NAME IN VARCHAR2,
>                      HIVE_TABLE_NAME IN VARCHAR2,
>                      HYPT_TAB_NAME IN VARCHAR2,
>                      HYPT_TAB_OWNER IN VARCHAR2,
>                      PERFORM_DDL IN BOOLEAN
> ) RETURN CLOB
>    IS
>    KEYPOS1 NUMBER := 0;
>    PARTNCNT NUMBER := 0;
>    PARTKEYCNT NUMBER := 0;
>    CNT NUMBER := 0;
>    CURKEY VARCHAR2(42) := NULL;
>    ORIGKEY VARCHAR2(4000) := NULL;
>    PARTKEYVALS CLOB := NULL;
>    PARTKEY VARCHAR2(ORA_MAX_NAME_LEN);
>    PARTKEYTYPE VARCHAR2(ORA_MAX_NAME_LEN);
>    PARTKEYCHAR BOOLEAN := FALSE;
>    SYNCPARTITIONDDL VARCHAR2(4000) := '';
>    MAX_BUCKETS NUMBER := 999999999;      
>    CUR INTEGER;
>    FDBK INTEGER;
>    SECURE_PARTNLIST CLOB := NULL;
>    HYPT_TAB_NAME_DQR VARCHAR2(ORA_MAX_NAME_LEN);
>    HYPT_TAB_OWNER_DQR VARCHAR2(ORA_MAX_NAME_LEN);
>    SEC_HYPT_TAB_NAME VARCHAR2(ORA_MAX_NAME_LEN+2);
>    SEC_HYPT_TAB_OWNER VARCHAR2(ORA_MAX_NAME_LEN+2);
>    PARTNINFO CLOB := NULL;
> BEGIN
>    SECURE_PARTNLIST := SYS.DBMS_ASSERT.ENQUOTE_NAME(PARTNLIST, FALSE);
>    SEC_HYPT_TAB_NAME := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(HYPT_TAB_NAME);
>    SEC_HYPT_TAB_OWNER := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(HYPT_TAB_OWNER);
> 
>    PARTNINFO := NULL;
>    KEYPOS1 := 2;   
>    PARTNCNT := DBMS_HADOOP_INTERNAL.GETNUMBEROFITEMS(PARTNLIST, ',');  
> 
>    WHILE (CNT < PARTNCNT)
>    LOOP
>      IF (CNT < PARTNCNT - 1) THEN
>        CURKEY := SUBSTR(SECURE_PARTNLIST, KEYPOS1, INSTR(SECURE_PARTNLIST, ',', KEYPOS1, 1)-KEYPOS1);  
>      ELSE
>        CURKEY := SUBSTR(SECURE_PARTNLIST, KEYPOS1);  
>        CURKEY := REPLACE(CURKEY, '"', '');
>      END IF;
> 
>      
>      HYPT_TAB_NAME_DQR := DBMS_HADOOP_INTERNAL.REMOVE_DOUBLE_QUOTE(HYPT_TAB_NAME);
>      HYPT_TAB_OWNER_DQR := DBMS_HADOOP_INTERNAL.REMOVE_DOUBLE_QUOTE(HYPT_TAB_OWNER);
> 
>      
>      SELECT HP.PARTITION_SPECS INTO ORIGKEY
>      FROM USER_HIVE_TAB_PARTITIONS HP
>      WHERE  CONCAT('P_', ORA_HASH(HP.PARTITION_SPECS, MAX_BUCKETS, 100)) = CURKEY AND
>             HP.TABLE_NAME = HIVE_TABLE_NAME AND
>             HP.CLUSTER_ID = CLUSTER_ID AND
>             HP.DATABASE_NAME= DB_NAME;
> 
>      PARTKEY := SUBSTR(ORIGKEY, 1, INSTR(ORIGKEY, '=') - 1);
> 
>      PARTKEYCNT := DBMS_HADOOP_INTERNAL.GETNUMBEROFITEMS(ORIGKEY, '/');              
>      PARTKEYVALS := DBMS_HADOOP_INTERNAL.GETPARTKEYVALUES(ORIGKEY, PARTKEYCNT);      
> 
>      CURKEY := SYS.DBMS_ASSERT.ENQUOTE_NAME(CURKEY, FALSE);
> 
>      SELECT COLUMN_TYPE INTO PARTKEYTYPE
>      FROM USER_HIVE_PART_KEY_COLUMNS PK
>      WHERE PK.TABLE_NAME = HIVE_TABLE_NAME AND
>            PK.CLUSTER_ID = CLUSTER_ID AND
>            PK.DATABASE_NAME = DB_NAME AND
>            PK.COLUMN_NAME = PARTKEY;
> 
>      IF (INSTR(UPPER(PARTKEYTYPE), 'CHAR') > 0) THEN
>         PARTKEYCHAR := TRUE;
>      END IF;      
> 
>      SYNCPARTITIONDDL := 'ALTER TABLE ' || SEC_HYPT_TAB_OWNER || '.' || SEC_HYPT_TAB_NAME ||
>                              ' ADD PARTITION ';
>      SYNCPARTITIONDDL := SYNCPARTITIONDDL || CURKEY;
> 
>       SYNCPARTITIONDDL := SYNCPARTITIONDDL || ' VALUES (';
> 
>      IF (PARTKEYCHAR = TRUE) THEN
>        SYNCPARTITIONDDL := SYNCPARTITIONDDL || '''' || PARTKEYVALS || ''')';
>      ELSE
>        SYNCPARTITIONDDL := SYNCPARTITIONDDL || PARTKEYVALS || ')';
>      END IF;
> 
>      IF (DBMS_HADOOP_INTERNAL.IS_HYPT(SEC_HYPT_TAB_NAME, SEC_HYPT_TAB_OWNER) = 1) THEN
>         SYNCPARTITIONDDL := SYNCPARTITIONDDL || ' EXTERNAL DEFAULT DIRECTORY DEFAULT_DIR';
>      ELSE
>         SYNCPARTITIONDDL := SYNCPARTITIONDDL || ' DEFAULT DIRECTORY DEFAULT_DIR';
>      END IF;
> 
>      PARTNINFO := PARTNINFO || 'PARTITION ' || CURKEY ||  ' VALUES (';
> 
>      IF (PARTKEYCHAR = TRUE) THEN
>        PARTNINFO := PARTNINFO || '''' || PARTKEYVALS || ''')';
>      ELSE
>        PARTNINFO := PARTNINFO || PARTKEYVALS || ')';
>      END IF;
> 
>      PARTNINFO := PARTNINFO || ' EXTERNAL DEFAULT DIRECTORY DEFAULT_DIR';
> 
>      IF (CNT < PARTNCNT - 1) THEN
>         PARTNINFO := PARTNINFO || ',' || CHR(10);
>      ELSE
>         PARTNINFO := PARTNINFO || ')';
>      END IF;
> 
>      IF (PERFORM_DDL = TRUE) THEN
>        BEGIN
>          CUR := DBMS_SQL.OPEN_CURSOR;
>          DBMS_SQL.PARSE(CUR, SYNCPARTITIONDDL, DBMS_SQL.NATIVE);
>          FDBK := DBMS_SQL.EXECUTE(CUR);
>          DBMS_SQL.CLOSE_CURSOR(CUR);
> 
>        EXCEPTION WHEN OTHERS THEN
>          IF DBMS_SQL.IS_OPEN(CUR) THEN
>             DBMS_SQL.CLOSE_CURSOR(CUR);
>          END IF;
>          RAISE;
>        END;
>      END IF;
> 
>      KEYPOS1 := KEYPOS1 + LENGTH(CURKEY) - 1; 
> 
>      CNT := CNT +1;
>    END LOOP;
> 
>    RETURN PARTNINFO;
> 
> END MERGE_PARTITIONS;
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
367c522
<          PARTNINFO := DBMS_HADOOP_INTERNAL.MERGE_PARTITIONS(HIVE_PARTITIONS,
---
>          PARTNINFO := MERGE_PARTITIONS(HIVE_PARTITIONS,
383c538
<          PARTNINFO := DBMS_HADOOP_INTERNAL.MERGE_PARTITIONS(OTHER_HIVE_PARTNS,
---
>          PARTNINFO := MERGE_PARTITIONS(OTHER_HIVE_PARTNS,
397c552
<          PARTNINFO := DBMS_HADOOP_INTERNAL.MERGE_PARTITIONS(FIRST_HIVE_PARTN,
---
>          PARTNINFO := MERGE_PARTITIONS(FIRST_HIVE_PARTN,
409c564
<          PARTNINFO := DBMS_HADOOP_INTERNAL.MERGE_PARTITIONS(OTHER_HIVE_PARTNS,
---
>          PARTNINFO := MERGE_PARTITIONS(OTHER_HIVE_PARTNS,
763c918
<       PARTNINFO := DBMS_HADOOP_INTERNAL.MERGE_PARTITIONS(PARTNS_ADDED, 
---
>       PARTNINFO := MERGE_PARTITIONS(PARTNS_ADDED, 
SYS.DBMS_HADOOP_INTERNAL - PACKAGE BODY (RU):
629d628
< 
646a646,648
>    PARTKEY VARCHAR2(ORA_MAX_NAME_LEN);
>    PARTKEYTYPE VARCHAR2(ORA_MAX_NAME_LEN);
>    PARTKEYCHAR BOOLEAN := FALSE;
686a689,690
>      PARTKEY := SUBSTR(ORIGKEY, 1, INSTR(ORIGKEY, '=') - 1);
> 
691a696,706
>      SELECT COLUMN_TYPE INTO PARTKEYTYPE
>      FROM DBA_HIVE_PART_KEY_COLUMNS PK
>      WHERE PK.TABLE_NAME = HIVE_TABLE_NAME AND
>            PK.CLUSTER_ID = CLUSTER_ID AND
>            PK.DATABASE_NAME = DB_NAME AND
>            PK.COLUMN_NAME = PARTKEY;
> 
>      IF (INSTR(UPPER(PARTKEYTYPE), 'CHAR') > 0) THEN
>         PARTKEYCHAR := TRUE;
>      END IF;      
> 
694,695c709,717
<      SYNCPARTITIONDDL := SYNCPARTITIONDDL || CURKEY ;
<      SYNCPARTITIONDDL := SYNCPARTITIONDDL || ' VALUES (' || PARTKEYVALS || ')';
---
>      SYNCPARTITIONDDL := SYNCPARTITIONDDL || CURKEY;
> 
>       SYNCPARTITIONDDL := SYNCPARTITIONDDL || ' VALUES (';
> 
>      IF (PARTKEYCHAR = TRUE) THEN
>        SYNCPARTITIONDDL := SYNCPARTITIONDDL || '''' || PARTKEYVALS || ''')';
>      ELSE
>        SYNCPARTITIONDDL := SYNCPARTITIONDDL || PARTKEYVALS || ')';
>      END IF;
703c725,732
<      PARTNINFO := PARTNINFO || 'PARTITION ' || CURKEY ||  ' VALUES (' || PARTKEYVALS || ')';
---
>      PARTNINFO := PARTNINFO || 'PARTITION ' || CURKEY ||  ' VALUES (';
> 
>      IF (PARTKEYCHAR = TRUE) THEN
>        PARTNINFO := PARTNINFO || '''' || PARTKEYVALS || ''')';
>      ELSE
>        PARTNINFO := PARTNINFO || PARTKEYVALS || ')';
>      END IF;
> 
SYS.DBMS_JSON0 - PACKAGE BODY (RU):
64,65d63
<   JCNM        VARCHAR2(130) := JCOLNAME;
<   TBNM        VARCHAR2(130) := TABLENAME;
69c67
<   IF (JCNM IS NULL OR TBNM IS NULL) THEN
---
>   IF (JCOLNAME IS NULL OR TABLENAME IS NULL) THEN
92c90
<   USING JCNM, TBNM, OWNER;
---
>   USING JCOLNAME, TABLENAME, OWNER;
205a204,230
>   END IF;
> 
>   RETURN RET;
> END;
> 
> 
> 
> 
> FUNCTION  CHECKPK(OWNER VARCHAR2,
>                   TABLENAME VARCHAR2) RETURN BOOLEAN
> IS
>   RET BOOLEAN := FALSE;
>   CNT NUMBER;
> BEGIN
>   EXECUTE IMMEDIATE 
>     'select count(1) 
>      from DBA_CONS_COLUMNS COL, DBA_CONSTRAINTS CONS
>      where CONS.OWNER = COL.OWNER AND 
>            CONS.TABLE_NAME = COL.TABLE_NAME AND 
>            CONS.CONSTRAINT_NAME = COL.CONSTRAINT_NAME AND
>            CONS.CONSTRAINT_TYPE = ''P'' AND 
>            COL.OWNER = :1 AND COL.TABLE_NAME = :2'
>   INTO CNT
>   USING OWNER, TABLENAME;
> 
>   IF (CNT > 0) THEN
>     RET := TRUE;
SYS.DBMS_PART - PACKAGE BODY (RU):
58,62c58,72
<   CURSOR DIRTY_INDEX_CUR(SCH VARCHAR2, TBL VARCHAR2, ORPH_ONLY INT) IS
<     SELECT IOE.INDEX_OBJECT_ID IDX_OBJ#,
<            IOE.INDEX_OWNER     IDX_OWNER,
<            IOE.INDEX_NAME      IDX_NAME,
<            IOE.INDEX_SUBNAME   IDX_SUBNAME
---
>   TYPE OBJNTABLE IS TABLE OF INTEGER;
> 
>   CURSOR DIRTY_INDEX_CUR_ALL IS
>     SELECT DISTINCT IOE.INDEX_OBJECT_ID IDX_OBJ#
>       FROM SYS.INDEX_ORPHANED_ENTRY_V$ IOE
>       WHERE IOE.TYPE != 'H';
> 
>   CURSOR DIRTY_INDEX_CUR_SCHEMA(SCH VARCHAR2) IS
>     SELECT DISTINCT IOE.INDEX_OBJECT_ID IDX_OBJ#
>       FROM SYS.INDEX_ORPHANED_ENTRY_V$ IOE
>       WHERE IOE.TYPE != 'H'
>         AND IOE.TABLE_OWNER = SCH;
> 
>   CURSOR DIRTY_INDEX_CUR_TABLE(SCH VARCHAR2, TBL VARCHAR2) IS
>     SELECT DISTINCT IOE.INDEX_OBJECT_ID IDX_OBJ#
64,74c74,76
<       WHERE (SCH IS NULL OR IOE.TABLE_OWNER = SCH)
<         AND (TBL IS NULL OR IOE.TABLE_NAME  = TBL)
<             
<         AND IOE.TYPE != 'H'
<             
<         AND NOT (ORPH_ONLY = 0 AND IOE.TYPE = 'O')
<             
<         AND NOT (ORPH_ONLY != 0 AND
<                  EXISTS (SELECT * FROM SYS.INDEX_ORPHANED_ENTRY_V$ IOE2
<                            WHERE IOE.INDEX_OBJECT_ID = IOE2.INDEX_OBJECT_ID
<                              AND IOE2.TYPE = 'R'));
---
>       WHERE IOE.TYPE != 'H'
>         AND IOE.TABLE_OWNER = SCH
>         AND IOE.TABLE_NAME  = TBL;
80,85c82,85
<   ORPHANS_ONLY    INT;
<   IDX_OWNER       VARCHAR2(512);
<   IDX_NAME        VARCHAR2(512);
<   IDX_SUBNAME     VARCHAR2(512);
<   TMPSTR          VARCHAR2(512);
<   SQLSTR          VARCHAR2(32767);
---
>   INDOBJNTBL      OBJNTABLE;
>   ORPHANS_ONLY    BOOLEAN;
>   HASR            BOOLEAN;
>   HASO            BOOLEAN;
131c131
<   ORPHANS_ONLY := NVL(ORPHANS_ONLY_IN, 0);
---
>   ORPHANS_ONLY := (NVL(ORPHANS_ONLY_IN, 0) != 0);
158c158,179
<   FOR INDEX_REC IN DIRTY_INDEX_CUR(SCHEMA_NAME, TABLE_NAME, ORPHANS_ONLY) LOOP
---
>   IF SCHEMA_NAME IS NULL AND TABLE_NAME IS NULL THEN
>     OPEN DIRTY_INDEX_CUR_ALL;
>     FETCH DIRTY_INDEX_CUR_ALL
>       BULK COLLECT INTO INDOBJNTBL;
>     CLOSE DIRTY_INDEX_CUR_ALL;
>   ELSIF TABLE_NAME IS NULL THEN
>     OPEN DIRTY_INDEX_CUR_SCHEMA(SCHEMA_NAME);
>     FETCH DIRTY_INDEX_CUR_SCHEMA
>       BULK COLLECT INTO INDOBJNTBL;
>     CLOSE DIRTY_INDEX_CUR_SCHEMA;
>   ELSE
>     OPEN DIRTY_INDEX_CUR_TABLE(SCHEMA_NAME, TABLE_NAME);
>     FETCH DIRTY_INDEX_CUR_TABLE
>       BULK COLLECT INTO INDOBJNTBL;
>     CLOSE DIRTY_INDEX_CUR_TABLE;
>   END IF;
> 
>   IF INDOBJNTBL IS NULL OR INDOBJNTBL.COUNT = 0 THEN
>     GOTO DONE;
>   END IF;
> 
>   FOR I IN INDOBJNTBL.FIRST .. INDOBJNTBL.LAST LOOP
163,174c184,199
<     SQLSTR := 'select count(*) from SYS.INDEX_ORPHANED_ENTRY_V$ ioe
<                  where ioe.index_object_id = :1 and ioe.type != ''H'' and ';
< 
<     IF (ORPHANS_ONLY = 0) THEN
<       SQLSTR := SQLSTR || 'ioe.type != ''O''';
<     ELSE
<       SQLSTR := SQLSTR
<              || 'NOT EXISTS '
<              || '(select * from SYS.INDEX_ORPHANED_ENTRY_V$ ioe2
<                   where ioe.index_object_id = ioe2.index_object_id
<                     and ioe2.type = ''R''
<                  )';
---
>     
>     HASR := FALSE;
>     HASO := FALSE;
>     FOR TYP IN (SELECT DISTINCT IOE.TYPE FROM SYS.INDEX_ORPHANED_ENTRY_V$ IOE
>                   WHERE IOE.INDEX_OBJECT_ID = INDOBJNTBL(I)
>                     AND IOE.TYPE != 'H') LOOP
>       HASR := HASR OR TYP.TYPE = 'R';   
>       HASO := HASO OR TYP.TYPE = 'O';
>     END LOOP;
> 
>     IF ORPHANS_ONLY AND NOT (HASO AND NOT HASR) THEN
>       
>       CONTINUE;
>     ELSIF NOT ORPHANS_ONLY AND NOT HASR THEN
>       
>       CONTINUE;
176,178d200
<     SQLSTR := SQLSTR || ' and rownum < 2';
< 
<     EXECUTE IMMEDIATE SQLSTR INTO CNT USING INDEX_REC.IDX_OBJ#;
181,186c203,206
<     IF CNT > 0 THEN
<       BEGIN
<         EXEC_ALTER_INDEX_COALESCE(INDEX_REC.IDX_OBJ#, PARALLEL,
<                                   OPTIONS != 'COALESCE');
< 
<         COMPLETED := COMPLETED + 1;
---
>     BEGIN
>       EXEC_ALTER_INDEX_COALESCE(INDOBJNTBL(I), PARALLEL,
>                                 OPTIONS != 'COALESCE');
>       COMPLETED := COMPLETED + 1;
188c208
<       EXCEPTION WHEN OTHERS THEN
---
>     EXCEPTION WHEN OTHERS THEN
190,197c210,217
<         IF SQLCODE = -1418  OR   
<            SQLCODE = -2149  OR   
<            SQLCODE = -8111  OR   
<            SQLCODE = -14075 THEN 
<           NULL;
<         ELSE
<           RAISE;
<         END IF;
---
>       IF SQLCODE = -1418  OR   
>          SQLCODE = -2149  OR   
>          SQLCODE = -8111  OR   
>          SQLCODE = -14075 THEN 
>         NULL;
>       ELSE
>         RAISE;
>       END IF;
199,201c219
<       END;
<     END IF;
< 
---
>     END;
203a222
> <<DONE>>
SYS.DBMS_PERF - PACKAGE BODY (RU):
1136a1137,1145
>       PROCEDURE INIT_OMX_REPORT_LEVEL
>       IS
>       BEGIN
>         
>         
>         P_SUMMARY  := 0;
>         P_EXADATA  := 0;
>       END INIT_OMX_REPORT_LEVEL;
> 
1163a1173,1179
> 
>         
>         
>         IF (IS_OMX = 1) THEN
>           INIT_OMX_REPORT_LEVEL();
>         END IF;
> 
1283a1300,1304
>       
>       IF (IS_OMX = 1) THEN
>         INIT_OMX_REPORT_LEVEL();
>       END IF;
> 
1499,1529c1520,1521
< 
<     IF (L_IS_REALTIME = 1) THEN
<       
<       IF (L_SUMMARY = 1) THEN
<         
<         
<         L_SUMMARY_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
<                            SYS.PRVT_AWR_VIEWER.REPORT_METRICS_XML(
<                              START_TIME => NULL, 
<                              END_TIME   => L_OUTER_END_TIME,
<                              INST_ID    => INST_ID,
<                              DBID       => L_DBID,
<                              BUCKET_MAX_COUNT => NULL,
<                              BUCKET_INTERVAL  => NULL,
<                              INST_DETAIL      => NULL,
<                              REPORT_LEVEL     => NULL,
<                              SHOW_SQL         => NULL),
<                            ZLIB2BASE64 => L_COMPRESS_XML);
<       ELSIF ( (L_SUMMARY = 0) 
<             
<             
<             
<             
<             ) THEN 
<         
<         
<         
<         
<         
<         
<         
---
>     IF (IS_OMX != 1) THEN
>       IF (L_IS_REALTIME = 1) THEN
1530a1523,1551
>         IF (L_SUMMARY = 1) THEN
>           
>           
>           L_SUMMARY_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
>                              SYS.PRVT_AWR_VIEWER.REPORT_METRICS_XML(
>                                START_TIME => NULL, 
>                                END_TIME   => L_OUTER_END_TIME,
>                                INST_ID    => INST_ID,
>                                DBID       => L_DBID,
>                                BUCKET_MAX_COUNT => NULL,
>                                BUCKET_INTERVAL  => NULL,
>                                INST_DETAIL      => NULL,
>                                REPORT_LEVEL     => NULL,
>                                SHOW_SQL         => NULL),
>                              ZLIB2BASE64 => L_COMPRESS_XML);
>         ELSIF ( (L_SUMMARY = 0) 
>               
>               
>               
>               
>               ) THEN 
>           
>           
>           
>           
>           
>           
>           
>           
1531a1553,1565
>           L_SUMMARY_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
>                              SYS.PRVT_AWR_VIEWER.REPORT_AWR_XML(
>                                      START_TIME       => L_SELECTED_START_TIME,
>                                      END_TIME         => L_SELECTED_END_TIME,
>                                      INSTANCE_LIST    => TO_CHAR(INST_ID),
>                                      DBID             => L_DBID,
>                                      BUCKET_MAX_COUNT => NULL,
>                                      DATA_DETAIL      => 1,
>                                      SHOW_SQL         => NULL),
>                              ZLIB2BASE64 => L_COMPRESS_XML);
>         END IF;
>       
>       ELSE
1533,1541c1567,1575
<                            SYS.PRVT_AWR_VIEWER.REPORT_AWR_XML(
<                                    START_TIME       => L_SELECTED_START_TIME,
<                                    END_TIME         => L_SELECTED_END_TIME,
<                                    INSTANCE_LIST    => TO_CHAR(INST_ID),
<                                    DBID             => L_DBID,
<                                    BUCKET_MAX_COUNT => NULL,
<                                    DATA_DETAIL      => 1,
<                                    SHOW_SQL         => NULL),
<                            ZLIB2BASE64 => L_COMPRESS_XML);
---
>                              SYS.PRVT_AWR_VIEWER.REPORT_AWR_XML(
>                                      START_TIME       => L_SELECTED_START_TIME,
>                                      END_TIME         => L_SELECTED_END_TIME,
>                                      INSTANCE_LIST    => TO_CHAR(INST_ID),
>                                      DBID             => L_DBID,
>                                      BUCKET_MAX_COUNT => NULL,
>                                      DATA_DETAIL      => 1,
>                                      SHOW_SQL         => NULL),
>                              ZLIB2BASE64 => L_COMPRESS_XML);
1543,1575d1576
<     
<     ELSE
<       L_SUMMARY_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
<                            SYS.PRVT_AWR_VIEWER.REPORT_AWR_XML(
<                                    START_TIME       => L_SELECTED_START_TIME,
<                                    END_TIME         => L_SELECTED_END_TIME,
<                                    INSTANCE_LIST    => TO_CHAR(INST_ID),
<                                    DBID             => L_DBID,
<                                    BUCKET_MAX_COUNT => NULL,
<                                    DATA_DETAIL      => 1,
<                                    SHOW_SQL         => NULL),
<                            ZLIB2BASE64 => L_COMPRESS_XML);
<     END IF;
< 
<     
<     IF (SYS_CONTEXT('USERENV','CON_ID') = 1) THEN
<     
<       L_CONTAINERS_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
<                               SYS.PRVT_AWR_VIEWER.REPORT_CONTAINERS_XML(
<                                    P_IS_REALTIME => L_IS_REALTIME,
<                                    P_START_TIME  => L_SELECTED_START_TIME,
<                                    P_END_TIME    => L_SELECTED_END_TIME,
<                                    P_DBID       => L_DBID,
<                                    P_INST_ID     => INST_ID),                  
<                                 ZLIB2BASE64 => L_COMPRESS_XML);
<     
<     ELSIF ( (DBMS_SQLTUNE_UTIL2.IS_IMPORTED_CDB(L_DBID) = 
<                             DBMS_SQLTUNE_UTIL2.STR_YES) 
<             AND   
<             (DBMS_SQLTUNE_UTIL2.IS_IMPORTED_PDB(L_DBID) = 
<                             DBMS_SQLTUNE_UTIL2.STR_NO) 
<           )
<     THEN
1576a1578,1580
>       
>       IF (SYS_CONTEXT('USERENV','CON_ID') = 1) THEN
>       
1578,1584c1582,1605
<                               SYS.PRVT_AWR_VIEWER.REPORT_CONTAINERS_XML(
<                                    P_START_TIME => L_SELECTED_START_TIME,
<                                    P_END_TIME   => L_SELECTED_END_TIME,
<                                    P_DBID       => L_DBID,
<                                    P_INST_ID    => INST_ID),
<                                 ZLIB2BASE64 => L_COMPRESS_XML);
<     END IF; 
---
>                                 SYS.PRVT_AWR_VIEWER.REPORT_CONTAINERS_XML(
>                                      P_IS_REALTIME => L_IS_REALTIME,
>                                      P_START_TIME  => L_SELECTED_START_TIME,
>                                      P_END_TIME    => L_SELECTED_END_TIME,
>                                      P_DBID       => L_DBID,
>                                      P_INST_ID     => INST_ID),                  
>                                   ZLIB2BASE64 => L_COMPRESS_XML);
>       
>       ELSIF ( (DBMS_SQLTUNE_UTIL2.IS_IMPORTED_CDB(L_DBID) = 
>                               DBMS_SQLTUNE_UTIL2.STR_YES) 
>               AND   
>               (DBMS_SQLTUNE_UTIL2.IS_IMPORTED_PDB(L_DBID) = 
>                               DBMS_SQLTUNE_UTIL2.STR_NO) 
>             )
>       THEN
> 
>           L_CONTAINERS_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
>                                 SYS.PRVT_AWR_VIEWER.REPORT_CONTAINERS_XML(
>                                      P_START_TIME => L_SELECTED_START_TIME,
>                                      P_END_TIME   => L_SELECTED_END_TIME,
>                                      P_DBID       => L_DBID,
>                                      P_INST_ID    => INST_ID),
>                                   ZLIB2BASE64 => L_COMPRESS_XML);
>       END IF; 
1587,1593c1608,1614
<     
<     IF (L_RAC = 1) THEN
<       
<       L_IS_RAC := I_IS_RAC(P_IS_REALTIME => L_IS_REALTIME,
<                            P_TARGET_DBID => L_DBID,
<                            P_START_TIME => L_SELECTED_START_TIME,
<                            P_END_TIME  => L_SELECTED_END_TIME);
---
>       
>       IF (L_RAC = 1) THEN
>         
>         L_IS_RAC := I_IS_RAC(P_IS_REALTIME => L_IS_REALTIME,
>                              P_TARGET_DBID => L_DBID,
>                              P_START_TIME => L_SELECTED_START_TIME,
>                              P_END_TIME  => L_SELECTED_END_TIME);
1596,1606c1617,1627
<       IF (L_IS_RAC = 'yes') THEN
<         L_RAC_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
<                        SYS.PRVT_AWR_VIEWER.REPORT_RAC_XML(
<                                    START_TIME => L_SELECTED_START_TIME,
<                                    END_TIME   => L_SELECTED_END_TIME,
<                                    LAST_REFRESH_TIME => NULL,
<                                    INST_ID    => INST_ID,
<                                    DBID       => L_DBID,
<                                    IS_REALTIME => L_IS_REALTIME,
<                                    SHOW_SQL   => NULL),
<                            ZLIB2BASE64 => L_COMPRESS_XML);
---
>         IF (L_IS_RAC = 'yes') THEN
>           L_RAC_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(
>                          SYS.PRVT_AWR_VIEWER.REPORT_RAC_XML(
>                                      START_TIME => L_SELECTED_START_TIME,
>                                      END_TIME   => L_SELECTED_END_TIME,
>                                      LAST_REFRESH_TIME => NULL,
>                                      INST_ID    => INST_ID,
>                                      DBID       => L_DBID,
>                                      IS_REALTIME => L_IS_REALTIME,
>                                      SHOW_SQL   => NULL),
>                              ZLIB2BASE64 => L_COMPRESS_XML);
1607a1629
>         END IF;
1663c1685
<     IF (L_WORKLOAD = 1 AND IS_OMX = 0) THEN
---
>     IF (L_WORKLOAD = 1) THEN
2448d2469
<                           
2520d2540
<                             FILTERED        => 1,
3214d3233
<                             FILTERED        => 1,
SYS.DBMS_RCVMAN - PACKAGE BODY (19.5RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.02.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.06.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.07.00.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (19.6RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.06.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.06.01.00'; 
SYS.DBMS_REPORT - PACKAGE BODY (RU):
1055a1056,1060
>   EXCEPTION
>     WHEN OTHERS THEN
>       CONTENT_TYPE := CONTENT_TYPE_XML;
>       RETURN XMLTYPE('<mesg type="oraerr">'|| SQLERRM || 
>                      '</mesg>').GETCLOBVAL();
2011a2017,2021
>   
>   
>   
>   
>   
2021c2031,2032
<     P_PACKS                 OUT      NUMBER
---
>     P_PACKS                 OUT      NUMBER,
>     P_CLOUD_SERVICE_TYPE    OUT      NUMBER
2257a2269,2299
>     
>     IF (V_RESOLVED_DB_TYPE
>         IN (DBMS_SQLTUNE_UTIL2.DB_TYPE_PDB, DBMS_SQLTUNE_UTIL2.DB_TYPE_IMP)) 
>     THEN
>         SELECT CASE MAX(VALUE)
>                  WHEN 'DWCS' THEN 1
>                  WHEN 'EECS' THEN 2
>                  WHEN 'PAAS' THEN 3
>                  WHEN 'OLTP' THEN 4
>                  ELSE 0
>                END
>           INTO P_CLOUD_SERVICE_TYPE
>           FROM SYS.AWR_PDB_PARAMETER
>          WHERE DBID = P_DBID
>            AND SNAP_ID = V_END_SNAP
>            AND PARAMETER_NAME = '_cloud_service_type';
>     ELSE
>         SELECT CASE MAX(VALUE)
>                  WHEN 'DWCS' THEN 1
>                  WHEN 'EECS' THEN 2
>                  WHEN 'PAAS' THEN 3
>                  WHEN 'OLTP' THEN 4
>                  ELSE 0
>                END
>           INTO P_CLOUD_SERVICE_TYPE
>           FROM SYS.AWR_ROOT_PARAMETER
>          WHERE DBID = P_DBID
>            AND SNAP_ID = V_END_SNAP
>            AND PARAMETER_NAME = '_cloud_service_type';
>     END IF;
>       
SYS.DBMS_RLS - PACKAGE BODY (RU):
63c63,65
<                   ATTRIBUTE, CPS);
---
>                   ATTRIBUTE, CPS, 
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
98c100,102
<                   ATTRIBUTE, CPS);
---
>                   ATTRIBUTE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
130c134,136
<                   NAMESPACE, ATTRIBUTE, CPS);
---
>                   NAMESPACE, ATTRIBUTE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
154c160,162
<                   OBJECT_NAME,POLICY_NAME, CPS);
---
>                   OBJECT_NAME,POLICY_NAME, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
178c186,188
<                   OBJECT_NAME, POLICY_NAME, CPS);
---
>                   OBJECT_NAME, POLICY_NAME, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
204c214,216
<                   OBJECT_NAME, POLICY_NAME, ENABLE, CPS);
---
>                   OBJECT_NAME, POLICY_NAME, ENABLE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
226c238,240
<                   OBJECT_NAME,POLICY_GROUP, CPS);
---
>                   OBJECT_NAME,POLICY_GROUP, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
282c296,298
<                   ATTRIBUTE, CPS);
---
>                   ATTRIBUTE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
307c323,325
<                   OBJECT_NAME,NAMESPACE, ATTRIBUTE, CPS);
---
>                   OBJECT_NAME,NAMESPACE, ATTRIBUTE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
329c347,349
<                   OBJECT_NAME,POLICY_GROUP, CPS);
---
>                   OBJECT_NAME,POLICY_GROUP, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
354c374,376
<                   OBJECT_NAME,POLICY_GROUP, POLICY_NAME, CPS);
---
>                   OBJECT_NAME,POLICY_GROUP, POLICY_NAME, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
379c401,403
<                   OBJECT_NAME,NAMESPACE, ATTRIBUTE, CPS);
---
>                   OBJECT_NAME,NAMESPACE, ATTRIBUTE, CPS,
>                   DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
405c429,431
<                  OBJECT_NAME,GROUP_NAME, POLICY_NAME, CPS);
---
>                  OBJECT_NAME,GROUP_NAME, POLICY_NAME, CPS,
>                  DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
431c457,459
<                  OBJECT_NAME,GROUP_NAME, POLICY_NAME, ENABLE, CPS);
---
>                  OBJECT_NAME,GROUP_NAME, POLICY_NAME, ENABLE, CPS,
>                  DBMS_ASSERT.ENQUOTE_NAME(
>                      SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
449c477,479
<                    OBJECT_NAME,GROUP_NAME, POLICY_NAME, FALSE, CPS);
---
>                    OBJECT_NAME,GROUP_NAME, POLICY_NAME, FALSE, CPS,
>                    DBMS_ASSERT.ENQUOTE_NAME(
>                       SYS_CONTEXT('USERENV','CURRENT_USER'), FALSE));
SYS.DBMS_RLS_INT - PACKAGE BODY (RU):
38c38,39
<                        CPS             IN BOOLEAN  := FALSE) IS
---
>                        CPS             IN BOOLEAN  := FALSE,
>                        INVOKER         IN VARCHAR2) IS
40c41
<       NAME "kzraadp"
---
>       NAME "kzraadp1"
44,49c45,58
<                  OBJECT_SCHEMA   OCISTRING, OBJECT_SCHEMA   INDICATOR SB2, 
<                  OBJECT_NAME     OCISTRING, POLICY_NAME     OCISTRING, 
<                  FUNCTION_SCHEMA OCISTRING, FUNCTION_SCHEMA INDICATOR SB2,
<                  POLICY_FUNCTION OCISTRING, STATEMENT_TYPES OCISTRING, 
<                  STATEMENT_TYPES INDICATOR SB2, UPDATE_CHECK UB1, ENABLE UB1,
<                  STATIC_POLICY UB1, POLICY_TYPE SB4, POLICY_TYPE INDICATOR SB2,
---
>                  OBJECT_SCHEMA   OCISTRING,
>                  OBJECT_SCHEMA   INDICATOR SB2,
>                  OBJECT_NAME     OCISTRING,
>                  POLICY_NAME     OCISTRING,
>                  FUNCTION_SCHEMA OCISTRING,
>                  FUNCTION_SCHEMA INDICATOR SB2,
>                  POLICY_FUNCTION OCISTRING,
>                  STATEMENT_TYPES OCISTRING,
>                  STATEMENT_TYPES INDICATOR SB2,
>                  UPDATE_CHECK UB1,
>                  ENABLE UB1,
>                  STATIC_POLICY UB1,
>                  POLICY_TYPE SB4,
>                  POLICY_TYPE INDICATOR SB2,
51c60,61
<                  SEC_RELEVANT_COLS OCISTRING, SEC_RELEVANT_COLS INDICATOR SB2,
---
>                  SEC_RELEVANT_COLS OCISTRING,
>                  SEC_RELEVANT_COLS INDICATOR SB2,
54,55c64,69
<                  NAMESPACE       OCISTRING, NAMESPACE INDICATOR SB2,
<                  ATTRIBUTE     OCISTRING, ATTRIBUTE INDICATOR SB2, CPS UB1)
---
>                  NAMESPACE       OCISTRING,
>                  NAMESPACE INDICATOR SB2,
>                  ATTRIBUTE     OCISTRING,
>                  ATTRIBUTE INDICATOR SB2,
>                  CPS UB1,
>                  INVOKER       OCISTRING)
77c91,92
<                        CPS             IN BOOLEAN := FALSE) IS
---
>                        CPS             IN BOOLEAN := FALSE,
>                        INVOKER         IN VARCHAR2) IS
79c94
<       NAME "kzraealp"
---
>       NAME "kzraealp1"
83,86c98,107
<                  OBJECT_SCHEMA   OCISTRING, OBJECT_SCHEMA   INDICATOR SB2, 
<                  OBJECT_NAME     OCISTRING, POLICY_NAME     OCISTRING, 
<                  ALTER_OPTION          SB4, ALTER_OPTION    INDICATOR SB2,
<                  NAMESPACE       OCISTRING, ATTRIBUTE     OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA   OCISTRING,
>                  OBJECT_SCHEMA   INDICATOR SB2,
>                  OBJECT_NAME     OCISTRING,
>                  POLICY_NAME     OCISTRING, 
>                  ALTER_OPTION    SB4,
>                  ALTER_OPTION    INDICATOR SB2,
>                  NAMESPACE       OCISTRING,
>                  ATTRIBUTE       OCISTRING,
>                  CPS UB1,
>                  INVOKER         OCISTRING)
110c131,132
<                                  CPS             IN BOOLEAN := FALSE) IS
---
>                                  CPS             IN BOOLEAN := FALSE,
>                                  INVOKER         IN VARCHAR2) IS
112c134
<       NAME "kzraealgp"
---
>       NAME "kzraealgp1"
116,120c138,148
<                  OBJECT_SCHEMA   OCISTRING,     OBJECT_SCHEMA   INDICATOR SB2,
<                  OBJECT_NAME     OCISTRING,     POLICY_GROUP    OCISTRING, 
<                  POLICY_NAME     OCISTRING,     ALTER_OPTION          SB4, 
<                  ALTER_OPTION    INDICATOR SB2, NAMESPACE       OCISTRING, 
<                  ATTRIBUTE       OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA   OCISTRING,
>                  OBJECT_SCHEMA   INDICATOR SB2,
>                  OBJECT_NAME     OCISTRING,
>                  POLICY_GROUP    OCISTRING, 
>                  POLICY_NAME     OCISTRING,
>                  ALTER_OPTION    SB4, 
>                  ALTER_OPTION    INDICATOR SB2,
>                  NAMESPACE       OCISTRING,
>                  ATTRIBUTE       OCISTRING,
>                  CPS UB1,
>                  INVOKER         OCISTRING)
136c164,165
<                         CPS           IN BOOLEAN := FALSE) IS
---
>                         CPS           IN BOOLEAN := FALSE,
>                         INVOKER       IN VARCHAR2) IS
138c167
<       NAME "kzradrp"
---
>       NAME "kzradrp1"
142,143c171,176
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2, 
<                  OBJECT_NAME   OCISTRING, POLICY_NAME   OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2, 
>                  OBJECT_NAME   OCISTRING,
>                  POLICY_NAME   OCISTRING,
>                  CPS UB1,
>                  INVOKER         OCISTRING)
159c192,193
<                            CPS           IN BOOLEAN := FALSE) IS
---
>                            CPS           IN BOOLEAN := FALSE,
>                            INVOKER       IN VARCHAR2) IS
161c195
<       NAME "kzraflp"
---
>       NAME "kzraflp1"
165,167c199,206
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2, 
<                  OBJECT_NAME   OCISTRING, OBJECT_NAME  INDICATOR SB2,
<                  POLICY_NAME   OCISTRING, POLICY_NAME  INDICATOR SB2, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  OBJECT_NAME   INDICATOR SB2,
>                  POLICY_NAME   OCISTRING,
>                  POLICY_NAME   INDICATOR SB2,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
185c224,225
<                           CPS           IN BOOLEAN := FALSE ) IS
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER       IN VARCHAR2) IS
187c227
<       NAME "kzraenp"
---
>       NAME "kzraenp1"
191,193c231,237
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2, 
<                  OBJECT_NAME   OCISTRING, POLICY_NAME   OCISTRING, ENABLE UB1,
<                  CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  POLICY_NAME   OCISTRING,
>                  ENABLE        UB1,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
207c251,252
<                                 CPS           IN BOOLEAN := FALSE) IS
---
>                                 CPS           IN BOOLEAN := FALSE,
>                                 INVOKER       IN VARCHAR2) IS
209c254
<       NAME "kzracpg"
---
>       NAME "kzracpg1"
213,214c258,263
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, POLICY_GROUP  OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  POLICY_GROUP  OCISTRING,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
256,257c305,306
<                                CPS             IN BOOLEAN  := FALSE)
<                                IS
---
>                                CPS             IN BOOLEAN  := FALSE,
>                                INVOKER         IN VARCHAR2) IS
259c308
<       NAME "kzraptg"
---
>       NAME "kzraptg1"
263,264c312,315
<                  OBJECT_SCHEMA   OCISTRING, OBJECT_SCHEMA   INDICATOR SB2,
<                  OBJECT_NAME     OCISTRING, POLICY_GROUP    OCISTRING,
---
>                  OBJECT_SCHEMA   OCISTRING,
>                  OBJECT_SCHEMA   INDICATOR SB2,
>                  OBJECT_NAME     OCISTRING,
>                  POLICY_GROUP    OCISTRING,
266,271c317,329
<                  FUNCTION_SCHEMA OCISTRING, FUNCTION_SCHEMA INDICATOR SB2,
<                  POLICY_FUNCTION OCISTRING, STATEMENT_TYPES OCISTRING,
<                  STATEMENT_TYPES INDICATOR SB2, UPDATE_CHECK UB1, ENABLE UB1,
<                  STATIC_POLICY UB1, POLICY_TYPE SB4, POLICY_TYPE INDICATOR SB2,
<                  LONG_PREDICATE UB1,
<                  SEC_RELEVANT_COLS OCISTRING, SEC_RELEVANT_COLS INDICATOR SB2,
---
>                  FUNCTION_SCHEMA OCISTRING,
>                  FUNCTION_SCHEMA INDICATOR SB2,
>                  POLICY_FUNCTION OCISTRING,
>                  STATEMENT_TYPES OCISTRING,
>                  STATEMENT_TYPES INDICATOR SB2,
>                  UPDATE_CHECK    UB1,
>                  ENABLE          UB1,
>                  STATIC_POLICY   UB1,
>                  POLICY_TYPE     SB4,
>                  POLICY_TYPE     INDICATOR SB2,
>                  LONG_PREDICATE  UB1,
>                  SEC_RELEVANT_COLS OCISTRING,
>                  SEC_RELEVANT_COLS INDICATOR SB2,
274,275c332,337
<                  NAMESPACE       OCISTRING, NAMESPACE INDICATOR SB2,
<                  ATTRIBUTE       OCISTRING, ATTRIBUTE INDICATOR SB2, CPS UB1)
---
>                  NAMESPACE       OCISTRING,
>                  NAMESPACE       INDICATOR SB2,
>                  ATTRIBUTE       OCISTRING,
>                  ATTRIBUTE       INDICATOR SB2,
>                  CPS             UB1,
>                  INVOKER         OCISTRING)
292c354,355
<                         CPS             IN BOOLEAN := FALSE) IS
---
>                         CPS             IN BOOLEAN := FALSE,
>                         INVOKER         IN VARCHAR2) IS
294c357
<       NAME "kzraacx"
---
>       NAME "kzraacx1"
298,300c361,367
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, NAMESPACE  OCISTRING,
<                  ATTRIBUTE     OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  NAMESPACE     OCISTRING,
>                  ATTRIBUTE     OCISTRING,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
314c381,382
<                                 CPS           IN BOOLEAN := FALSE) IS
---
>                                 CPS           IN BOOLEAN := FALSE,
>                                 INVOKER       IN VARCHAR2) IS
316c384
<       NAME "kzradpg"
---
>       NAME "kzradpg1"
320,321c388,393
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, POLICY_GROUP  OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  POLICY_GROUP  OCISTRING,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
338c410,411
<                                 CPS           IN BOOLEAN := FALSE) IS
---
>                                 CPS           IN BOOLEAN := FALSE,
>                                 INVOKER       IN VARCHAR2) IS
341c414
<       NAME "kzrapfg"
---
>       NAME "kzrapfg1"
345,347c418,424
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, POLICY_GROUP  OCISTRING,
<                  POLICY_NAME   OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  POLICY_GROUP  OCISTRING,
>                  POLICY_NAME   OCISTRING,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
364c441,442
<                          CPS             IN BOOLEAN := FALSE) IS
---
>                          CPS             IN BOOLEAN := FALSE,
>                          INVOKER         IN VARCHAR2) IS
366c444
<       NAME "kzradcx"
---
>       NAME "kzradcx1"
370,372c448,454
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, NAMESPACE  OCISTRING,
<                  ATTRIBUTE     OCISTRING, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  NAMESPACE     OCISTRING,
>                  ATTRIBUTE     OCISTRING,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
390c472,473
<                            CPS           IN BOOLEAN  := FALSE) IS
---
>                            CPS           IN BOOLEAN  := FALSE,
>                            INVOKER       IN VARCHAR2) IS
392c475
<       NAME "kzragflp"
---
>       NAME "kzragflp1"
396,399c479,488
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, OBJECT_NAME   INDICATOR SB2,
<                  GROUP_NAME    OCISTRING, GROUP_NAME    INDICATOR SB2,
<                  POLICY_NAME   OCISTRING, POLICY_NAME   INDICATOR SB2, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  OBJECT_NAME   INDICATOR SB2,
>                  GROUP_NAME    OCISTRING,
>                  GROUP_NAME    INDICATOR SB2,
>                  POLICY_NAME   OCISTRING,
>                  POLICY_NAME   INDICATOR SB2,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
417c506,507
<                           CPS           IN BOOLEAN := FALSE) IS
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER       IN VARCHAR2) IS
419c509
<       NAME "kzragenp"
---
>       NAME "kzragenp1"
423,425c513,520
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, GROUP_NAME    OCISTRING,
<                  POLICY_NAME   OCISTRING, ENABLE UB1, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  GROUP_NAME    OCISTRING,
>                  POLICY_NAME   OCISTRING,
>                  ENABLE        UB1,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
442c537,538
<                           CPS           IN BOOLEAN := FALSE) IS
---
>                           CPS           IN BOOLEAN := FALSE,
>                           INVOKER       IN VARCHAR2) IS
444c540
<       NAME "kzragenp"
---
>       NAME "kzragenp1"
448,450c544,551
<                  OBJECT_SCHEMA OCISTRING, OBJECT_SCHEMA INDICATOR SB2,
<                  OBJECT_NAME   OCISTRING, GROUP_NAME    OCISTRING,
<                  POLICY_NAME   OCISTRING, ENABLE UB1, CPS UB1)
---
>                  OBJECT_SCHEMA OCISTRING,
>                  OBJECT_SCHEMA INDICATOR SB2,
>                  OBJECT_NAME   OCISTRING,
>                  GROUP_NAME    OCISTRING,
>                  POLICY_NAME   OCISTRING,
>                  ENABLE        UB1,
>                  CPS           UB1,
>                  INVOKER       OCISTRING)
SYS.DBMS_SPM - PACKAGE BODY (RU):
541a542
> 
SYS.DBMS_SQLTCB_INTERNAL - PACKAGE BODY (RU):
4503,4505c4503
<         IF (SQLCODE = -1031) THEN                    
<           ERR_CREATE_DIR := TRUE;                    
<         ELSE
---
>         IF (DBMS_STATS_INTERNAL.IS_URGENT_ERROR) THEN
4506a4505,4507
>         ELSE
>           
>           ERR_CREATE_DIR := TRUE;                    
4634c4635,4639
<         RETURN;
---
>         IF (DBMS_STATS_INTERNAL.IS_URGENT_ERROR) THEN
>           RAISE;
>         ELSE
>           RETURN;
>         END IF;
SYS.DBMS_SQLTUNE_UTIL2 - PACKAGE BODY (RU):
669a670,716
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION GET_CLOUD_SERVICE_TYPE
>   RETURN VARCHAR2
>   IS
>   BEGIN
> 
>     RETURN NVL(SYS_CONTEXT('userenv', 'cloud_service'), CLOUD_SERVICE_TYPE_NONE);
> 
>   END GET_CLOUD_SERVICE_TYPE;
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION IS_ADW
>   RETURN BOOLEAN
>   IS
>   BEGIN
> 
>     IF (GET_CLOUD_SERVICE_TYPE() = CLOUD_SERVICE_TYPE_ADW) THEN
>       RETURN TRUE;
>     ELSE
>       RETURN FALSE;
>     END IF;
> 
>   END IS_ADW;
> 
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE BODY (RU):
712,719c712,715
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DICT_CACHE,           AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DICT_CACHE_RAC,       AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.LIB_CACHE,            AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.LIB_CACHE_RAC,        AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
---
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DICT_CACHE,           AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DICT_CACHE_RAC,       AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.LIB_CACHE,            AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.LIB_CACHE_RAC,        AWRRPT_DEFAULT),
963,970c959,962
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_DIC_CACHE,       AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_DIC_CACHE_RAC,   AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_LIB_CACHE,       AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_LIB_CACHE_RAC,   AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB),
---
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_DIC_CACHE,       AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_DIC_CACHE_RAC,   AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_LIB_CACHE,       AWRRPT_DEFAULT),
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.DIFF_LIB_CACHE_RAC,   AWRRPT_DEFAULT),
1218,1219c1210
<       RS_CTR(DBMS_AWR_REPORT_LAYOUT.GAWRG_LIB_CACHE,      AWRRPT_PDB_FOR_ROOT
<                                                           + AWRRPT_PDB_FOR_PDB)
---
>       RS_CTR(DBMS_AWR_REPORT_LAYOUT.GAWRG_LIB_CACHE,      AWRRPT_DEFAULT)
13737c13728,13731
<               and b.status          = ''OPEN''';
---
>               and b.status          = ''OPEN''
>               and exists (select 1 from awr_pdb_snapshot s
>                           where  s.dbid = b.dbid and s.snap_id = b.snap_id
>                              and s.instance_number = b.thread#)';
13775c13769,13772
<               and e.status          = ''OPEN''';
---
>               and e.status          = ''OPEN''
>               and exists (select 1 from awr_pdb_snapshot s
>                           where  s.dbid = e.dbid and s.snap_id = e.snap_id
>                              and s.instance_number = e.thread#)';
14602a14600,14658
>      
>     IF TO_HTML THEN
>       APPEND_ROW(PARAGRAPH_TAG);
>     END IF;
> 
>     APPEND_ROW('Database Resource Limits');
> 
>     IF (TO_HTML) THEN
>       TAB_SUMMARY := 'This table displays database resource limits';
>       APPEND_ROW(PARAGRAPH_TAG);
>       APPEND_ROW(AWR_TAB_STYLE || TAB_SUMMARY || TABLE_CLOSE);
>       GENERIC_TABLE_HEADER(HTML_TABLE_HEADER('', 'Begin', 'End'));
>       GENERIC_TABLE_ROW(HTML_TABLE_ROW(
>         NEW_CELL_TEXT('CPUs:'), 
>         NEW_CELL_NUM(RPT_PARAMS(STAT_CPU_COUNT_B)), 
>         NEW_CELL_NUM(RPT_PARAMS(STAT_CPU_COUNT_E))), TRUE, 1);
>       GENERIC_TABLE_ROW(HTML_TABLE_ROW(
>         NEW_CELL_TEXT('SGA Target:'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_SGA_TARGET_PARAM_B), '999,999,999,999'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_SGA_TARGET_PARAM_E), '999,999,999,999')), 
>         TRUE, 1);
>       GENERIC_TABLE_ROW(HTML_TABLE_ROW(
>         NEW_CELL_TEXT('PGA Target:'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_PGA_TARGET_PARAM_B), '999,999,999,999'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_PGA_TARGET_PARAM_E), '999,999,999,999')),
>         TRUE, 1);
>       GENERIC_TABLE_ROW(HTML_TABLE_ROW(
>         NEW_CELL_TEXT('Memory Target'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_MEMORY_TARGET_B), '999,999,999,999'),
>         NEW_CELL_NUM(RPT_PARAMS(STAT_MEMORY_TARGET_E), '999,999,999,999')),
>         TRUE, 1); 
>       APPEND_ROW(TABLE_END);
> 
>     ELSE
>       APPEND_ROW('~~~~~~~~~~~~~~~~~~~~~~~~' || SP_CHR ||
>                  LPAD('Begin              End',37));
>       APPEND_ROW(LPAD('---------------- ----------------',62));
>       APPEND_ROW(LPAD('CPUs:',28)                  || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_CPU_COUNT_B), '999,999,999,999') || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_CPU_COUNT_E), '999,999,999,999'));
>       APPEND_ROW(LPAD('SGA Target:',28)            || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_SGA_TARGET_PARAM_B), '999,999,999,999') 
>                                                    || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_SGA_TARGET_PARAM_E), '999,999,999,999'));
>       APPEND_ROW(LPAD('PGA Target:',28)            || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_PGA_TARGET_PARAM_B), '999,999,999,999')
>                                                    || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_PGA_TARGET_PARAM_E), '999,999,999,999'));
>       APPEND_ROW(LPAD('Memory Target:',28)         || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_MEMORY_TARGET_B), '999,999,999,999')
>                                                    || SP_CHR ||
>         TO_CHAR(RPT_PARAMS(STAT_MEMORY_TARGET_E), '999,999,999,999'));
>       APPEND_ROW(BLANK_LINE);
>     END IF;
> 
> 
>     
> 
> 
14913c14969,14972
<             and b.status          = ''OPEN''';
---
>             and b.status          = ''OPEN''
>             and exists (select 1 from awr_pdb_snapshot s
>                           where  s.dbid = b.dbid and s.snap_id = b.snap_id
>                              and s.instance_number = b.thread#)';
14951c15010,15013
<             and e.status          = ''OPEN''';
---
>             and e.status          = ''OPEN''
>             and exists (select 1 from awr_pdb_snapshot s
>                           where  s.dbid = e.dbid and s.snap_id = e.snap_id
>                              and s.instance_number = e.thread#)';
15827c15889,15891
<               RPAD('Startup Time', 15);
---
>               RPAD('Startup Time', 15)                   || SP_CHR ||
>               RPAD('User Name', 12)                      || SP_CHR ||
>               RPAD('System Data Visible', 20);
15833c15897,15899
<               RPAD('-', 15, '-');
---
>               RPAD('-', 15, '-')                         || SP_CHR ||
>               RPAD('-', 12, '-')                         || SP_CHR ||
>               RPAD('-', 20, '-');
15837,15839c15903,15908
<     OUTPUT := RPAD(RPT_PARAMS(STAT_INSTNAME), 12)        || SP_CHR ||
<               TO_CHAR(L_INST_NUM, '9999999')             || SP_CHR ||
<               TO_CHAR(RPT_TIME_VALS(STAT_INSTSTART), 'DD-Mon-YY HH24:MI');
---
>     OUTPUT := RPAD(RPT_PARAMS(STAT_INSTNAME), 12)                  || SP_CHR ||
>               TO_CHAR(L_INST_NUM, '9999999')                       || SP_CHR ||
>               TO_CHAR(RPT_TIME_VALS(STAT_INSTSTART), 'DD-Mon-YY HH24:MI')
>                                                                    || SP_CHR ||
>               RPAD(SYS_CONTEXT('USERENV', 'SESSION_USER'), 12)     || SP_CHR ||
>               RPAD(SYS_CONTEXT('USERENV', 'SYSTEM_DATA_VISIBLE'), 20);
15875c15944,15945
<         HDR := HTML_TABLE_HEADER('Instance','Inst Num','Startup Time');
---
>         HDR := HTML_TABLE_HEADER('Instance','Inst Num','Startup Time',
>                                  'User Name', 'System Data Visible');
15881c15951,15953
<                  TO_CHAR(RPT_TIME_VALS(STAT_INSTSTART),'DD-Mon-YY HH24:MI'))
---
>                  TO_CHAR(RPT_TIME_VALS(STAT_INSTSTART),'DD-Mon-YY HH24:MI')),
>                NEW_CELL_TEXT(SYS_CONTEXT('USERENV', 'SESSION_USER')),
>                NEW_CELL_TEXT(SYS_CONTEXT('USERENV', 'SYSTEM_DATA_VISIBLE'))
22424c22496,22499
<             and e.status          = ''OPEN''';
---
>             and e.status          = ''OPEN''
>             and exists (select 1 from awr_pdb_snapshot s
>                           where  s.dbid = e.dbid and s.snap_id = e.snap_id
>                              and s.instance_number = e.thread#)';
26904a26980,26983
>     ADD_RPT_STAT_IN_SRC(STAT_CPU_COUNT_B, 'cpu_count');
>     ADD_RPT_STAT_IN_SRC(STAT_SGA_TARGET_PARAM_B, 'sga_target');
>     ADD_RPT_STAT_IN_SRC(STAT_PGA_TARGET_PARAM_B, 'pga_aggregate_target');
>     ADD_RPT_STAT_IN_SRC(STAT_MEMORY_TARGET_B, 'memory_target');
26926,26927d27004
<     ADD_RPT_STAT_IN_SRC(STAT_SGA_PARAM, 'sga_target');
<     ADD_RPT_STAT_IN_SRC(STAT_PGA_PARAM, 'pga_aggregate_target');
26931a27009,27012
>     ADD_RPT_STAT_IN_SRC(STAT_CPU_COUNT_E, 'cpu_count');
>     ADD_RPT_STAT_IN_SRC(STAT_SGA_TARGET_PARAM_E, 'sga_target');
>     ADD_RPT_STAT_IN_SRC(STAT_PGA_TARGET_PARAM_E, 'pga_aggregate_target');
>     ADD_RPT_STAT_IN_SRC(STAT_MEMORY_TARGET_E, 'memory_target');
SYS.KUPF$FILE - PACKAGE BODY (RU):
6662,6668c6662
<       
<       
<       
<       V_SCB.FATALFILEERROR := 0;
< 
<       L_RESPONSE := KUPC$QUEUE.TRANSCEIVE(KUPC$_WORKER_FILE_LIST(WID));
<       IF L_RESPONSE IS NULL OR L_RESPONSE.MSGTYPE <> KUPCC.FILE_LIST_MSGTYPE
---
>       IF (SYS.KUPP$PROC.WHAT_AM_I != SYS.KUPP$PROC.VC_KUPP_PROC_TYPE_EXTTBL)
6670,6673c6664,6692
<          DEBUG('Received unexpected msgtype ' || L_RESPONSE.MSGTYPE ||
<                ' in response to FILE_LIST request.');
<          V_SCB.FATALFILEERROR := KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM;
<          DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM);
---
>         
>         
>         
>         V_SCB.FATALFILEERROR := 0;
> 
>         L_RESPONSE := KUPC$QUEUE.TRANSCEIVE(KUPC$_WORKER_FILE_LIST(WID));
>         IF L_RESPONSE IS NULL OR L_RESPONSE.MSGTYPE <> KUPCC.FILE_LIST_MSGTYPE
>         THEN
>           DEBUG('Received unexpected msgtype ' || L_RESPONSE.MSGTYPE ||
>                 ' in response to FILE_LIST request.');
>           V_SCB.FATALFILEERROR := KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM;
>           DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM, TRUE);
>         ELSE
>           V_FILELIST := TREAT(L_RESPONSE AS KUPC$_FILE_LIST).FILELIST;
>           DEBUG('Retrieved FILE_LIST, Count = ' || V_FILELIST.COUNT);
> 
>           DMPFILVER := V_FILELIST(V_FILELIST.FIRST).VERSION;
> 
>           
>           
>           
>           
>           
>           
>           
>           
>           L_DFLGS := V_FILELIST(V_FILELIST.FIRST).FLAGS;
>         END IF;
6675,6688c6694,6749
<          V_FILELIST := TREAT(L_RESPONSE AS KUPC$_FILE_LIST).FILELIST;
<          DEBUG('Retrieved FILE_LIST, Count = ' || V_FILELIST.COUNT);
< 
<          DMPFILVER := V_FILELIST(V_FILELIST.FIRST).VERSION;
< 
<          
<          
<          
<          
<          
<          
<          
<          
<          L_DFLGS := V_FILELIST(V_FILELIST.FIRST).FLAGS;
---
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         DECLARE
>           L_FILETYPE   NUMBER := 0;
>           L_MTFULLNAME T_MTFULLNAME := NULL;
>           L_FILESPEC   T_FILENAME := NULL;
>           L_INFOVALUES SYS.KUPF$FILE_INT.T_INFOVALUES;
>           L_CREDENTIAL T_CREDENTIAL := NULL;  
> 
>         BEGIN
>           L_MTFULLNAME := 
>             ' ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(JOBOWNER, FALSE) ||
>             '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(JOBNAME,  FALSE) || ' ';
> 
>           EXECUTE IMMEDIATE
>             'SELECT file_name, file_type, user_directory FROM' ||
>                L_MTFULLNAME ||
>               'WHERE process_order = :1 AND duplicate <> 0 AND ROWNUM = 1'
>             INTO  L_FILESPEC,
>                   L_FILETYPE,
>                   L_CREDENTIAL
>             USING KUPCC.PO_IMP_FILE;
> 
>           
>           
>           
>           
>           IF (L_FILETYPE <> K_URIDISKTYPE) THEN
>             L_CREDENTIAL := NULL;
>           END IF;
> 
>           
>           
>           
>           KUPF$FILE_INT.EXAMINE_DUMP_FILE(L_FILESPEC, L_FILETYPE, L_INFOVALUES,
>                                           L_CREDENTIAL);
> 
>           DMPFILVER := TO_NUMBER(L_INFOVALUES(K_INFO_FILVER_NUM));
>           L_DFLGS   := TO_NUMBER(L_INFOVALUES(K_INFO_FLAGS));
> 
>         EXCEPTION
>            WHEN OTHERS THEN
>              DEBUG('INIT_CB failure: ' || SQLERRM);
>              V_SCB.FATALFILEERROR := KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM;
>              DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(
>                 KUPCC.E_INT_MASTER_NORMAL_EXIT_NUM, TRUE);
>         END;
>       END IF;
6690,6691c6751,6752
<          KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_MDCMP_FLG,
<                         KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_MDCMP_FLG));
---
>       KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_MDCMP_FLG,
>                      KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_MDCMP_FLG));
6693,6694c6754,6755
<          KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_TDCMP_FLG,
<                         KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_TDCMP_FLG));
---
>       KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_TDCMP_FLG,
>                      KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_TDCMP_FLG));
6696,6697c6757,6758
<          KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_MDENC_FLG,
<                         KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_MDENC_FLG));
---
>       KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_MDENC_FLG,
>                      KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_MDENC_FLG));
6699,6700c6760,6761
<          KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_TDENC_FLG,
<                         KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_TDENC_FLG));
---
>       KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_TDENC_FLG,
>                      KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_TDENC_FLG));
6702,6703c6763,6764
<          KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_ECENC_FLG,
<                         KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_ECENC_FLG));
---
>       KUPUTIL.BITSOC(V_SCB.JOBFLGS, K_KUPFJOB_ECENC_FLG,
>                      KUPUTIL.BITTST(L_DFLGS, K_KUPFDHF_ECENC_FLG));
6705,6706c6766
<          JFLGS := V_SCB.JOBFLGS;
<       END IF;
---
>       JFLGS := V_SCB.JOBFLGS;
8626c8686,8687
<    IF (V_SCB.INITIALIZED)
---
>    IF (V_SCB.INITIALIZED AND 
>       (SYS.KUPP$PROC.WHAT_AM_I != SYS.KUPP$PROC.VC_KUPP_PROC_TYPE_EXTTBL))
8629a8691,8692
> 
>    DEBUG('SET DEBUG called');
SYS.KUPU$UTILITIES_INT - PACKAGE BODY (RU):
1784a1785,1807
> 
> 
> 
> 
> 
> PROCEDURE SET_KGL_TIME_TO_WAIT_FOR_LOCKS (
>                 LWAIT_TIME IN NUMBER)
>   ACCESSIBLE BY (PACKAGE SYS.KUPW$WORKER) IS
>   STMT       VARCHAR2(4000) := NULL;
> BEGIN
>   DEBUG('In SET_KGL_TIME_TO_WAIT_FOR_LOCKS' || LWAIT_TIME);
> 
>   STMT := 'ALTER SESSION SET "_kgl_time_to_wait_for_locks" =' || LWAIT_TIME;
>   EXECUTE IMMEDIATE STMT;
> 
> EXCEPTION
>   WHEN OTHERS THEN
>     DEBUG('Not able to set _kgl_time_to_wait_for_locks to ' || LWAIT_TIME ||
>           DBMS_UTILITY.FORMAT_ERROR_STACK() || ' ' ||
>           DBMS_UTILITY.FORMAT_CALL_STACK());
>     RAISE;
> END SET_KGL_TIME_TO_WAIT_FOR_LOCKS;
> 
SYS.KUPW$WORKER - PACKAGE BODY (RU):
160a161,168
>   
>   C_DDL_MAX_RETRIES         CONSTANT NUMBER := 25;
>   C_DDL_RETRY_MIN_WAIT      CONSTANT NUMBER := 0.1;
>   C_DDL_RETRY_MAX_WAIT      CONSTANT NUMBER := 1.0;
> 
>   
>   
>   
1023a1032,1033
>   
>   V_KGL_LOCK_TIMEOUT            NUMBER := 15;
25349a25360
>   L_GRANTOR             KUPCC.T_ID;
25933a25945,25958
>                   
>                   
>                   
>                   
>                   
>                   
>                   
>                   
>                   IF V_CURRENT_OBJECT_TYPE = 'TABLESPACE_QUOTA' THEN
>                     L_GRANTOR := NULL;   
>                   ELSE
>                     L_GRANTOR := NVL(L_OBJDDL(K).GRANTOR,A_GRANTOR(J));
>                   END IF ;
> 
25939c25964
<                             NVL(L_OBJDDL(K).GRANTOR,A_GRANTOR(J)),
---
>                             L_GRANTOR,
25956c25981
<                     PUT_SQL_FILE(NVL(L_OBJDDL(K).GRANTOR,A_GRANTOR(J)),
---
>                     PUT_SQL_FILE(L_GRANTOR,
27378c27403
< 
---
>   L_WAIT_TIME           NUMBER := 0;
27523a27549,27569
>         
>         
>         
>         
>         
>         IF SQLCODE NOT IN ( -54,
>                             -60,
>                             -4020,
>                             -4021
>                           ) OR
>            L_RETRY > C_DDL_MAX_RETRIES THEN
> 
>           IF V_KGL_LOCK_TIMEOUT = 1 AND
>              SQLCODE = -4021 THEN
>             
>             
>             
>             SEND_TRACE_MSG(NULL, '_kgl_time_to_wait_for_lock reset to 15 minutes');
>             SYS.KUPU$UTILITIES_INT.SET_KGL_TIME_TO_WAIT_FOR_LOCKS(15);
>             V_KGL_LOCK_TIMEOUT := 15;
>           END IF;
27525d27570
<         IF SQLCODE NOT IN (-60,-4020) OR L_RETRY > 10 THEN
27529,27530c27574,27596
<           DBMS_LOCK.SLEEP(.5);
<           SEND_TRACE_MSG(NULL, 'Retrying... (' || L_RETRY || ')');
---
> 
>           
>           
>           
>           
>           L_WAIT_TIME := TRUNC(DBMS_RANDOM.VALUE(C_DDL_RETRY_MIN_WAIT,
>                                                  C_DDL_RETRY_MAX_WAIT), 2);
>           SEND_TRACE_MSG(NULL,  'Retrying... (' || L_RETRY || ' With wait time '
>                                                 || L_WAIT_TIME || ' seconds');
>           
>           
>           
>           
>           
>           
>           
>           IF V_KGL_LOCK_TIMEOUT != 1 AND 
>              SQLCODE = -4021 THEN
>             SEND_TRACE_MSG(NULL, '_kgl_time_to_wait_for_lock set to 1 minute');
>             SYS.KUPU$UTILITIES_INT.SET_KGL_TIME_TO_WAIT_FOR_LOCKS(1);
>             V_KGL_LOCK_TIMEOUT := 1;
>           END IF;
>           DBMS_LOCK.SLEEP(L_WAIT_TIME);
34414c34480,34484
<   IF V_DEBUG_ENABLE AND V_DEBUG_MORE THEN
---
>   
>   
>   
>   IF V_DEBUG_ENABLE AND V_DEBUG_MORE AND
>      KUPP$PROC.WHAT_AM_I() = KUPP$PROC.VC_KUPP_PROC_TYPE_WORKER THEN
SYS.PRVTEMX_PERF - PACKAGE BODY (RU):
1063a1064,1187
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>  FUNCTION ACTION_CANCEL_SQL_XML(
>     P_SID              IN   NUMBER,
>     P_SERIAL_NUM       IN   NUMBER,
>     P_INST_ID          IN   NUMBER DEFAULT NULL,
>     P_SQL_ID           IN   VARCHAR2,
>     P_SHOW_SQL         IN   NUMBER DEFAULT 0)
>   RETURN XMLTYPE
>   IS
>     
>     V_SQL_EXEC                  CLOB           := '';
>     V_SQL_PARAMS                VARCHAR2(32767);   
>     
>     
>     V_REF_PARAMS 	        DBMS_REPORT.REF_STRING_IDSPEC;
>    
>     
>     V_REPORT_XML                XMLTYPE       := NULL;
> 
>     
>     V_REPORT_BODY_XML           XMLTYPE       := NULL;
> 
>     
>     V_REPORT_SQL                CLOB          := '';
> 
>     
>     V_ELAPSED                   NUMBER;
>     V_CPU                       NUMBER;
> 
>     
>     V_ORIG_ENV                  DBMS_REPORT.FORMAT_PARAM_VALUES;
>     V_SET_ENV                   BOOLEAN;
>     
>     
>     V_INST_ID                   NUMBER := NVL(P_INST_ID,
>                                               USERENV('INSTANCE'));
> 
>   BEGIN
>      
>      
>      V_ORIG_ENV       := DBMS_REPORT.FORMAT_PARAM_VALUES();
>      V_SET_ENV        := DBMS_REPORT.SETUP_REPORT_ENV(V_ORIG_ENV);
> 
>      
>      DBMS_REPORT.GET_TIMING_INFO(0, V_ELAPSED, V_CPU);
>      
>      V_SQL_PARAMS := P_SID || ','  || P_SERIAL_NUM;
> 
>      
>      IF (V_INST_ID IS NOT NULL) THEN
>        V_SQL_PARAMS := V_SQL_PARAMS || ',@' || V_INST_ID;
>      END IF;
> 
>      
>      V_SQL_PARAMS := V_SQL_PARAMS || ',' || P_SQL_ID;
>      
>      
>      V_SQL_PARAMS := DBMS_ASSERT.ENQUOTE_LITERAL(V_SQL_PARAMS);
> 
>      
>      V_SQL_EXEC := 'ALTER SYSTEM CANCEL SQL ' || V_SQL_PARAMS;
>                                                                                                               
>      
>      IF (P_SHOW_SQL IS NULL OR P_SHOW_SQL = 0) THEN
>       
>        
>        BEGIN
>          EXECUTE IMMEDIATE V_SQL_EXEC;
>          
>          EXCEPTION
>            WHEN OTHERS THEN
>          RAISE;
>        END;
> 
>       END IF;
> 
>       
>       DBMS_REPORT.GET_TIMING_INFO(1, V_ELAPSED, V_CPU);
>     
>       
>       
>       V_REPORT_XML :=
>         PRVT_REPORT_TAGS.BUILD_REPORT_TAG(
>                  DBMS_REPORT.BUILD_REPORT_REFERENCE_STRUCT(
>                    'session', 'cancel_sql', V_REF_PARAMS),
>                  V_ELAPSED, V_CPU);
>      
>       
>       SELECT XMLELEMENT("sql", NULL, V_SQL_EXEC)
>       INTO V_REPORT_BODY_XML
>       FROM SYS.DUAL;
> 
>       
>       V_REPORT_XML := V_REPORT_XML.APPENDCHILDXML('/*', V_REPORT_BODY_XML);
> 
>       
>       IF (V_SET_ENV) THEN
>       
>         DBMS_REPORT.RESTORE_REPORT_ENV(V_ORIG_ENV);
>         
>       END IF;
> 
> 
>       
>       RETURN  V_REPORT_XML;
>       
>   END ACTION_CANCEL_SQL_XML;
SYS.PRVTEMX_RSRCMGR - PACKAGE BODY (RU):
2530,2578d2529
<   PROCEDURE I_CREATE_AWR_CG_MAP(
<     P_CON_ID     IN     NUMBER,
<     P_AWR_PERIOD IN OUT NOCOPY PRVT_AWRV_METADATA,
<     P_CGRP_MAP   IN OUT NOCOPY PRVT_AWRV_INSTTAB)
<   IS
<     
<     SQLSTMT_MAP CONSTANT VARCHAR2(32767) := q'[
<       select sys.prvt_awrv_inst(id, name)
<         from (
<           select distinct 
<                  consumer_group_id id, 
<                  consumer_group_name name 
<             from sys.awr_root_rsrc_consumer_group s
<            where s.dbid             = :m_dbid
<              and s.snap_id          > :m_begin_snap
<              and s.snap_id         <= :m_end_snap
<              and s.con_dbid         = :m_con_dbid
<              and ]' || P_AWR_PERIOD.GET_INST_CLAUSE('s') ||')';
<          
<   BEGIN
<     IF (P_CON_ID = 0 OR P_CON_ID > 2) THEN
<       EXECUTE IMMEDIATE SQLSTMT_MAP
<         BULK COLLECT INTO P_CGRP_MAP
<         USING P_AWR_PERIOD.M_DBID,
<               P_AWR_PERIOD.M_BEGIN_SNAP, P_AWR_PERIOD.M_END_SNAP,
<               SYS.DBMS_SQLTUNE_UTIL0.CDBCON_ID_TO_DBID(P_CON_ID),
<               P_AWR_PERIOD.M_INST_ID_LOW, P_AWR_PERIOD.M_INST_ID_HIGH,
<               P_AWR_PERIOD.M_INST_ID_LIST;
<     ELSE
<       
<       P_CGRP_MAP := PRVT_AWRV_INSTTAB();
<     END IF;
<   END I_CREATE_AWR_CG_MAP;
< 
< 
<   
<   
<   
<   
<   
<   
<   
<   
<   
<   
<   
<   
<   
<   
2883c2834,2835
<         I_CREATE_AWR_CG_MAP(L_CON_ID, AWR_PERIOD, L_DIM_MAP);  
---
>         PRVT_AWR_VIEWER.CREATE_CONSUMER_GROUP_MAP(
>           L_CON_ID, AWR_PERIOD, L_DIM_MAP);  
SYS.PRVT_ASH_OMX - PACKAGE BODY (RU):
42,44d41
<   
<   
<   
56d52
<     FILTERED        IN NUMBER   := NULL,
69c65
<     IF (FILTERED = 1) THEN
---
>     IF (FILTER_LIST IS NOT NULL) THEN
188,190d183
<   
<   
<   
203d195
<     FILTERED        IN NUMBER   := NULL,
SYS.PRVT_AWR_VIEWER - PACKAGE BODY (RU):
1183a1184,1265
>   
>   
>   ADW_RMMETRICS_COMMON CONSTANT VARCHAR2(32767) := q'[
>       with rmmetrics_data as (-- ADW workload main query
>         select bucket_id, 
>                new_id consumer_group_id,
>                case 
>                  when rn = 1 and :is_awr = 1
>                    then (select /*+ cardinality(t 1) */ instance_name
>                            from table(cast(:p_contTab 
>                                       as sys.prvt_awrv_instTab)) t
>                           where t.inst_id = consumer_group_id)
>                  when rn = 1 
>                    then consumer_group_name 
>                  else null 
>                end consumer_group_name,
>                avg_cpu_utilization,
>                avg_active_parallel_stmts,
>                avg_queued_parallel_stmts
>           from ( -- generate an id since default ids can be high numbers
>             select bucket_id,
>                    consumer_group_id,
>                    consumer_group_name,
>                    avg_cpu_utilization, 
>                    avg_active_parallel_stmts,
>                    avg_queued_parallel_stmts,
>                    row_number() over (partition by consumer_group_id, 
>                                                consumer_group_name
>                                       order by bucket_id, 
>                                                consumer_group_id, 
>                                                consumer_group_name) rn,
>                    -- generate an id
>                    dense_rank() over (order by consumer_group_id, 
>                                                consumer_group_name) new_id
>               from (#GENERATE_METRICS_BUCKETID#) rsrc
>               where avg_cpu_utilization +
>                     avg_active_parallel_stmts + 
>                     avg_queued_parallel_stmts > 0) 
>        )
> 
>       -- construct xml
>       select xmlagg(
>                nvl2(buckets,
>                     xmlelement("stattype",
>                      xmlattributes('rsrcmgrmetric' as "name"),
>                      xmlelement("stat_info",
>                        nvl(stat_id, 
>                            xmlelement("stat", 
>                              xmlattributes(
>                                consumer_group_id as "id", 
>                                consumer_group_id as "name")))),
>                      #GENERATE_BUCKETS_TAG#),
>                     null))
>         from ( -- aggregate buckets
>           select #GENERATE_BUCKETID_TAG#,
>                  xmlagg(stat_id)  stat_id, 
>                  max(consumer_group_id) consumer_group_id
>             from ( -- aggregate stats in each bucket
>               select bucket_id, 
>                      max(consumer_group_id) consumer_group_id,
>                      xmlagg(stat_id order by consumer_group_id) stat_id,
>                      xmlagg(xmlelement("stat",
>                       xmlattributes(consumer_group_id as "id",
>                             round(avg_cpu_utilization, 2)         as "cpu",
>                             round(avg_active_parallel_stmts, 2)   as "apst",
>                             round(avg_queued_parallel_stmts, 2)   as "qpst"
>                         )
>                       )
>                       order by consumer_group_id)  stats
>                 from ( -- generate id name map
>                   select bucket_id, consumer_group_id,
>                          nvl2(consumer_group_name,
>                               xmlelement("stat",
>                                xmlattributes(consumer_group_id as "id",
>                                  consumer_group_name as "name")),
>                               null)      stat_id,
>                          avg_cpu_utilization,
>                          avg_active_parallel_stmts,
>                          avg_queued_parallel_stmts
>                    from rmmetrics_data)
>                group by bucket_id))]';
> 
1311a1394,1451
>   PROCEDURE CREATE_CONSUMER_GROUP_MAP(
>     P_CON_ID     IN     NUMBER,
>     P_AWR_PERIOD IN OUT NOCOPY PRVT_AWRV_METADATA,
>     P_CGRP_MAP   IN OUT NOCOPY PRVT_AWRV_INSTTAB)
>   IS
> 
>     L_QRY VARCHAR2(32767) := NULL;
> 
>     
>     SQLSTMT_MAP CONSTANT VARCHAR2(32767) := q'[
>       select sys.prvt_awrv_inst(id, name)
>         from (
>           select distinct 
>                  consumer_group_id id, 
>                  consumer_group_name name 
>             from sys.awr_root_rsrc_consumer_group s
>            where s.dbid             = :m_dbid
>              and s.snap_id          > :m_begin_snap
>              and s.snap_id         <= :m_end_snap
>              and s.con_dbid         = :m_con_dbid
>              and ]' || P_AWR_PERIOD.GET_INST_CLAUSE('s') ||')';
> 
>   BEGIN
> 
>     L_QRY := SQLSTMT_MAP;
> 
>     DBMS_SQLTUNE_UTIL1.REPLACE_AWR_VIEW_PREFIX(
>       L_QRY, P_AWR_PERIOD.M_AWR_VIEW_PREFIX);
> 
>     IF (P_CON_ID = 0 OR P_CON_ID > 2) THEN
>       EXECUTE IMMEDIATE L_QRY
>         BULK COLLECT INTO P_CGRP_MAP
>         USING P_AWR_PERIOD.M_DBID,
>               P_AWR_PERIOD.M_BEGIN_SNAP, P_AWR_PERIOD.M_END_SNAP,
>               SYS.DBMS_SQLTUNE_UTIL0.CDBCON_ID_TO_DBID(P_CON_ID),
>               P_AWR_PERIOD.M_INST_ID_LOW, P_AWR_PERIOD.M_INST_ID_HIGH,
>               P_AWR_PERIOD.M_INST_ID_LIST;
>     ELSE
>       
>       P_CGRP_MAP := PRVT_AWRV_INSTTAB();
>     END IF;
> 
>   END CREATE_CONSUMER_GROUP_MAP;
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
16408a16549,16550
>   
>   
16420a16563
>     INCLUDE_SQLS      IN NUMBER         DEFAULT NULL,
16606c16749
<     IF (L_DIM_STAT IS NULL AND L_DIM_NAME IS NULL) THEN 
---
>     IF (INCLUDE_SQLS = 0) THEN
16607a16751,16753
>       L_TOPSQL_XML := NULL;
>     
>     ELSE
16609,16631c16755
<       IF (IS_REALTIME IS NULL OR IS_REALTIME = G_TIMEPICKER_HISTORICAL) THEN
<         
<       IF (L_START_TIME IS NOT NULL AND L_END_TIME IS NOT NULL AND
<           (L_END_TIME - L_START_TIME)*24*60 < L_SNAPINT_MINS) 
<       THEN
<         L_USEASH := TRUE;
<       END IF;
<       
<       
<       ELSE
<         L_USEASH := TRUE;
<       END IF;
< 
< 
<     IF (L_USEASH) THEN
<       SELECT XMLELEMENT("region_data",
<               XMLAGG(
<                 XMLELEMENT("stattype",
<                  XMLATTRIBUTES('topsql' AS "name",
<                                 '10' AS "topn",
<                                 'ash'   AS "source"))))
<         INTO L_TOPSQL_XML
<         FROM SYS.DUAL;
---
>       IF (L_DIM_STAT IS NULL AND L_DIM_NAME IS NULL) THEN 
16634,16635c16758,16768
<         IF (L_END_TIME IS NULL) THEN
<           L_END_TIME := SYSDATE;
---
>         IF (IS_REALTIME IS NULL OR IS_REALTIME = G_TIMEPICKER_HISTORICAL) THEN
>           
>           IF (L_START_TIME IS NOT NULL AND L_END_TIME IS NOT NULL AND
>              (L_END_TIME - L_START_TIME)*24*60 < L_SNAPINT_MINS) 
>           THEN
>             L_USEASH := TRUE;
>           END IF;
>           
>           
>         ELSE
>           L_USEASH := TRUE;
16638,16640d16770
<         IF (L_START_TIME IS NULL) THEN
<           L_START_TIME := L_END_TIME - 1/24;
<         END IF;
16642,16651c16772,16800
<         L_TOPSQL_XML := L_TOPSQL_XML.APPENDCHILDXML('/*/stattype',
<                         SYS.DBMS_ASH_INTERNAL.REPORT_ASHVIEWER_XML(
<                            DBID       => L_DBID,
<                            INST_ID    => L_INST_ID,
<                            BEGIN_TIME => 
<                              TO_CHAR(L_START_TIME,'hh24:mi:ss mm/dd/yyyy'),
<                            END_TIME   => 
<                              TO_CHAR(L_END_TIME,'hh24:mi:ss mm/dd/yyyy'),
<                            REPORT_LEVEL=>'<sqlid,wait_class>{treemap}', 
<                            PARENT_REPORT => 'topsql'));
---
>         IF (L_USEASH) THEN
>           SELECT XMLELEMENT("region_data",
>                    XMLAGG(
>                      XMLELEMENT("stattype",
>                        XMLATTRIBUTES('topsql' AS "name",
>                                      '10' AS "topn",
>                                      'ash'   AS "source"))))
>             INTO L_TOPSQL_XML
>             FROM SYS.DUAL;
> 
>             
>             IF (L_END_TIME IS NULL) THEN
>               L_END_TIME := SYSDATE;
>             END IF;
> 
>             IF (L_START_TIME IS NULL) THEN
>               L_START_TIME := L_END_TIME - 1/24;
>             END IF;
> 
>             L_TOPSQL_XML := L_TOPSQL_XML.APPENDCHILDXML('/*/stattype',
>                               SYS.DBMS_ASH_INTERNAL.REPORT_ASHVIEWER_XML(
>                                 DBID          => L_DBID,
>                                 INST_ID       => L_INST_ID,
>                                 BEGIN_TIME    => 
>                                   TO_CHAR(L_START_TIME,'hh24:mi:ss mm/dd/yyyy'),
>                                 END_TIME      => 
>                                   TO_CHAR(L_END_TIME,'hh24:mi:ss mm/dd/yyyy'),
>                                 REPORT_LEVEL  =>'<sqlid,wait_class>{treemap}', 
>                                 PARENT_REPORT => 'topsql'));
16653c16802
<     ELSE
---
>         ELSE
16655,16678c16804,16829
<       
<       L_TOPSQL_XML := I_REP_AWRDATA_XML(
<                         START_TIME       => L_START_TIME,
<                         END_TIME         => L_END_TIME,
<                         TIMEPICKER_START => NULL,
<                         TIMEPICKER_END   => NULL,
<                         INSTANCE_LIST    => L_INSTANCE_LIST,
<                         DBID             => L_DBID,
<                         BUCKET_MAX_COUNT => 1,  
<                         TIME_MODEL       => 'no',
<                         WAIT_CLASS       => 'no',
<                         WAIT_EVENT       => 'no',
<                         EVENT_CLASS      => 'no',
<                         SYSSTAT          => 'no',
<                         SQLSTAT          => 'EM_TOP_SQL',
<                         OSSTAT           => 'no',
<                         IOSTAT           => 'no',
<                         MEMORY           => 'no',
<                         SPACE            => 'no',
<                         KEY_STATISTICS   => 'no',
<                         INST_DETAIL      => L_SHOW_INST_DETAIL,
<                         MEMBERS          => 'no',
<                         SUMMARY          => 'no',
<                         SHOW_SQL         => SHOW_SQL);
---
>           
>           L_TOPSQL_XML := I_REP_AWRDATA_XML(
>                             START_TIME       => L_START_TIME,
>                             END_TIME         => L_END_TIME,
>                             TIMEPICKER_START => NULL,
>                             TIMEPICKER_END   => NULL,
>                             INSTANCE_LIST    => L_INSTANCE_LIST,
>                             DBID             => L_DBID,
>                             BUCKET_MAX_COUNT => 1,  
>                             TIME_MODEL       => 'no',
>                             WAIT_CLASS       => 'no',
>                             WAIT_EVENT       => 'no',
>                             EVENT_CLASS      => 'no',
>                             SYSSTAT          => 'no',
>                             SQLSTAT          => 'EM_TOP_SQL',
>                             OSSTAT           => 'no',
>                             IOSTAT           => 'no',
>                             MEMORY           => 'no',
>                             SPACE            => 'no',
>                             KEY_STATISTICS   => 'no',
>                             INST_DETAIL      => L_SHOW_INST_DETAIL,
>                             MEMBERS          => 'no',
>                             SUMMARY          => 'no',
>                             SHOW_SQL         => SHOW_SQL);
>         END IF;
>       END IF;
16680d16830
<   END IF;
18093a18244,18921
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION REPORT_ADW_WORKLOAD_REALTIME(
>     START_TIME        IN DATE           DEFAULT NULL,
>     END_TIME          IN DATE           DEFAULT NULL,
>     INST_ID_LOW       IN NUMBER         DEFAULT NULL,
>     INST_ID_HIGH      IN NUMBER         DEFAULT NULL,
>     SHOW_SQL          IN NUMBER         DEFAULT 0)
>   RETURN XMLTYPE
>   IS
>     
>     L_ELAPSED        NUMBER;
>     L_CPU            NUMBER;
> 
>     
>     L_REF_PARAMS     DBMS_REPORT.REF_STRING_IDSPEC;
> 
>     
>     L_ORIG_ENV       DBMS_REPORT.FORMAT_PARAM_VALUES;
>     L_SET_ENV        BOOLEAN;
> 
>     
>     L_QUERY          VARCHAR2(32767) := NULL;
>     L_REPORT_SQL     CLOB;
> 
>     
>     L_REPORT_XML     XMLTYPE := NULL;
>     L_RMMETRICS_XML  XMLTYPE := NULL;
> 
> 
>     
>     L_START_TIME     DATE := START_TIME;
>     L_END_TIME       DATE := END_TIME;
>     L_INST_ID_LOW    NUMBER := INST_ID_LOW;
>     L_INST_ID_HIGH   NUMBER := INST_ID_HIGH;
> 
>     
>     L_BUCKET_COUNT    NUMBER;
>     L_BUCKET_INTERVAL NUMBER;
> 
>     
>     L_CG_MAP PRVT_AWRV_INSTTAB := NULL;
> 
>     ADW_RMMETRICS_REALTIME  CONSTANT VARCHAR2(32767) := q'[
>     select bucket_id,
>            consumer_group_id, consumer_group_name,
>            avg(avg_cpu_utilization)  avg_cpu_utilization,
>            sum(avg_active_parallel_stmts) 
>                                      avg_active_parallel_stmts,
>            sum(avg_queued_parallel_stmts) 
>                                      avg_queued_parallel_stmts
>       from table(sys.gv$(cursor(
>            select trunc(
>                   ((extract(day from 
>                       (cast(trunc(end_time,'mi') as timestamp) -
>                        cast(trunc(to_date(:b_start_time, :date_fmt),'mi') 
>                          as timestamp))) 
>                     * 86400 +
>                     extract(hour from 
>                       (cast(trunc(end_time,'mi') as timestamp) -
>                        cast(trunc(to_date(:b_start_time, :date_fmt),'mi') 
>                          as timestamp))) 
>                     * 3600 + 
>                     extract(minute from
>                       (cast(trunc(end_time,'mi') as timestamp) -
>                        cast(trunc(to_date(:b_start_time, :date_fmt),'mi') 
>                          as timestamp))) 
>                     * 60 + 
>                     extract(second from
>                       (cast(trunc(end_time,'mi') as timestamp) -
>                        cast(trunc(to_date(:b_start_time, :date_fmt),'mi') 
>                          as timestamp))) 
>                    )
>                    / :p_bucket_interval)) + 1 bucket_id,
>                   consumer_group_name,
>                   consumer_group_id,
>                   case 
>                     when running_sessions_limit is null or
>                          running_sessions_limit = 0 then
>                       avg_cpu_utilization
>                     else
>                       (avg_running_sessions/running_sessions_limit)*100 
>                   end avg_cpu_utilization,
>                   avg_active_parallel_stmts,
>                   avg_queued_parallel_stmts
>              from v$rsrcmgrmetric_history
>             where end_time >= to_date(:b_start_time,:date_fmt)
>               and end_time <  to_date(:b_end_time,:date_fmt)
>               and userenv('INSTANCE') between :p_inst_id_low
>                                           and :p_inst_id_high)))
>          group by bucket_id, consumer_group_id, consumer_group_name]';
> 
>   
>   ADW_RMMETRICS_RT_HEADER   CONSTANT VARCHAR2(32767) := q'[
>       var is_awr            number;
>       var p_contTab         prvt_awrv_instTab;
>       var b_start_time      varchar2(4000);
>       var b_end_time        varchar2(4000);
>       var p_bucket_interval number;
>       var p_bucket_count    number;
>       var p_inst_id_low     number;
>       var p_inst_id_high    number;
>       var b_min_time        varchar2(4000);
>       var b_max_time        varchar2(4000);
>       var b_duration        number;
>       var date_fmt          varchar2(4000);
>       begin
>         :is_awr            := #is_awr#;
>         :p_contTab         := #p_contTab#;
>         :b_start_time      := '#b_start_time#';
>         :b_end_time        := '#b_end_time#';
>         :p_bucket_interval := #p_bucket_interval#;
>         :p_bucket_count    := #p_bucket_count#;
>         :p_inst_id_low     := #p_inst_id_low#;
>         :p_inst_id_high    := #p_inst_id_high#;
>         :b_min_time        := '#b_min_time#';
>         :b_max_time        := '#b_max_time#';
>         :b_duration        := #b_duration#;
>         :date_fmt          := '#date_fmt#';
>       end;
>       /]';
> 
>   BEGIN
>     
>     
>     L_ORIG_ENV := DBMS_REPORT.FORMAT_PARAM_VALUES();
>     L_SET_ENV  := DBMS_REPORT.SETUP_REPORT_ENV(L_ORIG_ENV);
> 
>     
>     DBMS_REPORT.GET_TIMING_INFO(0, L_ELAPSED, L_CPU);
> 
>     
> 
>     
>     IF (START_TIME IS NOT NULL) THEN
>       L_REF_PARAMS('start_time') :=
>         TO_CHAR(START_TIME,DBMS_REPORT.DATE_FMT_MOD);
>     END IF;
> 
>     IF (END_TIME IS NOT NULL) THEN
>       L_REF_PARAMS('end_time') :=
>         TO_CHAR(END_TIME,DBMS_REPORT.DATE_FMT_MOD);
>     END IF;
> 
>     IF (INST_ID_LOW IS NOT NULL) THEN
>       L_REF_PARAMS('inst_id_low') := TO_CHAR(INST_ID_LOW);
>     END IF;
> 
>     IF (INST_ID_HIGH IS NOT NULL) THEN
>       L_REF_PARAMS('inst_id_high') := TO_CHAR(INST_ID_HIGH);
>     END IF;
> 
>     L_REF_PARAMS('is_realtime') := 1;
> 
>     IF (SHOW_SQL IS NOT NULL) THEN
>       L_REF_PARAMS('show_sql') := SHOW_SQL; 
>     END IF;
> 
>     
>     IF (L_INST_ID_LOW IS NULL) THEN
>       L_INST_ID_LOW := 0;
>     END IF;
> 
>     IF (L_INST_ID_HIGH IS NULL) THEN
>       L_INST_ID_HIGH := INST_ID_MAX;
>     END IF;
> 
>     
>     IF (END_TIME IS NULL) THEN
>       L_END_TIME := SYSDATE;
>     END IF;
> 
>     
>     IF (START_TIME IS NULL) THEN
>       L_START_TIME := L_END_TIME - 1/24;
>     END IF;
> 
>     
>     CALCULATE_BUCKETS(L_BUCKET_COUNT, L_BUCKET_INTERVAL, 
>                       (L_END_TIME - L_START_TIME)*DTOS,
>                       NULL);
> 
>     
>     L_QUERY := ADW_RMMETRICS_COMMON;
>    
>     
>     L_QUERY := REPLACE(L_QUERY,'#GENERATE_BUCKETS_TAG#', GENERATE_BUCKETS_TAG2);
>     L_QUERY := REPLACE(L_QUERY,'#GENERATE_BUCKETID_TAG#', 
>                                 GENERATE_BUCKETID_TAG);
>     L_QUERY := REPLACE(L_QUERY,'#GENERATE_METRICS_BUCKETID#', 
>                                 ADW_RMMETRICS_REALTIME);
> 
>     IF (SHOW_SQL = 1) THEN
>       
>       L_REPORT_SQL := ADW_RMMETRICS_RT_HEADER;
> 
>       
>       L_REPORT_SQL := L_REPORT_SQL || L_QUERY;
> 
>       
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#is_awr#', 0);
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_contTab#', 'null');
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_start_time#',
>                                             TO_CHAR(L_START_TIME, DATE_FMT));
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_end_time#',
>                                             TO_CHAR(L_END_TIME, DATE_FMT));
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_bucket_count#', L_BUCKET_COUNT);
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_bucket_interval#', 
>                                             L_BUCKET_INTERVAL);
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_inst_id_low#', L_INST_ID_LOW);
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_inst_id_high#', L_INST_ID_HIGH);
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_min_time#', 
>                                             TO_CHAR(L_START_TIME, DATE_FMT));
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_max_time#', 
>                                             TO_CHAR(L_END_TIME, DATE_FMT));
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_duration#',
>                               ROUND((L_END_TIME - L_START_TIME)*DTOS));
>       L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#date_fmt#', DATE_FMT);
> 
>       L_RMMETRICS_XML := I_SHOW_SQL_XML('rsrcmgrmetric', L_REPORT_SQL);
> 
>     ELSE
>       
>       EXECUTE IMMEDIATE L_QUERY
>          INTO L_RMMETRICS_XML
>         USING 0, L_CG_MAP,
>               TO_CHAR(L_START_TIME, DATE_FMT), DATE_FMT, 
>               TO_CHAR(L_START_TIME, DATE_FMT), DATE_FMT, 
>               TO_CHAR(L_START_TIME, DATE_FMT), DATE_FMT, 
>               TO_CHAR(L_START_TIME, DATE_FMT), DATE_FMT, 
>               L_BUCKET_INTERVAL,
>               TO_CHAR(L_START_TIME, DATE_FMT), DATE_FMT,
>               TO_CHAR(L_END_TIME, DATE_FMT), DATE_FMT,
>               L_INST_ID_LOW, L_INST_ID_HIGH,
>               
>               L_BUCKET_INTERVAL, L_BUCKET_COUNT,
>               TO_CHAR(L_START_TIME,DATE_FMT), TO_CHAR(L_END_TIME,DATE_FMT),
>               (L_END_TIME - L_START_TIME)*DTOS;
>     END IF;
> 
>     
>     DBMS_REPORT.GET_TIMING_INFO(1, L_ELAPSED, L_CPU);
> 
>     
>     
>     L_REPORT_XML :=
>       PRVT_REPORT_TAGS.BUILD_REPORT_TAG(
>                          DBMS_REPORT.BUILD_REPORT_REFERENCE_STRUCT(
>                            'awrv','topsql', L_REF_PARAMS),
>                          L_ELAPSED, L_CPU);
> 
>     
>     
>     IF (L_RMMETRICS_XML IS NOT NULL) THEN
>       L_REPORT_XML := L_REPORT_XML.APPENDCHILDXML(XML_ROOT, L_RMMETRICS_XML);
>     END IF;
> 
>     <<DONE>>
>     
>     
>     IF (L_REPORT_XML IS NULL) THEN
>       
>       L_REPORT_XML :=
>         PRVT_REPORT_TAGS.BUILD_REPORT_TAG(
>           DBMS_REPORT.BUILD_REPORT_REFERENCE_STRUCT(
>             'awrv','topsql',L_REF_PARAMS),
>           NULL, NULL);
>     END IF;
> 
>     IF (L_SET_ENV) THEN
>       
>       DBMS_REPORT.RESTORE_REPORT_ENV(L_ORIG_ENV);
>     END IF;
>  
>     
>     RETURN L_REPORT_XML;
> 
>   END REPORT_ADW_WORKLOAD_REALTIME;
> 
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION REPORT_ADW_WORKLOAD_HISTORICAL(
>     START_TIME        IN DATE           DEFAULT NULL,
>     END_TIME          IN DATE           DEFAULT NULL,
>     DBID              IN NUMBER         DEFAULT NULL,
>     INST_ID           IN NUMBER         DEFAULT NULL,
>     SHOW_SQL          IN NUMBER         DEFAULT 0)
>   RETURN XMLTYPE
>   IS
>     
>     L_ELAPSED        NUMBER;
>     L_CPU            NUMBER;
> 
>     
>     L_REF_PARAMS     DBMS_REPORT.REF_STRING_IDSPEC;
> 
>     
>     L_ORIG_ENV       DBMS_REPORT.FORMAT_PARAM_VALUES;
>     L_SET_ENV        BOOLEAN;
> 
>     
>     L_QUERY          VARCHAR2(32767) := NULL;
>     L_REPORT_SQL     CLOB;
> 
>     
>     L_REPORT_XML     XMLTYPE := NULL;
>     L_RMMETRICS_XML  XMLTYPE := NULL;
> 
> 
>     
>     L_START_TIME     DATE := START_TIME;
>     L_END_TIME       DATE := END_TIME;
>     L_DBID           NUMBER := DBID;
>     L_INST_ID        NUMBER := INST_ID;
>     L_CON_ID         NUMBER;
>     L_CON_DBID       NUMBER;
> 
>     
>     L_BUCKET_CALC_INTERVAL   NUMBER;
>     L_BUCKET_CALC_MAX_COUNT  NUMBER;
>     L_BUCKET_MAP             PRVT_AWRV_MAPTAB;
>     L_AWR_PERIOD             PRVT_AWRV_METADATA;
> 
>     
>     L_CG_MAP PRVT_AWRV_INSTTAB := NULL;
> 
>     L_CPU_COUNT NUMBER := NULL;
> 
>     
>     L_ERRMSG                           VARCHAR2(32767);
>     L_ERROR_XML                        XMLTYPE := NULL;
> 
>     ADW_RMMETRICS_AWR CONSTANT VARCHAR2(32767) := q'[
>     select bucket_id,
>            consumer_group_id,
>            consumer_group_name,
>            sum(avg_cpu_utilization) 
>                   avg_cpu_utilization,
>            sum(avg_active_parallel_stmts) 
>                   avg_active_parallel_stmts,
>            sum(avg_queued_parallel_stmts) 
>                   avg_queued_parallel_stmts
>      from (
>         select bucket_id,
>                consumer_group_name,  
>                consumer_group_id,
>                -- avg
>                avg(avg_cpu_utilization) 
>                   avg_cpu_utilization,
>                avg(avg_active_parallel_stmts) 
>                   avg_active_parallel_stmts,
>                avg(avg_queued_parallel_stmts) 
>                   avg_queued_parallel_stmts
>           from table(
>                  cast(:bucket_map as 
>                       sys.prvt_awrv_mapTab)) m,
>                (select /*+ no_merge */ snap_id,
>                        instance_number,
>                        consumer_group_id,
>                        null consumer_group_name,
>                        case 
>                          when :cpu_count is null or
>                               :cpu_count = 0 then
>                            avg_cpu_utilization
>                          else
>                            (avg_running_sessions/:cpu_count)*100
>                          end avg_cpu_utilization,
>                        avg_active_parallel_stmts,
>                        avg_queued_parallel_stmts
>                   from awr_pdb_rsrc_metric
>                  where dbid = :m_dbid 
>                    and snap_id between :m_begin_snap 
>                                    and :m_end_snap
>                    and con_dbid = :l_con_dbid) y
>          where m.snap_id         = y.snap_id
>            and m.instance_number = y.instance_number
>            and y.snap_id         > :m_begin_snap
>          group by bucket_id, 
>                y.instance_number, 
>                y.consumer_group_id, 
>                y.consumer_group_name)
>       group by bucket_id, 
>                consumer_group_id,
>                consumer_group_name]'; 
> 
>   
>   ADW_RMMETRICS_AWR_SQL_HEADER   CONSTANT VARCHAR2(32767) := q'[
>       var is_awr            number;
>       var p_contTab         prvt_awrv_instTab;
>       var bucket_map        prvt_awrv_mapTab;
>       var cpu_count         number;
>       var m_dbid            number;
>       var m_begin_snap      number;
>       var m_end_snap        number;
>       var l_con_dbid        number;
>       var p_bucket_interval number;
>       var p_bucket_count    number;
>       var b_min_time        varchar2(4000);
>       var b_max_time        varchar2(4000);
>       var b_duration        number;
>       begin
>         :is_awr            := #is_awr#;
>         :p_contTab         := #p_contTab#;
>         :bucket_map        := #bucket_map#;
>         :cpu_count         := #cpu_count#;
>         :m_dbid            := #m_dbid#;
>         :m_begin_snap      := #m_begin_snap#;
>         :m_end_snap        := #m_end_snap#;
>         :l_con_dbid        := #l_con_dbid#;
>         :p_bucket_interval := #p_bucket_interval#;
>         :p_bucket_count    := #p_bucket_count#;
>         :b_min_time        := '#b_min_time#';
>         :b_max_time        := '#b_max_time#';
>         :b_duration        := #b_duration#;
>       end;
>       /]';
> 
> 
>   BEGIN
>     
>     
>     L_ORIG_ENV := DBMS_REPORT.FORMAT_PARAM_VALUES();
>     L_SET_ENV  := DBMS_REPORT.SETUP_REPORT_ENV(L_ORIG_ENV);
> 
>     
>     DBMS_REPORT.GET_TIMING_INFO(0, L_ELAPSED, L_CPU);
> 
>     
> 
>     
>     IF (START_TIME IS NOT NULL) THEN
>       L_REF_PARAMS('start_time') :=
>         TO_CHAR(START_TIME,DBMS_REPORT.DATE_FMT_MOD);
>     END IF;
> 
>     IF (END_TIME IS NOT NULL) THEN
>       L_REF_PARAMS('end_time') :=
>         TO_CHAR(END_TIME,DBMS_REPORT.DATE_FMT_MOD);
>     END IF;
> 
>     IF (DBID IS NOT NULL) THEN
>       L_REF_PARAMS('dbid') := TO_CHAR(DBID);
>     END IF;
> 
>     IF (INST_ID IS NOT NULL) THEN
>       L_REF_PARAMS('inst_id') := TO_CHAR(INST_ID);
>     END IF;
> 
>     L_REF_PARAMS('is_realtime') := 0;
> 
>     IF (SHOW_SQL IS NOT NULL) THEN
>       L_REF_PARAMS('show_sql') := SHOW_SQL; 
>     END IF;
> 
>     L_CON_DBID := SYS_CONTEXT('USERENV','CON_DBID');
> 
>     
>     IF (L_DBID IS NULL) THEN
>       L_DBID := L_CON_DBID;
>     END IF;
> 
>     
>     IF (END_TIME IS NULL) THEN
>       L_END_TIME := SYSDATE;
>     END IF;
> 
>     
>     IF (START_TIME IS NULL) THEN
>       L_START_TIME := L_END_TIME - 1;
>     END IF;
> 
>     
>     
>     L_AWR_PERIOD := PRVT_AWRV_METADATA(
>                         P_START_TIME => L_START_TIME, 
>                         P_END_TIME => L_END_TIME,
>                         P_DBID => L_DBID);
> 
>     
>     IF (L_AWR_PERIOD.M_BEGIN_SNAP IS NULL OR
>         L_AWR_PERIOD.M_BEGIN_SNAP = L_AWR_PERIOD.M_END_SNAP) 
>     THEN
> 
>       L_ERRMSG := '[' || L_AWR_PERIOD.M_DBID || ']' ||
>                   '[' || L_AWR_PERIOD.M_INST_ID_LOW || '.' ||
>                          L_AWR_PERIOD.M_INST_ID_HIGH || ']' ||
>                   '[' || L_AWR_PERIOD.M_BEGIN_SNAP || '.' || 
>                          L_AWR_PERIOD.M_END_SNAP || ']' ||
>                   '[' || TO_CHAR(L_AWR_PERIOD.M_MIN_TIME, 
>                                  DBMS_REPORT.DATE_FMT) || '-' ||
>                          TO_CHAR(L_AWR_PERIOD.M_MAX_TIME, 
>                                  DBMS_REPORT.DATE_FMT) || ']';
> 
>       
>       L_AWR_PERIOD := NULL;
> 
>       
>       L_ERROR_XML := ERROR_XML('report_adw_workload_historical',
>                                -20800,
>                                'Insufficient awr data', 
>                                L_ERRMSG);
> 
>     ELSE
> 
>       
>       L_BUCKET_CALC_MAX_COUNT := 128;
>       CREATE_BUCKET_SNAP_MAP(L_AWR_PERIOD, L_BUCKET_MAP, 
>                              L_BUCKET_CALC_MAX_COUNT, L_BUCKET_CALC_INTERVAL);
> 
>       L_CON_ID := SYS_CONTEXT('USERENV','CON_ID');
> 
>       CREATE_CONSUMER_GROUP_MAP(L_CON_ID, L_AWR_PERIOD, L_CG_MAP);
> 
>       
>       BEGIN
>         SELECT VALUE
>           INTO L_CPU_COUNT   
>           FROM V$SYSTEM_PARAMETER2                 
>          WHERE NAME = 'cpu_count';
>       EXCEPTION
>         WHEN OTHERS THEN
>           L_CPU_COUNT := NULL;
>       END;
> 
>       
>       L_QUERY := ADW_RMMETRICS_COMMON;
>    
>       
>       L_QUERY := REPLACE(L_QUERY,'#GENERATE_BUCKETS_TAG#', 
>                                   GENERATE_BUCKETS_TAG2);
>       L_QUERY := REPLACE(L_QUERY,'#GENERATE_BUCKETID_TAG#', 
>                                   GENERATE_BUCKETID_TAG);
>       L_QUERY := REPLACE(L_QUERY,'#GENERATE_METRICS_BUCKETID#', 
>                                   ADW_RMMETRICS_AWR);
> 
>       IF (SHOW_SQL = 1) THEN
>         
>         L_REPORT_SQL := ADW_RMMETRICS_AWR_SQL_HEADER;
> 
>         
>         L_REPORT_SQL := L_REPORT_SQL || L_QUERY;
> 
>         
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#is_awr#', 1);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_contTab#', '');
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#bucket_map#', '');
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#cpu_count#', L_CPU_COUNT);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#m_dbid#', L_AWR_PERIOD.M_DBID);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#m_begin_snap#', 
>                                               L_AWR_PERIOD.M_BEGIN_SNAP);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#m_end_snap#', 
>                                               L_AWR_PERIOD.M_END_SNAP);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#l_con_dbid#', L_CON_DBID);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_bucket_count#', 
>                                               L_BUCKET_CALC_MAX_COUNT);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#p_bucket_interval#', 
>                                               L_BUCKET_CALC_INTERVAL);
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_min_time#', 
>                                 TO_CHAR(L_AWR_PERIOD.M_MIN_TIME, DATE_FMT));
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_max_time#', 
>                                 TO_CHAR(L_AWR_PERIOD.M_MAX_TIME, DATE_FMT));
>         L_REPORT_SQL := REPLACE(L_REPORT_SQL, '#b_duration#',
>                                 ROUND(INTERVAL_TO_SECOND(
>                                   L_AWR_PERIOD.M_MAX_TIME, 
>                                   L_AWR_PERIOD.M_MIN_TIME)));
> 
>         L_RMMETRICS_XML := I_SHOW_SQL_XML('rsrcmgrmetric', L_REPORT_SQL);
> 
>       ELSE
> 
>         EXECUTE IMMEDIATE L_QUERY
>          INTO L_RMMETRICS_XML
>         USING 1, 
>               L_CG_MAP, 
>               L_BUCKET_MAP,
>               L_CPU_COUNT, L_CPU_COUNT, L_CPU_COUNT,
>               L_AWR_PERIOD.M_DBID,
>               L_AWR_PERIOD.M_BEGIN_SNAP,
>               L_AWR_PERIOD.M_END_SNAP,
>               L_CON_DBID,
>               L_AWR_PERIOD.M_BEGIN_SNAP,
>               L_BUCKET_CALC_INTERVAL,
>               L_BUCKET_CALC_MAX_COUNT,
>               TO_CHAR(L_AWR_PERIOD.M_MIN_TIME, DATE_FMT),
>               TO_CHAR(L_AWR_PERIOD.M_MAX_TIME, DATE_FMT),
>               ROUND(
>                 INTERVAL_TO_SECOND(
>                   L_AWR_PERIOD.M_MAX_TIME, L_AWR_PERIOD.M_MIN_TIME));
> 
>       END IF;
> 
>     END IF;
> 
>     
>     DBMS_REPORT.GET_TIMING_INFO(1, L_ELAPSED, L_CPU);
> 
>     
>     
>     L_REPORT_XML :=
>       PRVT_REPORT_TAGS.BUILD_REPORT_TAG(
>                          DBMS_REPORT.BUILD_REPORT_REFERENCE_STRUCT(
>                            'awrv','topsql', L_REF_PARAMS),
>                          L_ELAPSED, L_CPU);
> 
>     
>     IF (L_ERROR_XML IS NOT NULL) THEN
>       L_REPORT_XML := L_REPORT_XML.APPENDCHILDXML(XML_ROOT, L_ERROR_XML);
>     
>     ELSE
>       
>       IF (L_RMMETRICS_XML IS NOT NULL) THEN
>         L_REPORT_XML := L_REPORT_XML.APPENDCHILDXML(XML_ROOT, L_RMMETRICS_XML);
>       END IF;
>     END IF;
> 
>     <<DONE>>    
> 
>     
>     IF (L_REPORT_XML IS NULL) THEN
>       
>       L_REPORT_XML :=
>         PRVT_REPORT_TAGS.BUILD_REPORT_TAG(
>           DBMS_REPORT.BUILD_REPORT_REFERENCE_STRUCT(
>             'awrv','topsql',L_REF_PARAMS),
>           NULL, NULL);
>     END IF;
> 
>     IF (L_SET_ENV) THEN
>       
>       DBMS_REPORT.RESTORE_REPORT_ENV(L_ORIG_ENV);
>     END IF;
>  
>     
>     RETURN L_REPORT_XML;
> 
>   END REPORT_ADW_WORKLOAD_HISTORICAL;
> 
SYS.PRVT_EMX - PACKAGE BODY (RU):
2015a2016,2021
>     DBMS_REPORT.REGISTER_REPORT('session', 'cancel_sql',
>                                 'Cancel SQL Action',
>                                  XSD_FILE_ID);
> 
> 
>     
SYS.XS_DATA_SECURITY - PACKAGE BODY (RU):
627c627
< 
---
> CUR_USER  VARCHAR2(128);
631a632
>   CUR_USER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
634c635
<                                            STATEMENT_TYPES, ACLMV);
---
>                                            STATEMENT_TYPES, ACLMV, CUR_USER);
642a644
> CUR_USER VARCHAR2(128);
648c650,652
<   XS_DATA_SECURITY_INT.ENABLE_DISABLE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT, TRUE);
---
>   CUR_USER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   XS_DATA_SECURITY_INT.ENABLE_DISABLE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT, 
>                                                     TRUE, CUR_USER);
658c662
< 
---
> CUR_USER VARCHAR2(128);
665c669,671
<   XS_DATA_SECURITY_INT.ENABLE_DISABLE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT, FALSE);
---
>   CUR_USER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   XS_DATA_SECURITY_INT.ENABLE_DISABLE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT, 
>                                                     FALSE, CUR_USER);
675c681
< 
---
> CUR_USER  VARCHAR2(128);
682c688,689
<   XS_DATA_SECURITY_INT.REMOVE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT);
---
>   CUR_USER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>   XS_DATA_SECURITY_INT.REMOVE_OBJECT_POLICY(POLICY, SCHEMA, OBJECT, CUR_USER);
SYS.XS_DATA_SECURITY_INT - PACKAGE BODY (RU):
640c640,641
<           ACLMV           IN VARCHAR2 := NULL
---
>           ACLMV           IN VARCHAR2 := NULL,
>           INVOKER         IN VARCHAR2 := NULL
643c644
<     NAME "kzraxdsa"
---
>     NAME "kzraxdsa1"
654c655,656
<                ACLMV           OCISTRING, ACLMV INDICATOR SB2) ;
---
>                ACLMV           OCISTRING, ACLMV INDICATOR SB2,
>                INVOKER         OCISTRING, INVOKER INDICATOR SB2) ;
658,661c660,664
<           POLICY IN VARCHAR2,
<           SCHEMA IN VARCHAR2,
<           OBJECT IN VARCHAR2,
<           ENABLE IN BOOLEAN
---
>           POLICY IN  VARCHAR2,
>           SCHEMA IN  VARCHAR2,
>           OBJECT IN  VARCHAR2,
>           ENABLE IN  BOOLEAN,
>           INVOKER IN VARCHAR2
664c667
<     NAME "kzraxdse"
---
>     NAME "kzraxdse1"
671c674,675
<                ENABLE UB1);
---
>                ENABLE UB1,
>                INVOKER OCISTRING, INVOKER INDICATOR SB2);
675,677c679,682
<           POLICY IN VARCHAR2,
<           SCHEMA IN VARCHAR2,
<           OBJECT IN VARCHAR2
---
>           POLICY  IN VARCHAR2,
>           SCHEMA  IN VARCHAR2,
>           OBJECT  IN VARCHAR2,
>           INVOKER IN VARCHAR2
680c685
<     NAME "kzraxdsr"
---
>     NAME "kzraxdsr1"
686c691,692
<                OBJECT OCISTRING);
---
>                OBJECT OCISTRING,
>                INVOKER OCISTRING, INVOKER INDICATOR SB2);
SYS.XS_DIAG - PACKAGE BODY (RU):
19a20
>     L_CURUSER       VARCHAR2(128);
33a35
>     L_CURUSER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
37c39,40
<                                          L_SCHEMA, L_TABLE, NULL, NULL, NULL);
---
>                                          L_CURUSER, L_SCHEMA, L_TABLE, NULL, 
>                                          NULL, NULL);
46c49,50
<                                            I_OBJ_TYPE, L_SCHEMA, L_TABLE, NULL,
---
>                                            I_OBJ_TYPE, L_CURUSER, L_SCHEMA, 
>                                            L_TABLE, NULL,
139a144
>   CUR_USER  VARCHAR2(128);
143c148,149
<     RETURN SYS.XS_DIAG_INT.VALIDATE_WORKSPACE(ERROR_LIMIT);
---
>     CUR_USER := SYS_CONTEXT('USERENV', 'CURRENT_USER');
>     RETURN SYS.XS_DIAG_INT.VALIDATE_WORKSPACE(ERROR_LIMIT, CUR_USER);
SYS.XS_DIAG_INT - PACKAGE BODY (RU):
1175a1176
>                                 INVOKER         IN VARCHAR2 := NULL,
1180c1181
<     IS EXTERNAL NAME "kzraxdsa_int"
---
>     IS EXTERNAL NAME "kzraxdsa_int1"
1193c1194,1196
<    ACLMV INDICATOR SB2)
---
>    ACLMV INDICATOR SB2,
>    INVOKER         OCISTRING,
>    INVOKER         INDICATOR SB2)
1200,1201c1203,1205
<                                  OBJECT IN VARCHAR2
<     ) IS EXTERNAL NAME "kzraxdsr_int"
---
>                                  OBJECT IN VARCHAR2,
>                                  INVOKER IN VARCHAR2 := NULL
>     ) IS EXTERNAL NAME "kzraxdsr_int1"
1208c1212,1214
<    OBJECT OCISTRING)
---
>    OBJECT OCISTRING,
>    INVOKER OCISTRING,
>    INVOKER INDICATOR SB2)
1220c1226,1227
<                                      := FLAG_CHECK_OBJECT)
---
>                                      := FLAG_CHECK_OBJECT,
>                                      I_INVOKER   IN VARCHAR2)
1422c1429,1430
<                           L_TAB_NAME);
---
>                           L_TAB_NAME,
>                           I_INVOKER);
1460c1468,1469
<                              L_TAB_NAME);
---
>                              L_TAB_NAME,
>                              I_INVOKER);
1478c1487,1488
<                               L_TAB_NAME);
---
>                               L_TAB_NAME,
>                               I_INVOKER);
1753a1764
>                                   I_INVOKER IN VARCHAR2,
1891c1902
<                                         L_UIDS, I_VALIDATION_FLAG
---
>                                         L_UIDS, I_VALIDATION_FLAG, I_INVOKER
1999c2010,2011
<   FUNCTION VALIDATE_TABLE(I_SCHEMA IN VARCHAR2, I_TABLE  IN VARCHAR2)
---
>   FUNCTION VALIDATE_TABLE(I_SCHEMA IN VARCHAR2, I_TABLE  IN VARCHAR2,
>                           I_INVOKER IN VARCHAR2)
2054c2066,2067
<       IF VALIDATE_DATA_SECURITY(L_OBJ_IDS(M), L_OBJ_PATH, I_SCHEMA, I_TABLE)
---
>       IF VALIDATE_DATA_SECURITY(L_OBJ_IDS(M), L_OBJ_PATH, I_INVOKER, I_SCHEMA, 
>                                 I_TABLE)
2170a2184
>                            I_INVOKER    IN VARCHAR2,
2221c2235
<         L_TMP := VALIDATE_DATA_SECURITY(I_OBJ_ID, L_OBJ_PATH, 
---
>         L_TMP := VALIDATE_DATA_SECURITY(I_OBJ_ID, L_OBJ_PATH, I_INVOKER,
2224c2238
<         L_TMP := VALIDATE_TABLE(I_SCHEMA, I_TABLE);
---
>         L_TMP := VALIDATE_TABLE(I_SCHEMA, I_TABLE, I_INVOKER);
2356c2370,2371
<   FUNCTION VALIDATE_WORKSPACE(MSG_MAX  IN PLS_INTEGER := 1)
---
>   FUNCTION VALIDATE_WORKSPACE(MSG_MAX  IN PLS_INTEGER := 1,
>                               INVOKER  IN VARCHAR2)
2519c2534,2535
<                                             NULL, NULL, FLAG_CHECK_WORKSPACE);
---
>                                             INVOKER, NULL, NULL, 
>                                             FLAG_CHECK_WORKSPACE);
SYS.XOQ_VALIDATE - PROCEDURE (RU):
11c11
<   SELECT value INTO compat FROM v$parameter WHERE name='compatible';
---
>   SELECT ltrim(value) INTO compat FROM v$parameter WHERE name='compatible';
17,32d16
<     -- check that dependent component XDB is loaded
<     IF sys.dbms_registry.is_loaded('XDB')
<         != 1 THEN
<       ok := FALSE;
<     END IF;
<   END IF;
< 
<   IF ok THEN
<    -- check that expected XDB resources are there
<     IF NOT (dbms_xdb.existsresource('/olap_data_security/public/acls') AND
<             dbms_xdb.existsresource('/xds/dsd')) THEN
<       ok := FALSE;
<     END IF;
<   END IF;
< 
<   IF ok THEN
103c87
<   IF ok THEN
---
>   IF ok and sys.dbms_registry.is_loaded('XDB') = 1 THEN
SYS.WRI$_REPT_ASH_OMX - TYPE BODY (RU):
26d25
<     L_FILTERED          NUMBER          := NULL;
83,85d81
<       L_FILTERED := TO_NUMBER(DBMS_REPORT.GET_PARAM(L_PARAMS, 'filtered', 
<                                                     NULLABLE=>TRUE));
< 
102d97
<                         FILTERED        => L_FILTERED,
173d167
<                         FILTERED        => L_FILTERED,
SYS.WRI$_REPT_AWRV - TYPE BODY (RU):
62a63
>     P_INCLUDE_SQLS     NUMBER := 1;
548,553d548
<       P_LAST_REFRESH_TIME := TO_DATE(
<                                DBMS_REPORT.GET_PARAM(PARAMS,
<                                                       'last_refresh_time',
<                                                       NULLABLE=>TRUE),
<                                DBMS_REPORT.DATE_FMT_MOD);
< 
566a562,566
>       P_INCLUDE_SQLS := TO_NUMBER(
>                           DBMS_REPORT.GET_PARAM(PARAMS,'include_sqls', 
>                                                 NULLABLE=>TRUE));
> 
>       
570d569
< 
572,574d570
<       P_TOP_N_DETAIL := TO_NUMBER(DBMS_REPORT.GET_PARAM(PARAMS,'top_n_detail',
<                                                    NULLABLE=>TRUE));
< 
576,579c572,588
<       P_OUTER_START_TIME := TO_DATE(
<                               DBMS_REPORT.GET_PARAM(PARAMS,'outer_start_time',
<                                                     NULLABLE=>TRUE),
<                               DBMS_REPORT.DATE_FMT_MOD);
---
>       IF (DBMS_SQLTUNE_UTIL2.IS_ADW() AND SYS_CONTEXT('USERENV', 'CON_ID') > 2) 
>       THEN
>         IF (P_IS_REALTIME = 0) THEN
>           REPORT_XML := PRVT_AWR_VIEWER.REPORT_ADW_WORKLOAD_HISTORICAL(
>                           START_TIME        => P_START_TIME,
>                           END_TIME          => P_END_TIME,
>                           DBID              => P_DBID,
>                           INST_ID           => P_INST_ID,
>                           SHOW_SQL          => P_SHOW_SQL);
>         ELSE
>           REPORT_XML := PRVT_AWR_VIEWER.REPORT_ADW_WORKLOAD_REALTIME(
>                           START_TIME        => P_START_TIME,
>                           END_TIME          => P_END_TIME,
>                           INST_ID_LOW       => P_INST_ID,
>                           INST_ID_HIGH      => P_INST_ID,
>                           SHOW_SQL          => P_SHOW_SQL);
>         END IF;
582,585c591,594
<       P_OUTER_END_TIME := TO_DATE(
<                       DBMS_REPORT.GET_PARAM(PARAMS,'outer_end_time',
<                                                     NULLABLE=>TRUE),
<                             DBMS_REPORT.DATE_FMT_MOD);
---
>       ELSE
>         
>         
>         
587,589c596,600
<       
<       P_DIM_NAME := DBMS_REPORT.GET_PARAM(PARAMS,'dim_name',NULLABLE=>TRUE);
<       P_DIM_STAT := DBMS_REPORT.GET_PARAM(PARAMS,'dim_stat',NULLABLE=>TRUE);
---
>         P_LAST_REFRESH_TIME := TO_DATE(
>                                  DBMS_REPORT.GET_PARAM(PARAMS,
>                                                         'last_refresh_time',
>                                                         NULLABLE=>TRUE),
>                                  DBMS_REPORT.DATE_FMT_MOD);
591,603c602,610
<       REPORT_XML := PRVT_AWR_VIEWER.REPORT_TOPSQL_XML(
<                       START_TIME        => P_START_TIME,
<                       END_TIME          => P_END_TIME,
<                       LAST_REFRESH_TIME => P_LAST_REFRESH_TIME,
<                       INST_ID           => P_INST_ID,
<                       DBID              => P_DBID,
<                       IS_REALTIME       => P_IS_REALTIME,
<                       TOP_N_DETAIL      => P_TOP_N_DETAIL,
<                       OUTER_START_TIME  => P_OUTER_START_TIME,
<                       OUTER_END_TIME    => P_OUTER_END_TIME,
<                       DIM_NAME          => P_DIM_NAME,
<                       DIM_STAT          => P_DIM_STAT,
<                       SHOW_SQL          => P_SHOW_SQL);
---
>         
>         P_TOP_N_DETAIL := TO_NUMBER(DBMS_REPORT.GET_PARAM(PARAMS,'top_n_detail',
>                                                      NULLABLE=>TRUE));
> 
>         
>         P_OUTER_START_TIME := TO_DATE(
>                                 DBMS_REPORT.GET_PARAM(PARAMS,'outer_start_time',
>                                                       NULLABLE=>TRUE),
>                                 DBMS_REPORT.DATE_FMT_MOD);
604a612,636
>         
>         P_OUTER_END_TIME := TO_DATE(
>                               DBMS_REPORT.GET_PARAM(PARAMS,'outer_end_time',
>                                                     NULLABLE=>TRUE),
>                               DBMS_REPORT.DATE_FMT_MOD);
> 
>         
>         P_DIM_NAME := DBMS_REPORT.GET_PARAM(PARAMS,'dim_name',NULLABLE=>TRUE);
>         P_DIM_STAT := DBMS_REPORT.GET_PARAM(PARAMS,'dim_stat',NULLABLE=>TRUE);
> 
>         REPORT_XML := PRVT_AWR_VIEWER.REPORT_TOPSQL_XML(
>                         START_TIME        => P_START_TIME,
>                         END_TIME          => P_END_TIME,
>                         LAST_REFRESH_TIME => P_LAST_REFRESH_TIME,
>                         INST_ID           => P_INST_ID,
>                         DBID              => P_DBID,
>                         IS_REALTIME       => P_IS_REALTIME,
>                         TOP_N_DETAIL      => P_TOP_N_DETAIL,
>                         OUTER_START_TIME  => P_OUTER_START_TIME,
>                         OUTER_END_TIME    => P_OUTER_END_TIME,
>                         DIM_NAME          => P_DIM_NAME,
>                         DIM_STAT          => P_DIM_STAT,
>                         INCLUDE_SQLS      => P_INCLUDE_SQLS,
>                         SHOW_SQL          => P_SHOW_SQL);
>       END IF;
SYS.WRI$_REPT_SESSION - TYPE BODY (RU):
21a22
>     V_SQL_ID                  VARCHAR2(32767);
118a120,150
>                         
>       
>       
>       
>       
>       
>       WHEN V_REPORT_NAME = 'cancel_sql' THEN
> 
>         
>         V_SID := TO_NUMBER(DBMS_REPORT.GET_PARAM(V_PARAMS, 'session_id', TRUE));
> 
>         
>         V_SERIAL_NUM := TO_NUMBER(DBMS_REPORT.GET_PARAM(V_PARAMS,
>                                                        'session_serial', TRUE));
> 
>         
>         V_SQL_ID := DBMS_REPORT.GET_PARAM(V_PARAMS, 'sql_id', TRUE);
>  
>         
>         V_INST_ID := TO_NUMBER(DBMS_REPORT.GET_PARAM(V_PARAMS, 'inst_id'));
>         
>         
>         V_SHOW_SQL := TO_NUMBER(DBMS_REPORT.GET_PARAM(V_PARAMS, 'show_sql'));
> 
>        
>        V_REPORT_XML := 
>             PRVTEMX_PERF.ACTION_CANCEL_SQL_XML(P_SID=>V_SID,
>                                                    P_SERIAL_NUM=>V_SERIAL_NUM,
> 						   P_INST_ID=>V_INST_ID,
>                                                    P_SQL_ID=>V_SQL_ID,
>                                                    P_SHOW_SQL=>V_SHOW_SQL);
124c156
<                                           LOWER(PRVT_EMX.COMPONENT_STRING));
---
>                                           LOWER(PRVT_EMX.COMPONENT_STRING));                                         
SYS.CDB_WORKLOAD_CAPTURES - VIEW (RU):
1c1
< SELECT k."ID",k."NAME",k."DBID",k."DBNAME",k."DBVERSION",k."PARALLEL",k."DIRECTORY",k."STATUS",k."START_TIME",k."END_TIME",k."DURATION_SECS",k."START_SCN",k."END_SCN",k."DEFAULT_ACTION",k."FILTERS_USED",k."CAPTURE_SIZE",k."DBTIME",k."DBTIME_TOTAL",k."USER_CALLS",k."USER_CALLS_TOTAL",k."USER_CALLS_UNREPLAYABLE",k."PLSQL_SUBCALL_SIZE",k."PLSQL_CALLS",k."PLSQL_SUBCALLS",k."PLSQL_DBTIME",k."TRANSACTIONS",k."TRANSACTIONS_TOTAL",k."CONNECTS",k."CONNECTS_TOTAL",k."ERRORS",k."AWR_DBID",k."AWR_BEGIN_SNAP",k."AWR_END_SNAP",k."AWR_EXPORTED",k."ERROR_CODE",k."ERROR_MESSAGE",k."DIR_PATH",k."DIR_PATH_SHARED",k."LAST_PROCESSED_VERSION",k."SQLSET_OWNER",k."SQLSET_NAME",k."PLSQL_MODE",k."ENCRYPTION",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_CAPTURES") k
---
> SELECT k."ID",k."NAME",k."DBID",k."DBNAME",k."DBVERSION",k."PARALLEL",k."DIRECTORY",k."STATUS",k."START_TIME",k."END_TIME",k."DURATION_SECS",k."START_SCN",k."END_SCN",k."DEFAULT_ACTION",k."FILTERS_USED",k."CAPTURE_SIZE",k."DBTIME",k."DBTIME_TOTAL",k."USER_CALLS",k."USER_CALLS_TOTAL",k."USER_CALLS_UNREPLAYABLE",k."PLSQL_SUBCALL_SIZE",k."PLSQL_CALLS",k."PLSQL_SUBCALLS",k."PLSQL_DBTIME",k."TRANSACTIONS",k."TRANSACTIONS_TOTAL",k."CONNECTS",k."CONNECTS_TOTAL",k."ERRORS",k."AWR_DBID",k."AWR_BEGIN_SNAP",k."AWR_END_SNAP",k."AWR_EXPORTED",k."ERROR_CODE",k."ERROR_MESSAGE",k."DIR_PATH",k."DIR_PATH_SHARED",k."LAST_PROCESSED_VERSION",k."SQLSET_OWNER",k."SQLSET_NAME",k."PLSQL_MODE",k."ENCRYPTION",k."ENCRYPTION_VERIFIER",k."CON_ID", k.CON$NAME, k.CDB$NAME, k.CON$ERRNUM, k.CON$ERRMSG FROM CONTAINERS("SYS"."DBA_WORKLOAD_CAPTURES") k
SYS.DBA_APP_VERSIONS - VIEW (RU):
1c1,2
< select a.app_name, v.tgtver, v.cmnt, v.spare1
---
> select a.app_name, v.tgtver, v.cmnt, v.spare1,
>        con_id_to_con_name(con_uid_to_id(v.root_clone_con_uid#))
SYS.DBA_WORKLOAD_CAPTURES - VIEW (RU):
30c30,31
<  , decode(nvl(r.plsql_mode, 0), 0, 'TOP_LEVEL', 1, 'EXTENDED', 2, 'EXTENDED_SYS', 'INVALID')
---
>  , decode( nvl(r.plsql_mode, 0), 0,'TOP_LEVEL', 1,'EXTENDED', 2,'EXTENDED_SYS',
>                                  'INVALID' )
31a33
>  , encryption_verifier
SYS.DBA_WORKLOAD_REPLAYS - VIEW (RU):
14c14
<  , decode(r.synchronization, 1, 'SCN', 2, 'OBJECT_ID', 'FALSE')
---
>  , decode(nvl(r.synchronization, 0), 1, 'SCN', 2, 'OBJECT_ID', 'FALSE')
17c17
<  , decode(r.think_time_auto_correct, 1, 'TRUE', 'FALSE')
---
>  , decode(nvl(r.think_time_auto_correct, 0), 1, 'TRUE', 'FALSE')
26c26
<  , decode(r.awr_exported, 1, 'YES', 0, 'NO', 'NOT POSSIBLE')
---
>  , decode(nvl(r.awr_exported, -1), 1, 'YES', 0, 'NO', 'NOT POSSIBLE')
35,37c35,37
<  , decode(r.connect_time_auto_correct, 1, 'YES', 0, 'NO', 'NOT POSSIBLE')
<  , decode(r.rac_mode, 0, 'GLOBAL_SYNC', 1, 'PER_INSTANCE_CLIENT', 2, 'PER_INSTANCE_SYNC','INVALID')
<  , decode(bitand(r.flags, 1), 0, 'N','Y') as QUERY_ONLY
---
>  , decode(nvl(r.connect_time_auto_correct, -1), 1, 'YES', 0, 'NO', 'NOT POSSIBLE')
>  , decode(nvl(r.rac_mode, -1), 0, 'GLOBAL_SYNC', 1, 'PER_INSTANCE_CLIENT', 2, 'PER_INSTANCE_SYNC','INVALID')
>  , decode(bitand(nvl(r.flags, 0), 1), 0, 'N','Y') as QUERY_ONLY
41,52c41,52
<            sum(decode(parallel,'YES',1,0)) as parallel,
<            sum(user_calls) as user_calls,
<            sum(dbtime) as dbtime,
<            sum(network_time) as network_time,
<            sum(think_time) as think_time,
<            sum(time_gain) as time_gain,
<            sum(time_loss) as time_loss,
<            sum(time_paused) as time_paused,
<            sum(plsql_calls) as plsql_calls,
<            sum(plsql_subcalls) as plsql_subcalls,
<            sum(plsql_dbtime) as plsql_dbtime,
<            sum(replay_deadlocks) AS replay_deadlocks
---
>            sum(decode(nvl(parallel, 'NO'),'YES',1,0)) as parallel,
>            sum(nvl(user_calls, 0)) as user_calls,
>            sum(nvl(dbtime, 0)) as dbtime,
>            sum(nvl(network_time, 0)) as network_time,
>            sum(nvl(think_time, 0)) as think_time,
>            sum(nvl(time_gain, 0)) as time_gain,
>            sum(nvl(time_loss, 0)) as time_loss,
>            sum(nvl(time_paused, 0)) as time_paused,
>            sum(nvl(plsql_calls, 0)) as plsql_calls,
>            sum(nvl(plsql_subcalls, 0)) as plsql_subcalls,
>            sum(nvl(plsql_dbtime, 0)) as plsql_dbtime,
>            sum(nvl(replay_deadlocks, 0)) AS replay_deadlocks
XDB.DBMS_JSON - PACKAGE (RU):
108a109,111
> --  materialize
> --     The materialize argument will be a boolean that will tell us whether the
> --     view will be materialized or not.
114c117,118
<                       resourcePath VARCHAR2 DEFAULT NULL);
---
>                       resourcePath VARCHAR2 DEFAULT NULL,
>                       materialize BOOLEAN DEFAULT FALSE);
XDB.DBMS_JSON - PACKAGE BODY (RU):
349,350d348
<   OWN     VARCHAR2(130) := OWNER;
<   TBN     VARCHAR2(130) := TABLENAME;
352c350
<   OPEN RELC_CUR(OWN, TBN);
---
>   OPEN RELC_CUR(OWNER, TABLENAME);
533,535c531,533
<                           VIEWNAME VARCHAR2,
<                           TABLENAME VARCHAR2,
<                           COLNAME VARCHAR2,
---
>                           VNAME VARCHAR2,
>                           TNAME VARCHAR2,
>                           CNAME VARCHAR2,
540c538,539
<                           RESOURCEPATH VARCHAR2)
---
>                           RESOURCEPATH VARCHAR2,
>                           MATERIALIZE BOOLEAN)
543,545c542
< VNAME VARCHAR2(130) := VIEWNAME;
< TNAME VARCHAR2(130) := TABLENAME;
< CNAME VARCHAR2(130) := COLNAME;
---
> HASPK  BOOLEAN := FALSE;
561c558
<   BUILDRCOLS(OWNER, TABLENAME, RELDDL, RCSTK, COLCNT);
---
>   BUILDRCOLS(OWNER, TNAME, RELDDL, RCSTK, COLCNT);
574c571,578
<   DDL := 'CREATE OR REPLACE VIEW ';
---
>   IF (MATERIALIZE) THEN
>     DDL := 'CREATE MATERIALIZED VIEW ';
>     IF (SYS.DBMS_JSON0.CHECKPK(OWNER, TNAME)) THEN
>       HASPK := TRUE;
>     END IF;
>   ELSE
>     DDL := 'CREATE OR REPLACE VIEW ';
>   END IF;
576c580,595
<   DDL := DDL||DBMS_ASSERT.ENQUOTE_NAME(VNAME,FALSE)||' AS SELECT ';
---
>   DDL := DDL||DBMS_ASSERT.ENQUOTE_NAME(VNAME,FALSE);
>   
>   IF (MATERIALIZE) THEN
>     DDL := DDL||'BUILD IMMEDIATE REFRESH FAST ON STATEMENT WITH ';
>     IF (HASPK) THEN
>       DDL := DDL||'PRIMARY KEY ';
>     ELSE
>       DDL := DDL||'ROWID ';
>     END IF;
>   END IF;
>   DDL := DDL||' AS SELECT ';
>   
>   IF (MATERIALIZE = TRUE AND HASPK = FALSE) THEN
>     DDL := DDL||'RT."ROWID" ROW_ID, ';
>   END IF;
> 
1039c1058,1059
<                       RESOURCEPATH VARCHAR2 DEFAULT NULL)
---
>                       RESOURCEPATH VARCHAR2 DEFAULT NULL,
>                       MATERIALIZE BOOLEAN DEFAULT FALSE)
1070c1090
<                   ERRSTR, COLCNT, RESOURCEPATH);
---
>                   ERRSTR, COLCNT, RESOURCEPATH, MATERIALIZE);

1 comments

    • John on May 23, 2021 at 09:56
    • Reply

    THANK YOU! We just discovered during our quarterly PROD patching for April 2021 - 19c that in some situations updated package bodies were being run in before the package definition files, and were getting a lot of variables like STAT_CPU_COUNT_B showing up as undefined. Being able to search for those here directly led to us figuring that out!

Leave a Reply

Your email address will not be published.