Dissecting 200114 BP, PSU, RU and RUR

This post is also available in: English

I am quarterly writing a post dissecting the changes implemented by Oracle CPUs so we can understand better the modifications implemented by Oracle in our Databases.

To check previous changes, follow the links below:

So what oracle internal objects were changed in January 2020 - 200114?

VERSION    PATCH      OWNER                          TYPE                 TOTAL
---------- ---------- ------------------------------ --------------- ----------
11.2.0.4   BP         SYS                            PACKAGE                  1
12.1.0.2   BP         SYS                            PACKAGE                  2
12.1.0.2   BP         SYS                            PACKAGE BODY             8
12.1.0.2   PSU        SYS                            PACKAGE                  1
12.1.0.2   PSU        SYS                            PACKAGE BODY             4
12.2.0.1   JUL2019RUR SYS                            PACKAGE                  4
12.2.0.1   JUL2019RUR SYS                            PACKAGE BODY             9
12.2.0.1   JUL2019RUR SYS                            VIEW                     1
12.2.0.1   OCT2019RUR SYS                            PACKAGE                  4
12.2.0.1   OCT2019RUR SYS                            PACKAGE BODY             9
12.2.0.1   OCT2019RUR SYS                            VIEW                     1
12.2.0.1   RU         SYS                            PACKAGE                  5
12.2.0.1   RU         SYS                            PACKAGE BODY            10
18.0.0.0   18.7RUR    SYS                            PACKAGE                  6
18.0.0.0   18.7RUR    SYS                            PACKAGE BODY             1
18.0.0.0   18.8RUR    SYS                            PACKAGE                  6
18.0.0.0   18.8RUR    SYS                            PACKAGE BODY             1
18.0.0.0   RU         SYS                            PACKAGE                  6
18.0.0.0   RU         SYS                            PACKAGE BODY             4
19.0.0.0   19.4RUR    SYS                            PACKAGE                  6
19.0.0.0   19.4RUR    SYS                            PACKAGE BODY             2
19.0.0.0   19.5RUR    SYS                            PACKAGE                  6
19.0.0.0   19.5RUR    SYS                            PACKAGE BODY             2
19.0.0.0   RU         MDSYS                          PACKAGE                  2
19.0.0.0   RU         MDSYS                          PACKAGE BODY             2
19.0.0.0   RU         SYS                            FUNCTION                 1
19.0.0.0   RU         SYS                            PACKAGE                 13
19.0.0.0   RU         SYS                            PACKAGE BODY            26
19.0.0.0   RU         XDB                            PACKAGE BODY             2

And created?

VERSION    PATCH      OWNER                          TYPE                 TOTAL
---------- ---------- ------------------------------ --------------- ----------
12.2.0.1   RU         SYS                            PACKAGE                  1
12.2.0.1   RU         SYS                            PACKAGE BODY             1
19.0.0.0   RU         SYS                            PACKAGE                  1
19.0.0.0   RU         SYS                            PACKAGE BODY             1
19.0.0.0   RU         SYS                            TYPE                     2
19.0.0.0   RU         SYS                            TYPE BODY                1

P.S: Nothing was added for 11.2 / 12.1 / 18  in Oracle objects.

So which are exactly the objects modified by 191016?

VERSION    PATCH           OWNER                          TYPE            NAME                           ACTION
---------- --------------- ------------------------------ --------------- ------------------------------ ------
11.2.0.4   BP              SYS                            PACKAGE         DBMS_SWRF_REPORT_INTERNAL      MOD
12.1.0.2   BP              SYS                            PACKAGE         DBMS_PLUGTS                    MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_PLUGTS                    MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_SPACE_ADMIN               MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_SQLPATCH                  MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_STATS                     MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE         DBMS_SWRF_REPORT_INTERNAL      MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE BODY    DBMS_AWR_REPORT_LAYOUT         MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE BODY    DBMS_SWRF_REPORT_INTERNAL      MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE BODY    DBMS_XSTREAM_ADM_INTERNAL      MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE BODY    DBMS_XSTREAM_AUTH_IVK          MOD
12.2.0.1   RU              SYS                            PACKAGE         DBMS_AWR_PROTECTED             NEW
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_AWR_PROTECTED             NEW
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE         DBMS_RCVMAN                    MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE         DBMS_REDEFINITION_INTERNAL     MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE BODY    DBMS_HEAT_MAP_INTERNAL         MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE BODY    DBMS_REDEFINITION              MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE BODY    DBMS_REDEFINITION_INTERNAL     MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            PACKAGE BODY    DBMS_STATS_ADVISOR             MOD
           JUL2019RUR
12.2.0.1   OCT2019RUR &    SYS                            VIEW            DBA_APPLY_ERROR                MOD
           JUL2019RUR
12.2.0.1   RU              SYS                            PACKAGE         DBMS_PDB                       MOD
12.2.0.1   RU              SYS                            PACKAGE         DBMS_SWRF_REPORT_INTERNAL      MOD
12.2.0.1   RU              SYS                            PACKAGE         DBMS_UMF_PROTECTED             MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_AWR_REPORT_LAYOUT         MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_PDB                       MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_QOPATCH                   MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_SPACE_ADMIN               MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_SWRF_REPORT_INTERNAL      MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    KUPW$WORKER                    MOD
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE         DBMS_MVIEW_STATS_INTERNAL      MOD
            & JUL2019RUR
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE         DBMS_SYNC_REFRESH_INTERNAL     MOD
            & JUL2019RUR
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE BODY    DBMS_SNAP_INTERNAL             MOD
            & JUL2019RUR
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE BODY    DBMS_STATS                     MOD
            & JUL2019RUR
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE BODY    DBMS_SYNC_REFRESH_INTERNAL     MOD
            & JUL2019RUR
12.2.0.1   RU & OCT2019RUR SYS                            PACKAGE BODY    PRVT_ILM                       MOD
            & JUL2019RUR
18.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_STATS                     MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    KUPW$WORKER                    MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    PRVT_ILM                       MOD
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_AWR_PROTECTED             MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_BACKUP_RESTORE            MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_MVIEW_STATS_INTERNAL      MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_REGISTRY                  MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_SYNC_REFRESH_INTERNAL     MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE         DBMS_UMF_PROTECTED             MOD
           18.7RUR
18.0.0.0   RU & 18.8RUR &  SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
           18.7RUR
19.0.0.0   RU              SYS                            PACKAGE         DBMS_AQ_SUB                    NEW
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_SUB                    NEW
19.0.0.0   RU              SYS                            TYPE            AQ$_BND                        NEW
19.0.0.0   RU              SYS                            TYPE            AQ$_BND_ARRAY                  NEW
19.0.0.0   RU              SYS                            TYPE BODY       AQ$_BND                        NEW
19.0.0.0   RU              MDSYS                          PACKAGE         SDO_RDF                        MOD
19.0.0.0   RU              MDSYS                          PACKAGE         SDO_RDF_JAVA_STP               MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_RDF                        MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_TPIDX                      MOD
19.0.0.0   RU              SYS                            FUNCTION        AQ$_GET_SUBSCRIBERS            MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_AQ_INV                    MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_ASH                       MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_AUTO_INDEX                MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_AUTO_INDEX_INTERNAL       MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_JSON0                     MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_RCVMAN                    MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_SPM_INTERNAL              MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQADM_INV                 MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQADM_SYS                 MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQADM_VAR                 MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_INV                    MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_SYS_EXP_ACTIONS        MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_SYS_EXP_INTERNAL       MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_SYS_IMP_INTERNAL       MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_ASH                       MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_ASH_INTERNAL              MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AUTO_INDEX                MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AUTO_INDEX_INTERNAL       MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_JSON0                     MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_PRVTAQIM                  MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_PRVTAQIS                  MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_SMB_INTERNAL              MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_SPM_INTERNAL              MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_SQLTUNE                   MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_STATS                     MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_STATS_ADVISOR             MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_SWRF_REPORT_INTERNAL      MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_TRANSFORM_EXIMP           MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_TRANSFORM_EXIMP_INTERNAL  MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_TRANSFORM_INTERNAL        MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    KUPW$WORKER                    MOD
19.0.0.0   RU              XDB                            PACKAGE BODY    DBMS_JSON                      MOD
19.0.0.0   RU              XDB                            PACKAGE BODY    DBMS_SODA_ADMIN                MOD
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_AWR_PROTECTED             MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_BACKUP_RESTORE            MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_MVIEW_STATS_INTERNAL      MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_REGISTRY                  MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_SYNC_REFRESH_INTERNAL     MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE         DBMS_UMF_PROTECTED             MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
           19.4RUR
19.0.0.0   RU & 19.5RUR &  SYS                            PACKAGE BODY    DBMS_SPM                       MOD
           19.4RUR

What changed for each? (click to see the changes)

Changed Objects

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

11.2.0.4

SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE (BP):
3d2
< 

12.1.0.2

SYS.DBMS_PLUGTS - PACKAGE (BP):
398,418c398,418
<   PROCEDURE reclaimTempSegment (
<         file_no         IN binary_integer,
<         block_no        IN binary_integer,
<         type_no         IN binary_integer,
<         ts_no           IN binary_integer,
<         blocks          IN binary_integer,
<         extents         IN binary_integer,
<         iniexts         IN binary_integer,
<         minexts         IN binary_integer,
<         maxexts         IN binary_integer,
<         extsize         IN binary_integer,
<         extpct          IN binary_integer,
<         user_no         IN binary_integer,
<         lists           IN binary_integer,
<         groups          IN binary_integer,
<         bitmapranges    IN number,
<         cachehint       IN binary_integer,
<         scanhint        IN binary_integer,
<         hwmincr         IN binary_integer,
<         spare1          IN number,
<         spare2          IN binary_integer);
---
>   PROCEDURE reclaimTempSegment(
>         file_no         IN BINARY_INTEGER,
>         block_no        IN BINARY_INTEGER,
>         type_no         IN BINARY_INTEGER,
>         ts_no           IN BINARY_INTEGER,
>         blocks          IN BINARY_INTEGER,
>         extents         IN BINARY_INTEGER,
>         iniexts         IN BINARY_INTEGER,
>         minexts         IN BINARY_INTEGER,
>         maxexts         IN BINARY_INTEGER,
>         extsize         IN BINARY_INTEGER,
>         extpct          IN BINARY_INTEGER,
>         user_no         IN BINARY_INTEGER,
>         lists           IN BINARY_INTEGER,
>         groups          IN BINARY_INTEGER,
>         bitmapranges    IN NUMBER,
>         cachehint       IN BINARY_INTEGER,
>         scanhint        IN BINARY_INTEGER,
>         hwmincr         IN NUMBER,
>         spare1          IN NUMBER,
>         spare2          IN BINARY_INTEGER);
688c688
<         hwmincr         IN binary_integer,
---
>         hwmincr         IN number,
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE (PSU):
3,6d2
< 
<   
<   COMMON_SECTIONS_INITIALIZED    BOOLEAN;
< 
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE (BP):
5,7d4
<   COMMON_SECTIONS_INITIALIZED    BOOLEAN;
< 
<   
SYS.DBMS_AWR_REPORT_LAYOUT - PACKAGE BODY (PSU):
17995c17995
<   IF  DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED THEN
---
>   IF  DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED THEN
17999c17999
<   DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED := TRUE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED := TRUE;
SYS.DBMS_AWR_REPORT_LAYOUT - PACKAGE BODY (BP):
17994c17994
<   IF  DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED THEN
---
>   IF  DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED THEN
17998c17998
<   DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED := TRUE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED := TRUE;
SYS.DBMS_PLUGTS - PACKAGE BODY (BP):
39c39
<     HWMINCR             BINARY_INTEGER,
---
>     HWMINCR             NUMBER,
84,85d83
<   
<   
109d106
< 
2469c2466
<     HWMINCR       IN BINARY_INTEGER,
---
>     HWMINCR       IN NUMBER,
2965,2984c2962,2980
<     FILE_NO       IN BINARY_INTEGER,
<     BLOCK_NO      IN BINARY_INTEGER,
<     TYPE_NO       IN BINARY_INTEGER,
<     TS_NO         IN BINARY_INTEGER,
<     BLOCKS        IN BINARY_INTEGER,
<     EXTENTS       IN BINARY_INTEGER,
<     INIEXTS       IN BINARY_INTEGER,
<     MINEXTS       IN BINARY_INTEGER,
<     MAXEXTS       IN BINARY_INTEGER,
<     EXTPCT        IN BINARY_INTEGER,
<     USER_NO       IN BINARY_INTEGER,
<     LISTS         IN BINARY_INTEGER,
<     GROUPS        IN BINARY_INTEGER,
<     BITMAPRANGES  IN BINARY_INTEGER,
<     CACHEHINT     IN BINARY_INTEGER,
<     SCANHINT      IN BINARY_INTEGER,
<     HWMINCR       IN BINARY_INTEGER,
<     SPARE1        IN NUMBER,
<     SPARE2        IN BINARY_INTEGER) IS
< 
---
>   FILE_NO       IN BINARY_INTEGER,
>   BLOCK_NO      IN BINARY_INTEGER,
>   TYPE_NO       IN BINARY_INTEGER,
>   TS_NO         IN BINARY_INTEGER,
>   BLOCKS        IN BINARY_INTEGER,
>   EXTENTS       IN BINARY_INTEGER,
>   INIEXTS       IN BINARY_INTEGER,
>   MINEXTS       IN BINARY_INTEGER,
>   MAXEXTS       IN BINARY_INTEGER,
>   EXTPCT        IN BINARY_INTEGER,
>   USER_NO       IN BINARY_INTEGER,
>   LISTS         IN BINARY_INTEGER,
>   GROUPS        IN BINARY_INTEGER,
>   BITMAPRANGES  IN BINARY_INTEGER,
>   CACHEHINT     IN BINARY_INTEGER,
>   SCANHINT      IN BINARY_INTEGER,
>   HWMINCR       IN NUMBER,
>   SPARE1        IN NUMBER,
>   SPARE2        IN BINARY_INTEGER) IS
SYS.DBMS_SPACE_ADMIN - PACKAGE BODY (BP):
576a577,580
>     ELSIF (SEGMENT_TYPE = 'TABLE PARTITION') THEN
>       V_PART_NAME  := SUBSTR(PARTITION_NAME, 1, 30);
>       V_TABLE_NAME := SUBSTR(SEGMENT_NAME, 1, 30);
> 
590c594
<   IF (V_SEG_TYPE != 'TABLE') THEN
---
>   IF (V_SEG_TYPE != 'TABLE' AND V_SEG_TYPE != 'TABLE PARTITION') THEN
602c606
<  
---
>   
615c619
<   ELSE
---
>   ELSIF (V_SEG_TYPE = 'TABLE PARTITION') THEN
617,619c621,627
<     SEGMENT_REPAIR_SFILE(V_OWNER, V_LOBSEG_NAME, V_SEG_TYPE, 
<                          V_LOBPART_NAME, REPAIR_OPTION, V_TABLE_NAME, 
<                          V_COLUMN_NAME, V_PART_NAME, V_LOBTYPE);
---
>     ASSM_SEGMENT_REPAIR(V_OWNER, V_TABLE_NAME, V_SEG_TYPE, V_PART_NAME, 29,
>                         NULL, NULL);
>   ELSE
>   
>   SEGMENT_REPAIR_SFILE(V_OWNER, V_LOBSEG_NAME, V_SEG_TYPE, 
>                        V_LOBPART_NAME, REPAIR_OPTION, V_TABLE_NAME, 
>                        V_COLUMN_NAME, V_PART_NAME, V_LOBTYPE);
SYS.DBMS_SQLPATCH - PACKAGE BODY (BP):
65a66,102
>   
>   ORIG_CONTAINER_NAME VARCHAR2(128) := NULL;
>   
> 
>   
>   PROCEDURE DEBUG_PUT_LINE(L IN VARCHAR2) IS
>   BEGIN
>     IF DEBUG THEN
>       DBMS_OUTPUT.PUT_LINE(L);
>     END IF;
>   END DEBUG_PUT_LINE;
> 
>   
>   
>   
>   
>   FUNCTION CHECK_CONTAINER_SWITCH(E_MSG OUT VARCHAR2) RETURN BOOLEAN IS
>     L_CONTAINER_NAME VARCHAR2(128);
>     CONTAINER_SWITCHED BOOLEAN;
>   BEGIN
>     SELECT SYS_CONTEXT('userenv', 'con_name')
>       INTO L_CONTAINER_NAME
>       FROM DUAL;
> 
>     DEBUG_PUT_LINE('l_container_name '||L_CONTAINER_NAME||' orig_container_name '||ORIG_CONTAINER_NAME);
> 
>     IF ORIG_CONTAINER_NAME IS NULL OR
>        L_CONTAINER_NAME != ORIG_CONTAINER_NAME THEN
>       E_MSG := 'Unexpected container change to ' || L_CONTAINER_NAME;
>       CONTAINER_SWITCHED := TRUE;
>     ELSE
>       E_MSG := NULL;
>       CONTAINER_SWITCHED := FALSE;
>     END IF;
> 
>     RETURN CONTAINER_SWITCHED;
>   END;
139c176,177
<           S_PATCH_DIRECTORY_ZIP = PATCH_DIRECTORY_ZIP
---
>           S_PATCH_DIRECTORY_ZIP = PATCH_DIRECTORY_ZIP,
>           S_CONTAINER_NAME = ORIG_CONTAINER_NAME
151a190
>     L_MSG VARCHAR2(300);
183c222,223
<            S_PATCH_DIRECTORY_ZIP
---
>            S_PATCH_DIRECTORY_ZIP,
>            S_CONTAINER_NAME
214c254,255
<       PATCH_DIRECTORY_ZIP
---
>       PATCH_DIRECTORY_ZIP,
>       ORIG_CONTAINER_NAME
217a259,263
>     
>     IF CHECK_CONTAINER_SWITCH(L_MSG) THEN
>       RAISE_APPLICATION_ERROR(-20003, L_MSG);
>     END IF;
> 
265,272d310
<   PROCEDURE DEBUG_PUT_LINE(L IN VARCHAR2) IS
<   BEGIN
<     IF DEBUG THEN
<       DBMS_OUTPUT.PUT_LINE(L);
<     END IF;
<   END DEBUG_PUT_LINE;
< 
<   
655a694,695
>     CONTAINER_SWITCHED BOOLEAN := FALSE;
>     L_MSG VARCHAR2(300);
660,663d699
<     UPDATE DBA_REGISTRY_SQLPATCH
<       SET STATUS = 'END'
<       WHERE ROWID = CURRENT_REGISTRY_ROWID;
< 
665,667c701,702
<     DELETE DBMS_SQLPATCH_STATE
<       WHERE S_CURRENT_PATCH_ID = CURRENT_PATCH.PATCH_ID
<       AND S_CURRENT_PATCH_UID = CURRENT_PATCH.PATCH_UID;
---
>     
>     CONTAINER_SWITCHED := CHECK_CONTAINER_SWITCH(L_MSG);
669c704,713
<     COMMIT;
---
>     IF NOT CONTAINER_SWITCHED THEN
>       
>       UPDATE DBA_REGISTRY_SQLPATCH
>         SET STATUS = 'END'
>         WHERE ROWID = CURRENT_REGISTRY_ROWID;
> 
>       
>       DELETE DBMS_SQLPATCH_STATE
>         WHERE S_CURRENT_PATCH_ID = CURRENT_PATCH.PATCH_ID
>         AND S_CURRENT_PATCH_UID = CURRENT_PATCH.PATCH_UID;
670a715,716
>       COMMIT;
>     END IF;
694a741,746
> 
>     
>     IF CONTAINER_SWITCHED THEN
>       RAISE_APPLICATION_ERROR(-20003, L_MSG);
>     END IF;
> 
707a760
>     L_MSG VARCHAR2(300);
713a767,771
>     
>     IF CHECK_CONTAINER_SWITCH(L_MSG) THEN
>       RAISE_APPLICATION_ERROR(-20003, L_MSG);
>     END IF;
> 
716,717c774,779
<       DEBUG_PUT_LINE('  initialize not complete, never install');
<       RETURN NOTHING_SQL;
---
>       
>       
>       
>       
>       
>       RAISE_APPLICATION_ERROR(-20004, 'Uninitialized state in install_file');
997a1060,1065
> 
>     
>     SELECT SYS_CONTEXT('userenv', 'con_name')
>       INTO ORIG_CONTAINER_NAME
>       FROM DUAL;
> 
SYS.DBMS_STATS - PACKAGE BODY (BP):
32003c32003,32007
<             IF(NOTES_SIZE > 3950) THEN 
---
>             
>             
>             
>             IF((NOTES_SIZE + LENGTH(XSTATS_XML)) > 3950) THEN 
>               
33102a33107
>     TRANS_GTT     BOOLEAN;     
33183c33188,33197
<         FLUSH_ONE_MON_INFO(TOBJN);
---
>         
>         IF (NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>         THEN
>           
>           
>           
>           
>           
>           FLUSH_ONE_MON_INFO(TOBJN);
>         END IF;
33814a33829
>     TRANS_GTT     BOOLEAN;     
33815a33831
> 
34458c34474,34482
<         (PREPARESTATJOBS OR SEQSTATJOBS)) THEN
---
>         (PREPARESTATJOBS OR SEQSTATJOBS) AND 
>         NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>     THEN
>       
>       
>       
>       
>       
> 
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE BODY (PSU):
19463c19463
<     COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>     DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED := FALSE;
19480c19480
<   COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED := FALSE;
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE BODY (BP):
19546c19546
<     COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>     DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED    := FALSE;
19563c19563
<   COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED    := FALSE;
SYS.DBMS_XSTREAM_ADM_INTERNAL - PACKAGE BODY (BP):
96c96,101
<        WHEN OTHERS THEN RAISE;
---
>        WHEN OTHERS THEN 
>          IF SQLCODE IN ( -1952 ) THEN 
>             NULL; 
>          ELSE 
>             RAISE;
>          END IF;
SYS.DBMS_XSTREAM_ADM_INTERNAL - PACKAGE BODY (PSU):
96c96,101
<        WHEN OTHERS THEN RAISE;
---
>        WHEN OTHERS THEN 
>          IF SQLCODE IN ( -1952 ) THEN 
>             NULL; 
>          ELSE 
>             RAISE;
>          END IF;
SYS.DBMS_XSTREAM_AUTH_IVK - PACKAGE BODY (PSU):
645c645
<         TOTAL_SIZE := 21;
---
>         TOTAL_SIZE := 22;
647c647
<         TOTAL_SIZE := 23;
---
>         TOTAL_SIZE := 24;
653c653
<         TOTAL_SIZE := 19;
---
>         TOTAL_SIZE := 20;
655c655
<         TOTAL_SIZE := 21;
---
>         TOTAL_SIZE := 22;
880a881,893
> 
>     IF ((PRIVILEGE_TYPE = 'APPLY') OR (PRIVILEGE_TYPE = '*')) THEN 
>       IF IS_GRANT THEN
>         SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>           'grant execute on sys.dbms_lob to '||
>           SAFE_GRANTEE);
>       ELSE
>         SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>           'revoke execute on sys.dbms_lob from '||
>           SAFE_GRANTEE);
>       END IF;
>       INCREMENT := INCREMENT + 1;
>     END IF;
SYS.DBMS_XSTREAM_AUTH_IVK - PACKAGE BODY (BP):
645c645
<         TOTAL_SIZE := 21;
---
>         TOTAL_SIZE := 22;
647c647
<         TOTAL_SIZE := 23;
---
>         TOTAL_SIZE := 24;
653c653
<         TOTAL_SIZE := 19;
---
>         TOTAL_SIZE := 20;
655c655
<         TOTAL_SIZE := 21;
---
>         TOTAL_SIZE := 22;
880a881,893
> 
>     IF ((PRIVILEGE_TYPE = 'APPLY') OR (PRIVILEGE_TYPE = '*')) THEN 
>       IF IS_GRANT THEN
>         SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>           'grant execute on sys.dbms_lob to '||
>           SAFE_GRANTEE);
>       ELSE
>         SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>           'revoke execute on sys.dbms_lob from '||
>           SAFE_GRANTEE);
>       END IF;
>       INCREMENT := INCREMENT + 1;
>     END IF;

12.2.0.1

SYS.DBMS_AWR_PROTECTED - PACKAGE (RU):
0a1,12
> PACKAGE dbms_awr_protected
> ACCESSIBLE BY (PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT, 
>                PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL)
> AS
>   
>   
>   
> 
>   
>   COMMON_SECTIONS_INITIALIZED    BOOLEAN;
> 
> END DBMS_AWR_PROTECTED;
SYS.DBMS_MVIEW_STATS_INTERNAL - PACKAGE (JUL2019RUR):
2c2
< ACCESSIBLE BY (DBMS_MVIEW_STATS) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_MVIEW_STATS) IS
SYS.DBMS_PDB - PACKAGE (RU):
394c394,395
<                              object_subname IN varchar2 DEFAULT NULL);
---
>                              object_subname IN varchar2 DEFAULT NULL,
>                              sig_mismatch   IN boolean DEFAULT FALSE);
SYS.DBMS_RCVMAN - PACKAGE (JUL2019RUR):
1259c1259,1261
< -- by the find functions.
---
> -- by the find functions. This tag is also used by report/delete obsolete
> -- functions to restrict what backups to consider and what backups to filter
> -- for backup optimization.
1263c1265
< --     tag of the datafile copies to be translated
---
> --     tag of the datafile copies/backup sets to be translated
1264a1267,1268
> --   use_like
> --     input tag parameter to be used similar to LIKE semantics in SQL
1266c1270
< PROCEDURE setTag(tag IN varchar2 DEFAULT NULL);
---
> PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
SYS.DBMS_RCVMAN - PACKAGE (OCT2019RUR):
1259,1261c1259
< -- by the find functions. This tag is also used by report/delete obsolete
< -- functions to restrict what backups to consider and what backups to filter
< -- for backup optimization.
---
> -- by the find functions.
1265c1263
< --     tag of the datafile copies/backup sets to be translated
---
> --     tag of the datafile copies to be translated
1267,1268d1264
< --   use_like
< --     input tag parameter to be used similar to LIKE semantics in SQL
1270c1266
< PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
---
> PROCEDURE setTag(tag IN varchar2 DEFAULT NULL);
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE (JUL2019RUR):
533a534,565
>   FUNCTION IDX_LOC_INT_PART(IDXOWNER IN VARCHAR2,
>                             IDXNAME IN VARCHAR2) RETURN BOOLEAN;
>            
>   
>   
>   
>   FUNCTION IDX_INCLUDE_PARTITIONS RETURN BOOLEAN;
> 
>   
>   
>   
>   
>   FUNCTION IDX_SKIP_ATR_CHK RETURN BOOLEAN;
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION IDX_PART_ATR_CHG(I_OWNER IN VARCHAR2,
>                             I_NAME  IN VARCHAR2,  
>                             T_OWNER IN VARCHAR2,  
>                             T_NAME  IN VARCHAR2) RETURN BOOLEAN;
> 
>   
>   
>   
>   
>   
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE (OCT2019RUR):
534,565d533
<   FUNCTION IDX_LOC_INT_PART(IDXOWNER IN VARCHAR2,
<                             IDXNAME IN VARCHAR2) RETURN BOOLEAN;
<            
<   
<   
<   
<   FUNCTION IDX_INCLUDE_PARTITIONS RETURN BOOLEAN;
< 
<   
<   
<   
<   
<   FUNCTION IDX_SKIP_ATR_CHK RETURN BOOLEAN;
< 
<   
<   
<   
<   
<   
<   
<   
<   
<   FUNCTION IDX_PART_ATR_CHG(I_OWNER IN VARCHAR2,
<                             I_NAME  IN VARCHAR2,  
<                             T_OWNER IN VARCHAR2,  
<                             T_NAME  IN VARCHAR2) RETURN BOOLEAN;
< 
<   
<   
<   
<   
<   
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE (RU):
3,6d2
< 
<   
<   COMMON_SECTIONS_INITIALIZED    BOOLEAN;
< 
SYS.DBMS_SYNC_REFRESH_INTERNAL - PACKAGE (JUL2019RUR):
2c2
< ACCESSIBLE BY (DBMS_SYNC_REFRESH) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_SYNC_REFRESH) IS
SYS.DBMS_UMF_PROTECTED - PACKAGE (RU):
2,5c2,6
<   ACCESSIBLE BY (DBMS_WORKLOAD_REPOSITORY
<                 ,DBMS_SWRF_REPORT_INTERNAL
<                 ,DBMS_AWR_REPORT_LAYOUT
<                 ,DBMS_ASH_INTERNAL) AS
---
>   ACCESSIBLE BY (PACKAGE SYS.DBMS_WORKLOAD_REPOSITORY
>                 ,PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL
>                 ,PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT
>                 ,PACKAGE SYS.DBMS_ASH_INTERNAL) AS
> 
SYS.DBMS_AWR_PROTECTED - PACKAGE BODY (RU):
0a1,4
> PACKAGE BODY dbms_awr_protected AS
>   
>   COMMON_SECTIONS_INITIALIZED BOOLEAN := FALSE;
> END DBMS_AWR_PROTECTED;
SYS.DBMS_AWR_REPORT_LAYOUT - PACKAGE BODY (RU):
18788c18788
<   IF  DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED THEN
---
>   IF DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED THEN
18792c18792
<   DBMS_SWRF_REPORT_INTERNAL.COMMON_SECTIONS_INITIALIZED := TRUE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED := TRUE;
SYS.DBMS_HEAT_MAP_INTERNAL - PACKAGE BODY (JUL2019RUR):
710a711,713
>     EXCEP_DEADLOCK  EXCEPTION;
>     I               NUMBER;
>     PRAGMA EXCEPTION_INIT(EXCEP_DEADLOCK, -60);
715,716c718,734
<     TRN :='truncate table sys.wri$_heatmap_top_tablespaces';
<     EXECUTE IMMEDIATE TRN;
---
> 
>     
>     
>     FOR I IN 1..3 LOOP
>       BEGIN
>         TRN :='truncate table sys.wri$_heatmap_top_tablespaces';
>         EXECUTE IMMEDIATE TRN;
>         EXIT;  
>       EXCEPTION
>         WHEN EXCEP_DEADLOCK THEN
>           IF (I = 3) THEN
>             RAISE;
>           END IF;  
>         WHEN OTHERS THEN
>           RAISE;
>       END;
>     END LOOP;
817a836,838
>     EXCEP_DEADLOCK  EXCEPTION;
>     I               NUMBER;
>     PRAGMA EXCEPTION_INIT(EXCEP_DEADLOCK, -60);
819c840,855
<     EXECUTE IMMEDIATE TRN;
---
>     
>     
>     FOR I IN 1..3 LOOP
>       BEGIN
>         EXECUTE IMMEDIATE TRN;
>         EXIT;  
>       EXCEPTION
>         WHEN EXCEP_DEADLOCK THEN
>           IF (I = 3) THEN
>             RAISE;
>           END IF;  
>         WHEN OTHERS THEN
>           RAISE;
>       END;
>     END LOOP;
> 
840c876,890
<     EXECUTE IMMEDIATE TRN;
---
>     
>     
>     FOR I IN 1..3 LOOP
>       BEGIN
>         EXECUTE IMMEDIATE TRN;
>         EXIT;  
>       EXCEPTION
>         WHEN EXCEP_DEADLOCK THEN
>           IF (I = 3) THEN
>             RAISE;
>           END IF;  
>         WHEN OTHERS THEN
>           RAISE;
>       END;
>     END LOOP;
SYS.DBMS_HEAT_MAP_INTERNAL - PACKAGE BODY (OCT2019RUR):
711,713d710
<     EXCEP_DEADLOCK  EXCEPTION;
<     I               NUMBER;
<     PRAGMA EXCEPTION_INIT(EXCEP_DEADLOCK, -60);
718,734c715,716
< 
<     
<     
<     FOR I IN 1..3 LOOP
<       BEGIN
<         TRN :='truncate table sys.wri$_heatmap_top_tablespaces';
<         EXECUTE IMMEDIATE TRN;
<         EXIT;  
<       EXCEPTION
<         WHEN EXCEP_DEADLOCK THEN
<           IF (I = 3) THEN
<             RAISE;
<           END IF;  
<         WHEN OTHERS THEN
<           RAISE;
<       END;
<     END LOOP;
---
>     TRN :='truncate table sys.wri$_heatmap_top_tablespaces';
>     EXECUTE IMMEDIATE TRN;
836,838d817
<     EXCEP_DEADLOCK  EXCEPTION;
<     I               NUMBER;
<     PRAGMA EXCEPTION_INIT(EXCEP_DEADLOCK, -60);
840,855c819
<     
<     
<     FOR I IN 1..3 LOOP
<       BEGIN
<         EXECUTE IMMEDIATE TRN;
<         EXIT;  
<       EXCEPTION
<         WHEN EXCEP_DEADLOCK THEN
<           IF (I = 3) THEN
<             RAISE;
<           END IF;  
<         WHEN OTHERS THEN
<           RAISE;
<       END;
<     END LOOP;
< 
---
>     EXECUTE IMMEDIATE TRN;
876,890c840
<     
<     
<     FOR I IN 1..3 LOOP
<       BEGIN
<         EXECUTE IMMEDIATE TRN;
<         EXIT;  
<       EXCEPTION
<         WHEN EXCEP_DEADLOCK THEN
<           IF (I = 3) THEN
<             RAISE;
<           END IF;  
<         WHEN OTHERS THEN
<           RAISE;
<       END;
<     END LOOP;
---
>     EXECUTE IMMEDIATE TRN;
SYS.DBMS_PDB - PACKAGE BODY (RU):
391c391,392
<                                OBJECT_SUBNAME IN VARCHAR2);
---
>                                OBJECT_SUBNAME IN VARCHAR2,
>                                SIG_MISMATCH   IN BOOLEAN);
397c398,399
<                              OBJECT_SUBNAME IN VARCHAR2 DEFAULT NULL) IS
---
>                              OBJECT_SUBNAME IN VARCHAR2 DEFAULT NULL,
>                              SIG_MISMATCH   IN BOOLEAN DEFAULT FALSE) IS
399c401,402
<     KPDBCONVERTTOLOCAL(SCHEMA_NAME, OBJECT_NAME, NAMESPACE, OBJECT_SUBNAME);
---
>     KPDBCONVERTTOLOCAL(SCHEMA_NAME, OBJECT_NAME, NAMESPACE, OBJECT_SUBNAME,
>                        SIG_MISMATCH);
SYS.DBMS_QOPATCH - PACKAGE BODY (RU):
83c83
<   RETURN '$Header: rdbms/src/client/tools/qpinv/prvtqopi.sql /st_rdbms_12.2.0.1.0dbbp/6 2018/08/10 12:48:23 aime Exp $';
---
>   RETURN '$Header: rdbms/src/client/tools/qpinv/prvtqopi.sql /st_rdbms_12.2.0.1.0dbbp/7 2019/11/05 08:00:09 jdorozco Exp $';
686c686,691
<       CONFIG_OINV_JOBS();
---
> 
> 
> 
> 
> 
>     
SYS.DBMS_RCVMAN - PACKAGE BODY (JUL2019RUR):
166a167
> TAG_LIKE        NUMBER := 0;
620a622,624
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
643c647
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
902a907,909
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1011a1019
>        AND RESTORETAG IS NULL
1083a1092,1094
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1154a1166,1168
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1288a1303,1305
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1396a1414,1416
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1714a1735,1737
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1837a1861,1863
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1934a1961,1963
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2062a2092,2094
>            AND (RESTORETAG IS NULL OR
>                 ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                  (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2118a2151,2153
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2255a2291,2293
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2780a2819,2821
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2869a2911,2913
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2965a3010,3012
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3048a3096,3098
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3175a3226
>       AND RESTORETAG IS NULL
3396a3448,3450
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3614a3669,3671
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3726a3784,3786
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3773a3834,3836
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3795a3859,3861
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3821a3888,3890
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3856a3926,3928
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3916a3989,3991
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3964a4040,4042
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4014a4093,4095
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4053a4135,4137
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7182a7267,7269
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7197a7285,7287
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7331a7422,7424
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7378a7472,7474
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7418a7515,7517
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7502a7602,7604
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7582a7685,7687
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7650a7756,7758
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7725a7834,7836
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7756a7868,7870
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7827a7942,7944
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7904a8022,8024
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7964a8085,8087
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8017a8141,8143
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8103a8230,8232
>              AND (RESTORETAG IS NULL OR
>                   ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                    (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8177a8307,8309
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8239a8372,8374
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8292a8428,8430
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8384a8523,8525
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8401a8543,8545
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8424c8568,8571
<           WHERE (STATUS = 'A' OR STATUS = 'X')) DC
---
>           WHERE (STATUS = 'A' OR STATUS = 'X')
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))) DC
8454a8602,8604
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XDF.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XDF.TAG = RESTORETAG)))
8480a8631,8633
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8523a8677,8679
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
8592a8749,8751
>                  AND (RESTORETAG IS NULL OR
>                       ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                        (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8622a8782,8784
>                   AND (RESTORETAG IS NULL OR
>                        ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                         (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8691a8854,8856
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8807a8973,8975
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8850a9019,9021
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9100a9272,9274
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9344a9519,9521
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9470a9648,9650
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9693c9873,9874
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
9809a9991
> 
9907c10089,10090
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
11044c11227
<       IF (TAG IS NOT NULL AND NOT TAGMATCHREQUIRED) THEN
---
>       IF (TAG IS NOT NULL AND TAGMATCHREQUIRED) THEN
11049c11232,11233
<          IF (TAG = LOCAL.TAG) THEN
---
>          IF ((TAG_LIKE = 1 AND LOCAL.TAG LIKE TAG) OR 
>              (TAG_LIKE <> 1 AND LOCAL.TAG = TAG)) THEN
11065c11249,11250
<             DEB(DEB_IN, 'tag does not match, continuing search');
---
>             DEB(DEB_IN, 'tag does not match, continuing search:' ||
>                 LOCAL.TAG);
11769,11770c11954,11958
<           (ACTION.TAG_CON <> RESTORETAG OR ACTION.TAG_CON IS NULL)) THEN
<       DEB(DEB_PRINT, 'isValidAction: tag mismatch - skipped:');
---
>           (((TAG_LIKE = 1 AND ACTION.TAG_CON NOT LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND ACTION.TAG_CON <> RESTORETAG)) OR
>            ACTION.TAG_CON IS NULL)) THEN
>       DEB(DEB_PRINT, 'isValidAction: tag mismatch - skipped:' || 
>           NVL(ACTION.TAG_CON, '<NUL>'));
12750c12938,12941
<    IF (NVL(TAG, '  ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, '  '))) THEN
---
>    IF ((TAG_LIKE = 1 AND 
>         NVL(TAG, ' ') NOT LIKE NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' '))) OR
>        (TAG_LIKE <> 1 AND
>         NVL(TAG, ' ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' ')))) THEN
13718a13910,13913
> 
> 
> 
> 
13958c14153,14154
<       IF (RMANCMD != OBSOLETECMD_T) THEN
---
>       IF (RMANCMD != OBSOLETECMD_T OR
>           (RESTORETAG IS NOT NULL AND RMANCMD = OBSOLETECMD_T)) THEN
14106d14301
<    
14108,14109c14303
<        ACTION.TYPE_CON  = BACKUPSET_CON_T AND
<        RMANCMD         != OBSOLETECMD_T ) THEN
---
>        ACTION.TYPE_CON  = BACKUPSET_CON_T) THEN
14118c14312,14313
<       IF (VALIDATIONREC.TAG = RESTORETAG OR
---
>       IF (((TAG_LIKE = 1 AND VALIDATIONREC.TAG LIKE RESTORETAG) OR
>            (TAG_LIKE <> 1 AND VALIDATIONREC.TAG = RESTORETAG)) OR
14178,14183d14372
<    
<    IF (RMANCMD = OBSOLETECMD_T AND NOT ISVALIDACTION(ACTION)) THEN
<       DEB(DEB_EXIT, 'with action_SKIP');
<       RETURN ACTION_SKIP;
<    END IF;
< 
17580c17769,17772
<    IF (NVL(TAG, '  ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, '  '))) THEN
---
>    IF ((TAG_LIKE = 1 AND
>         NVL(TAG, ' ') NOT LIKE NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' '))) OR
>        (TAG_LIKE <> 1 AND
>         NVL(TAG, ' ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' ')))) THEN
17876a18069,18071
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18158a18354,18356
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18250a18449
>        AND RESTORETAG IS NULL
18323a18523,18525
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18394a18597,18599
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18963c19168,19169
<             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
---
>             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
>       AND RESTORETAG IS NULL;
19005c19211,19214
<             XAL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
---
>             XAL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)));
19052a19262
>                       AND RESTORETAG IS NULL
19103a19314,19316
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR
>                             (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
19169a19383
>                       AND RESTORETAG IS NULL
19204a19419,19421
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19233a19451,19453
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19291c19511
< 
---
>                     AND RESTORETAG IS NULL
19322a19543,19545
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19347a19571,19573
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19422a19649
>                       AND RESTORETAG IS NULL
19461a19689,19691
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19493a19724,19726
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19953c20186,20187
<    TAG IN VARCHAR2 DEFAULT NULL)
---
>    TAG IN VARCHAR2 DEFAULT NULL,
>    USE_LIKE IN NUMBER DEFAULT 0)
19955a20190,20195
>    
>    
>    IF (NVL(TAG, ' ') <> NVL(RESTORETAG, ' ') AND RCVRECCURSOR1_C%ISOPEN) THEN
>       DEB(DEB_PRINT, 'closing cursor rcRecCursor_c');
>       CLOSE RCVRECCURSOR1_C;
>    END IF;
19956a20197,20198
>    TAG_LIKE := USE_LIKE;
>    DEB(DEB_PRINT, 'restoreTag='|| RESTORETAG ||  ',tag_like='|| TAG_LIKE);
25558a25801,25803
> 
>   VALIDATIONREC        VALIDBACKUPSETREC_T;
>   BS_RCVREC            RCVREC_T;
26216a26462,26463
>   <<NEXTROW>>
> 
26443a26691,26726
>     END IF; 
> 
>     
>     IF (LBREC.BACKUP_TYPE = BACKUPSET_TXT AND RESTORETAG IS NOT NULL) THEN
>        BS_RCVREC.BSKEY_CON := LBREC.BS_KEY;
>        BS_RCVREC.SETCOUNT_CON := LBREC.BS_COUNT;
>        BS_RCVREC.SETSTAMP_CON := LBREC.BS_STAMP;
>        BS_RCVREC.PIECECOUNT_CON := LBREC.BS_PIECES;
>        IF (LBREC.FILE_TYPE = ARCHIVEDLOG_TXT) THEN
>           BS_RCVREC.LOGLOWSCN_OBJ := LBREC.RL_FIRST_CHANGE#;
>           BS_RCVREC.LOGTHREAD_OBJ := LBREC.RL_THREAD#;
>           BS_RCVREC.LOGSEQUENCE_OBJ := LBREC.RL_SEQUENCE#;
>        ELSIF (LBREC.FILE_TYPE IN (SPFILE_TXT, CONTROLFILE_TXT)) THEN
>           BS_RCVREC.DFNUMBER_OBJ := 0;
>           BS_RCVREC.FROMSCN_ACT := 0;
>        ELSIF (LBREC.FILE_TYPE = DATAFILE_TXT) THEN
>           BS_RCVREC.DFNUMBER_OBJ := 0;
>           BS_RCVREC.FROMSCN_ACT := LBREC.DF_CHECKPOINT_CHANGE#;
>           IF (LBREC.DF_INCREMENTAL_CHANGE# = LBREC.DF_CREATION_CHANGE# OR
>               LBREC.BS_INCR_TYPE = FULL_TXT) THEN
>              BS_RCVREC.FROMSCN_ACT := 0;
>           ELSIF (LBREC.BS_INCR_TYPE <> FULL_TXT) THEN
>              BS_RCVREC.FROMSCN_ACT := LBREC.DF_INCREMENTAL_CHANGE#;
>           END IF;
>        END IF;
> 
>        IF VALIDATEBACKUPSET(BACKUPSETREC=> BS_RCVREC,
>                  TAG                    => RESTORETAG,
>                  TAGMATCHREQUIRED       => TRUE,
>                  CHECKDEVICEISALLOCATED => TRUE,
>                  AVAILABLEMASK          => BSAVAILABLE,
>                  VALIDREC               => VALIDATIONREC) <> SUCCESS THEN
>          DEB(DEB_IN, 'tag does not match: bs_key=' || LBREC.BS_KEY);
>          GOTO NEXTROW;
>       END IF;
> 
28357c28640
<             DEB(DEB_IN, 'tag does not match');
---
>             DEB(DEB_IN, 'tag does not match for controlfile proxy copy');
28682c28965
<             DEB(DEB_EXIT, 'tag does not match');
---
>             DEB(DEB_EXIT, 'tag does not match for proxy copy:'||BRLREC.TAG_CON);
28921,28933c29204,29210
<       IF (RMANCMD = OBSOLETECMD_T) THEN
<          
<          
<          VALRC := SUCCESS;
<       ELSE
<          VALRC := VALIDATEBACKUPSET(
<                BACKUPSETREC           => BSFREC,
<                TAG                    => RESTORETAG,
<                TAGMATCHREQUIRED       => TRUE,
<                CHECKDEVICEISALLOCATED => TRUE,
<                AVAILABLEMASK          => BSAVAILABLE,
<                VALIDREC               => VALIDATEREC);
<       END IF;
---
>       VALRC := VALIDATEBACKUPSET(
>             BACKUPSETREC           => BSFREC,
>             TAG                    => RESTORETAG,
>             TAGMATCHREQUIRED       => TRUE,
>             CHECKDEVICEISALLOCATED => TRUE,
>             AVAILABLEMASK          => BSAVAILABLE,
>             VALIDREC               => VALIDATEREC);
28950,28959d29226
<          ELSIF (RMANCMD = OBSOLETECMD_T) THEN
<             DEB(DEB_IN, ' Added bsfRec:');
< 
<             RCVRECPUSH(BSFREC);     
<             GETBS_STATUS := SUCCESS;
<             IF (LCOPIES > 1) THEN
<                LCOPIES := LCOPIES - 1;
<             ELSE
<                EXIT;              
<             END IF;
29225a29493
>    DEB(DEB_PRINT, 'getRA_likePattern='|| PATTERN);
SYS.DBMS_RCVMAN - PACKAGE BODY (OCT2019RUR):
167d166
< TAG_LIKE        NUMBER := 0;
622,624d620
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
647c643
<            BDF.COMPLETION_TIME     COMPLETION_TIME,
---
>            NULL                    COMPLETION_TIME,
907,909d902
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1019d1011
<        AND RESTORETAG IS NULL
1092,1094d1083
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1166,1168d1154
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1303,1305d1288
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1414,1416d1396
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1735,1737d1714
<               AND (RESTORETAG IS NULL OR
<                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1861,1863d1837
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1961,1963d1934
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2092,2094d2062
<            AND (RESTORETAG IS NULL OR
<                 ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                  (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2151,2153d2118
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2291,2293d2255
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2819,2821d2780
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2911,2913d2869
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3010,3012d2965
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3096,3098d3048
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3226d3175
<       AND RESTORETAG IS NULL
3448,3450d3396
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3669,3671d3614
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3784,3786d3726
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3834,3836d3773
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3859,3861d3795
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3888,3890d3821
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3926,3928d3856
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3989,3991d3916
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4040,4042d3964
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4093,4095d4014
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4135,4137d4053
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7267,7269d7182
<     AND (RESTORETAG IS NULL OR
<          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7285,7287d7197
<     AND (RESTORETAG IS NULL OR
<          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7422,7424d7331
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7472,7474d7378
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7515,7517d7418
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7602,7604d7502
<               AND (RESTORETAG IS NULL OR
<                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7685,7687d7582
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7756,7758d7650
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7834,7836d7725
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7868,7870d7756
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7942,7944d7827
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8022,8024d7904
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8085,8087d7964
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8141,8143d8017
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8230,8232d8103
<              AND (RESTORETAG IS NULL OR
<                   ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                    (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8307,8309d8177
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8372,8374d8239
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8428,8430d8292
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8523,8525d8384
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8543,8545d8401
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8568,8571c8424
<           WHERE (STATUS = 'A' OR STATUS = 'X')
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))) DC
---
>           WHERE (STATUS = 'A' OR STATUS = 'X')) DC
8602,8604d8454
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND XDF.TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND XDF.TAG = RESTORETAG)))
8631,8633d8480
<             AND (RESTORETAG IS NULL OR
<                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8677,8679d8523
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
8749,8751d8592
<                  AND (RESTORETAG IS NULL OR
<                       ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
<                        (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8782,8784d8622
<                   AND (RESTORETAG IS NULL OR
<                        ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
<                         (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8854,8856d8691
<               AND (RESTORETAG IS NULL OR
<                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8973,8975d8807
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9019,9021d8850
<      AND (RESTORETAG IS NULL OR
<           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9272,9274d9100
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9519,9521d9344
<               AND (RESTORETAG IS NULL OR
<                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9648,9650d9470
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9873,9874c9693
<            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR
<             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
---
>            C1REC.TAG_CON = RESTORETAG OR
9991d9809
< 
10089,10090c9907
<            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
---
>            C1REC.TAG_CON = RESTORETAG OR
11227c11044
<       IF (TAG IS NOT NULL AND TAGMATCHREQUIRED) THEN
---
>       IF (TAG IS NOT NULL AND NOT TAGMATCHREQUIRED) THEN
11232,11233c11049
<          IF ((TAG_LIKE = 1 AND LOCAL.TAG LIKE TAG) OR 
<              (TAG_LIKE <> 1 AND LOCAL.TAG = TAG)) THEN
---
>          IF (TAG = LOCAL.TAG) THEN
11249,11250c11065
<             DEB(DEB_IN, 'tag does not match, continuing search:' ||
<                 LOCAL.TAG);
---
>             DEB(DEB_IN, 'tag does not match, continuing search');
11954,11958c11769,11770
<           (((TAG_LIKE = 1 AND ACTION.TAG_CON NOT LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND ACTION.TAG_CON <> RESTORETAG)) OR
<            ACTION.TAG_CON IS NULL)) THEN
<       DEB(DEB_PRINT, 'isValidAction: tag mismatch - skipped:' || 
<           NVL(ACTION.TAG_CON, '<NUL>'));
---
>           (ACTION.TAG_CON <> RESTORETAG OR ACTION.TAG_CON IS NULL)) THEN
>       DEB(DEB_PRINT, 'isValidAction: tag mismatch - skipped:');
12938,12941c12750
<    IF ((TAG_LIKE = 1 AND 
<         NVL(TAG, ' ') NOT LIKE NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' '))) OR
<        (TAG_LIKE <> 1 AND
<         NVL(TAG, ' ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' ')))) THEN
---
>    IF (NVL(TAG, '  ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, '  '))) THEN
13910,13913d13718
< 
< 
< 
< 
14153,14154c13958
<       IF (RMANCMD != OBSOLETECMD_T OR
<           (RESTORETAG IS NOT NULL AND RMANCMD = OBSOLETECMD_T)) THEN
---
>       IF (RMANCMD != OBSOLETECMD_T) THEN
14301a14106
>    
14303c14108,14109
<        ACTION.TYPE_CON  = BACKUPSET_CON_T) THEN
---
>        ACTION.TYPE_CON  = BACKUPSET_CON_T AND
>        RMANCMD         != OBSOLETECMD_T ) THEN
14312,14313c14118
<       IF (((TAG_LIKE = 1 AND VALIDATIONREC.TAG LIKE RESTORETAG) OR
<            (TAG_LIKE <> 1 AND VALIDATIONREC.TAG = RESTORETAG)) OR
---
>       IF (VALIDATIONREC.TAG = RESTORETAG OR
14372a14178,14183
>    
>    IF (RMANCMD = OBSOLETECMD_T AND NOT ISVALIDACTION(ACTION)) THEN
>       DEB(DEB_EXIT, 'with action_SKIP');
>       RETURN ACTION_SKIP;
>    END IF;
> 
17769,17772c17580
<    IF ((TAG_LIKE = 1 AND
<         NVL(TAG, ' ') NOT LIKE NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' '))) OR
<        (TAG_LIKE <> 1 AND
<         NVL(TAG, ' ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, ' ')))) THEN
---
>    IF (NVL(TAG, '  ') != NVL(CACHEBSRECTABLE.TAG, NVL(TAG, '  '))) THEN
18069,18071d17876
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18354,18356d18158
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18449d18250
<        AND RESTORETAG IS NULL
18523,18525d18323
<        AND (RESTORETAG IS NULL OR
<             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18597,18599d18394
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19168,19169c18963
<             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
<       AND RESTORETAG IS NULL;
---
>             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
19211,19214c19005
<             XAL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
<       AND (RESTORETAG IS NULL OR
<            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<             (TAG_LIKE <> 1 AND TAG = RESTORETAG)));
---
>             XAL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
19262d19052
<                       AND RESTORETAG IS NULL
19314,19316d19103
<                       AND (RESTORETAG IS NULL OR
<                            ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR
<                             (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
19383d19169
<                       AND RESTORETAG IS NULL
19419,19421d19204
<                        AND (RESTORETAG IS NULL OR
<                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
<                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19451,19453d19233
<                        AND (RESTORETAG IS NULL OR
<                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19511c19291
<                     AND RESTORETAG IS NULL
---
> 
19543,19545d19322
<                     AND (RESTORETAG IS NULL OR
<                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19571,19573d19347
<                     AND (RESTORETAG IS NULL OR
<                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19649d19422
<                       AND RESTORETAG IS NULL
19689,19691d19461
<                       AND (RESTORETAG IS NULL OR
<                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19724,19726d19493
<                       AND (RESTORETAG IS NULL OR
<                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
<                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
20186,20187c19953
<    TAG IN VARCHAR2 DEFAULT NULL,
<    USE_LIKE IN NUMBER DEFAULT 0)
---
>    TAG IN VARCHAR2 DEFAULT NULL)
20190,20195d19955
<    
<    
<    IF (NVL(TAG, ' ') <> NVL(RESTORETAG, ' ') AND RCVRECCURSOR1_C%ISOPEN) THEN
<       DEB(DEB_PRINT, 'closing cursor rcRecCursor_c');
<       CLOSE RCVRECCURSOR1_C;
<    END IF;
20197,20198d19956
<    TAG_LIKE := USE_LIKE;
<    DEB(DEB_PRINT, 'restoreTag='|| RESTORETAG ||  ',tag_like='|| TAG_LIKE);
25801,25803d25558
< 
<   VALIDATIONREC        VALIDBACKUPSETREC_T;
<   BS_RCVREC            RCVREC_T;
26462,26463d26216
<   <<NEXTROW>>
< 
26691,26726d26443
<     END IF; 
< 
<     
<     IF (LBREC.BACKUP_TYPE = BACKUPSET_TXT AND RESTORETAG IS NOT NULL) THEN
<        BS_RCVREC.BSKEY_CON := LBREC.BS_KEY;
<        BS_RCVREC.SETCOUNT_CON := LBREC.BS_COUNT;
<        BS_RCVREC.SETSTAMP_CON := LBREC.BS_STAMP;
<        BS_RCVREC.PIECECOUNT_CON := LBREC.BS_PIECES;
<        IF (LBREC.FILE_TYPE = ARCHIVEDLOG_TXT) THEN
<           BS_RCVREC.LOGLOWSCN_OBJ := LBREC.RL_FIRST_CHANGE#;
<           BS_RCVREC.LOGTHREAD_OBJ := LBREC.RL_THREAD#;
<           BS_RCVREC.LOGSEQUENCE_OBJ := LBREC.RL_SEQUENCE#;
<        ELSIF (LBREC.FILE_TYPE IN (SPFILE_TXT, CONTROLFILE_TXT)) THEN
<           BS_RCVREC.DFNUMBER_OBJ := 0;
<           BS_RCVREC.FROMSCN_ACT := 0;
<        ELSIF (LBREC.FILE_TYPE = DATAFILE_TXT) THEN
<           BS_RCVREC.DFNUMBER_OBJ := 0;
<           BS_RCVREC.FROMSCN_ACT := LBREC.DF_CHECKPOINT_CHANGE#;
<           IF (LBREC.DF_INCREMENTAL_CHANGE# = LBREC.DF_CREATION_CHANGE# OR
<               LBREC.BS_INCR_TYPE = FULL_TXT) THEN
<              BS_RCVREC.FROMSCN_ACT := 0;
<           ELSIF (LBREC.BS_INCR_TYPE <> FULL_TXT) THEN
<              BS_RCVREC.FROMSCN_ACT := LBREC.DF_INCREMENTAL_CHANGE#;
<           END IF;
<        END IF;
< 
<        IF VALIDATEBACKUPSET(BACKUPSETREC=> BS_RCVREC,
<                  TAG                    => RESTORETAG,
<                  TAGMATCHREQUIRED       => TRUE,
<                  CHECKDEVICEISALLOCATED => TRUE,
<                  AVAILABLEMASK          => BSAVAILABLE,
<                  VALIDREC               => VALIDATIONREC) <> SUCCESS THEN
<          DEB(DEB_IN, 'tag does not match: bs_key=' || LBREC.BS_KEY);
<          GOTO NEXTROW;
<       END IF;
< 
28640c28357
<             DEB(DEB_IN, 'tag does not match for controlfile proxy copy');
---
>             DEB(DEB_IN, 'tag does not match');
28965c28682
<             DEB(DEB_EXIT, 'tag does not match for proxy copy:'||BRLREC.TAG_CON);
---
>             DEB(DEB_EXIT, 'tag does not match');
29204,29210c28921,28933
<       VALRC := VALIDATEBACKUPSET(
<             BACKUPSETREC           => BSFREC,
<             TAG                    => RESTORETAG,
<             TAGMATCHREQUIRED       => TRUE,
<             CHECKDEVICEISALLOCATED => TRUE,
<             AVAILABLEMASK          => BSAVAILABLE,
<             VALIDREC               => VALIDATEREC);
---
>       IF (RMANCMD = OBSOLETECMD_T) THEN
>          
>          
>          VALRC := SUCCESS;
>       ELSE
>          VALRC := VALIDATEBACKUPSET(
>                BACKUPSETREC           => BSFREC,
>                TAG                    => RESTORETAG,
>                TAGMATCHREQUIRED       => TRUE,
>                CHECKDEVICEISALLOCATED => TRUE,
>                AVAILABLEMASK          => BSAVAILABLE,
>                VALIDREC               => VALIDATEREC);
>       END IF;
29226a28950,28959
>          ELSIF (RMANCMD = OBSOLETECMD_T) THEN
>             DEB(DEB_IN, ' Added bsfRec:');
> 
>             RCVRECPUSH(BSFREC);     
>             GETBS_STATUS := SUCCESS;
>             IF (LCOPIES > 1) THEN
>                LCOPIES := LCOPIES - 1;
>             ELSE
>                EXIT;              
>             END IF;
29493d29225
<    DEB(DEB_PRINT, 'getRA_likePattern='|| PATTERN);
SYS.DBMS_REDEFINITION - PACKAGE BODY (JUL2019RUR):
84a85,86
>   
>   CONS_TS_CHANGED     CONSTANT PLS_INTEGER := 32;
1167,1168c1169,1172
<   USING_INDEX         BOOLEAN :=FALSE;
< 
---
>   USING_INDEX         BOOLEAN := FALSE;
>   IDX_ATT_LOCAL       BOOLEAN := FALSE;     
>   IDX_TMP_CNT         PLS_INTEGER;
>   IDX_INT_PARTITION   BOOLEAN := FALSE;     
1364,1366c1368,1400
<       IF (FOUND_INTERVAL OR DBMS_REDEFINITION_INTERNAL.IS_PARTITIONED_IDX(
<                                                 O_OBJ_OWNER, O_OBJ_NAME)) THEN
<         DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'INCLUDE_PARTITIONS','ALL');
---
>       IF (FOUND_INTERVAL 
>           OR DBMS_REDEFINITION_INTERNAL.IS_PARTITIONED_IDX(O_OBJ_OWNER, 
>                                                            O_OBJ_NAME)) 
>       THEN
>         IDX_INT_PARTITION := DBMS_REDEFINITION_INTERNAL.IDX_LOC_INT_PART(
>                              O_OBJ_OWNER,O_OBJ_NAME);
>         IF (NOT IDX_INT_PARTITION)
>             OR DBMS_REDEFINITION_INTERNAL.IDX_INCLUDE_PARTITIONS 
>             OR DBMS_REDEFINITION_INTERNAL.IDX_PART_ATR_CHG(O_OBJ_OWNER,
>                                                            O_OBJ_NAME,
>                                                            O_BT_OWNER,
>                                                            O_BT_NAME) 
>             OR (BITAND(CTX_FLAG, DBMS_REDEFINITION.CONS_REDEF_TABLE)
>                  <> DBMS_REDEFINITION.CONS_REDEF_TABLE)
>         THEN
>           
>           
>           
>           
>           
>           
>           
>           DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'INCLUDE_PARTITIONS',
>                                             'ALL');
>         ELSE
>           
>           
>           
>           DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'PARTITIONING',FALSE);
>           IDX_ATT_LOCAL := TRUE;
>           
>           IDX_INT_PARTITION := FALSE;    
>         END IF;
1423c1457,1482
< 
---
>         IF IDX_ATT_LOCAL THEN
>           
>           
>           
>           
>           
>           
>           
>           
>           SELECT COUNT(REGEXP_SUBSTR(
>                        DBMS_LOB.SUBSTR(MD_DDL_INFO.DDLTEXT,1000), 
>                        '(^|\s)TABLESPACE($|\s)'))
>           INTO IDX_TMP_CNT FROM SYS.DUAL;
>           IF IDX_TMP_CNT > 0 OR NEW_TABLESPACE IS NULL THEN
>             
>             
>             DBMS_LOB.APPEND(MD_DDL_INFO.DDLTEXT, TO_CLOB(' LOCAL'));
>           ELSE
>             IF NEW_TABLESPACE IS NOT NULL THEN
>               
>               DBMS_LOB.APPEND(MD_DDL_INFO.DDLTEXT, TO_CLOB(' TABLESPACE '||
>                               DBMS_ASSERT.ENQUOTE_NAME(NEW_TABLESPACE,FALSE) ||
>                               ' LOCAL'));
>             END IF;
>           END IF;
>         END IF;
1646a1706,1722
>     
>     
>     
>     
>     IF IDX_INT_PARTITION AND NEW_TABLESPACE IS NOT NULL 
>     THEN
>       ALTER_IDX_DDL := 'ALTER INDEX ' || 
>         DBMS_ASSERT.ENQUOTE_NAME(I_OBJ_OWNER, FALSE) || '.' ||
>         DBMS_ASSERT.ENQUOTE_NAME(I_OBJ_NAME, FALSE) || 
>         ' MODIFY DEFAULT ATTRIBUTES TABLESPACE ' || 
>         DBMS_ASSERT.ENQUOTE_NAME(NEW_TABLESPACE, FALSE);
>       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>         DBMS_SYSTEM.KSDWRT(1, 'transform_ddl: alter index ddl= ' || 
>                                  ALTER_IDX_DDL);
>       END IF;
>       EXECUTE IMMEDIATE ALTER_IDX_DDL;
>     END IF;
4346a4423
>       CTX_FLAG := CTX_FLAG + DBMS_REDEFINITION.CONS_TS_CHANGED;
SYS.DBMS_REDEFINITION - PACKAGE BODY (OCT2019RUR):
85,86d84
<   
<   CONS_TS_CHANGED     CONSTANT PLS_INTEGER := 32;
1169,1172c1167,1168
<   USING_INDEX         BOOLEAN := FALSE;
<   IDX_ATT_LOCAL       BOOLEAN := FALSE;     
<   IDX_TMP_CNT         PLS_INTEGER;
<   IDX_INT_PARTITION   BOOLEAN := FALSE;     
---
>   USING_INDEX         BOOLEAN :=FALSE;
> 
1368,1400c1364,1366
<       IF (FOUND_INTERVAL 
<           OR DBMS_REDEFINITION_INTERNAL.IS_PARTITIONED_IDX(O_OBJ_OWNER, 
<                                                            O_OBJ_NAME)) 
<       THEN
<         IDX_INT_PARTITION := DBMS_REDEFINITION_INTERNAL.IDX_LOC_INT_PART(
<                              O_OBJ_OWNER,O_OBJ_NAME);
<         IF (NOT IDX_INT_PARTITION)
<             OR DBMS_REDEFINITION_INTERNAL.IDX_INCLUDE_PARTITIONS 
<             OR DBMS_REDEFINITION_INTERNAL.IDX_PART_ATR_CHG(O_OBJ_OWNER,
<                                                            O_OBJ_NAME,
<                                                            O_BT_OWNER,
<                                                            O_BT_NAME) 
<             OR (BITAND(CTX_FLAG, DBMS_REDEFINITION.CONS_REDEF_TABLE)
<                  <> DBMS_REDEFINITION.CONS_REDEF_TABLE)
<         THEN
<           
<           
<           
<           
<           
<           
<           
<           DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'INCLUDE_PARTITIONS',
<                                             'ALL');
<         ELSE
<           
<           
<           
<           DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'PARTITIONING',FALSE);
<           IDX_ATT_LOCAL := TRUE;
<           
<           IDX_INT_PARTITION := FALSE;    
<         END IF;
---
>       IF (FOUND_INTERVAL OR DBMS_REDEFINITION_INTERNAL.IS_PARTITIONED_IDX(
>                                                 O_OBJ_OWNER, O_OBJ_NAME)) THEN
>         DBMS_METADATA.SET_TRANSFORM_PARAM(DHANDLE,'INCLUDE_PARTITIONS','ALL');
1457,1482c1423
<         IF IDX_ATT_LOCAL THEN
<           
<           
<           
<           
<           
<           
<           
<           
<           SELECT COUNT(REGEXP_SUBSTR(
<                        DBMS_LOB.SUBSTR(MD_DDL_INFO.DDLTEXT,1000), 
<                        '(^|\s)TABLESPACE($|\s)'))
<           INTO IDX_TMP_CNT FROM SYS.DUAL;
<           IF IDX_TMP_CNT > 0 OR NEW_TABLESPACE IS NULL THEN
<             
<             
<             DBMS_LOB.APPEND(MD_DDL_INFO.DDLTEXT, TO_CLOB(' LOCAL'));
<           ELSE
<             IF NEW_TABLESPACE IS NOT NULL THEN
<               
<               DBMS_LOB.APPEND(MD_DDL_INFO.DDLTEXT, TO_CLOB(' TABLESPACE '||
<                               DBMS_ASSERT.ENQUOTE_NAME(NEW_TABLESPACE,FALSE) ||
<                               ' LOCAL'));
<             END IF;
<           END IF;
<         END IF;
---
> 
1706,1722d1646
<     
<     
<     
<     
<     IF IDX_INT_PARTITION AND NEW_TABLESPACE IS NOT NULL 
<     THEN
<       ALTER_IDX_DDL := 'ALTER INDEX ' || 
<         DBMS_ASSERT.ENQUOTE_NAME(I_OBJ_OWNER, FALSE) || '.' ||
<         DBMS_ASSERT.ENQUOTE_NAME(I_OBJ_NAME, FALSE) || 
<         ' MODIFY DEFAULT ATTRIBUTES TABLESPACE ' || 
<         DBMS_ASSERT.ENQUOTE_NAME(NEW_TABLESPACE, FALSE);
<       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<         DBMS_SYSTEM.KSDWRT(1, 'transform_ddl: alter index ddl= ' || 
<                                  ALTER_IDX_DDL);
<       END IF;
<       EXECUTE IMMEDIATE ALTER_IDX_DDL;
<     END IF;
4423d4346
<       CTX_FLAG := CTX_FLAG + DBMS_REDEFINITION.CONS_TS_CHANGED;
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE BODY (OCT2019RUR):
1003,1338d1002
<   
<   
<   
<   
<   
<   FUNCTION IDX_LOC_INT_PART(IDXOWNER IN VARCHAR2,
<                             IDXNAME IN VARCHAR2) RETURN BOOLEAN 
<   IS
<     IND_CONS NUMBER;
<   BEGIN
<     SELECT COUNT(1) INTO IND_CONS
<     FROM  DBA_PART_INDEXES IND
<     WHERE  IND.INDEX_NAME = IDXNAME
<            AND IND.OWNER = IDXOWNER
<            AND IND.LOCALITY = 'LOCAL'
<            AND IND.INTERVAL IS NOT NULL;
<     IF IND_CONS > 0 THEN
<       RETURN TRUE;
<     END IF;
<     RETURN FALSE;
<   EXCEPTION WHEN OTHERS THEN
<     RETURN FALSE;
<   END IDX_LOC_INT_PART;
< 
<   
<   
<   
<   FUNCTION IDX_INCLUDE_PARTITIONS RETURN BOOLEAN IS
<     EVENT_VALUE  BINARY_INTEGER := 0;
<   BEGIN
<     DBMS_SYSTEM.READ_EV(42055, EVENT_VALUE);
<     IF BITAND(EVENT_VALUE, 32) = 32 THEN
<       RETURN TRUE;
<     ELSE
<       RETURN FALSE;
<     END IF;
<   END IDX_INCLUDE_PARTITIONS;
< 
<   
<   
<   
<   
<   FUNCTION IDX_SKIP_ATR_CHK RETURN BOOLEAN IS
<     EVENT_VALUE  BINARY_INTEGER := 0;
<   BEGIN
<     DBMS_SYSTEM.READ_EV(42055, EVENT_VALUE);
<     IF BITAND(EVENT_VALUE, 64) = 64 THEN
<       RETURN TRUE;
<     ELSE
<       RETURN FALSE;
<     END IF;
<   END IDX_SKIP_ATR_CHK;
< 
< 
<   
<   
<   
<   
<   
<   
<   
<   
<   FUNCTION IDX_PART_ATR_CHG(I_OWNER IN VARCHAR2,
<                             I_NAME  IN VARCHAR2,  
<                             T_OWNER IN VARCHAR2,  
<                             T_NAME  IN VARCHAR2) RETURN BOOLEAN
<   IS
<     P_NAME_INT VARCHAR2(128) := NULL;
<     P_NAME_DEF VARCHAR2(128) := NULL;
<     CHANGED    BOOLEAN := FALSE;
<     ITEM       NUMBER;
<     CURSOR PATS IS 
<      SELECT MIN(PARTITION_NAME) NAME ,MIN(INTERVAL) INTERVAL
<      FROM   DBA_IND_PARTITIONS 
<      WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME
<      GROUP BY INTERVAL,COMPOSITE,SUBPARTITION_COUNT,STATUS,TABLESPACE_NAME,
<               PCT_FREE,INI_TRANS,MAX_TRANS,INITIAL_EXTENT, NEXT_EXTENT,
<               MIN_EXTENT,MAX_EXTENT,MAX_SIZE,PCT_INCREASE,FREELISTS,
<               FREELIST_GROUPS,LOGGING,COMPRESSION,BUFFER_POOL,FLASH_CACHE,
<               CELL_FLASH_CACHE,PARAMETERS,DOMIDX_OPSTATUS;
<   BEGIN
<     IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<       DBMS_SYSTEM.KSDWRT(1, 'idxpart : index ' || I_OWNER || '.' || I_NAME ||
<                             ' on ' || T_OWNER || '.' || T_NAME);
<     END IF;
<     
<     
<     
<     IF (IDX_SKIP_ATR_CHK) THEN
<       RETURN FALSE;
<     END IF;
<     
<     
<     
<     
<     SELECT COUNT(*) INTO ITEM
<     FROM DBA_TAB_PARTITIONS U, DBA_IND_PARTITIONS I 
<     WHERE U.TABLE_OWNER=T_OWNER AND U.TABLE_NAME = T_NAME
<          AND I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME = I_NAME
<          AND U.PARTITION_POSITION=I.PARTITION_POSITION
<          AND U.PARTITION_NAME != I.PARTITION_NAME;
<     IF ITEM >0 THEN
<       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<         DBMS_SYSTEM.KSDWRT(1, 'idxpart 1: partition names are changed');
<       END IF;
<       CHANGED := TRUE;
<       RETURN CHANGED;
<     END IF;
<     
<     
<     
<     
<     
<     
<     
<     FOR PAT IN PATS LOOP
<      IF (PATS%ROWCOUNT > 2 ) THEN
<        
<        CHANGED := TRUE;
<        EXIT;
<      END IF;
<      IF PAT.INTERVAL = 'NO' THEN
<        IF P_NAME_DEF IS NULL THEN
<          P_NAME_DEF := PAT.NAME;
<        ELSE
<          
<          CHANGED := TRUE;
<          EXIT;
<        END IF; 
<      ELSE
<        IF P_NAME_INT IS NULL THEN
<          P_NAME_INT := PAT.NAME;
<        ELSE
<          
<          CHANGED := TRUE;
<          EXIT;
<        END IF;
<      END IF;
<     END LOOP;
<     IF P_NAME_INT IS NULL AND 
<        P_NAME_DEF IS NULL THEN
<        
<        CHANGED := TRUE;
<     END IF;
<     IF CHANGED THEN
<       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<         DBMS_SYSTEM.KSDWRT(1, 'idxpart 2: ' ||
<                            'one or more partition attributes are changed');
<       END IF;
<       RETURN CHANGED;
<     END IF; 
<     
<     
<     
<     IF (P_NAME_INT IS NOT NULL) AND (P_NAME_DEF IS NOT NULL)
<     THEN
<       BEGIN
<         SELECT COUNT(1) INTO ITEM
<         FROM   DBA_IND_PARTITIONS 
<         WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME AND 
<                PARTITION_NAME IN (P_NAME_INT, P_NAME_DEF)
<         GROUP BY COMPOSITE,SUBPARTITION_COUNT,STATUS,TABLESPACE_NAME,
<                  PCT_FREE,INI_TRANS,MAX_TRANS, LOGGING,COMPRESSION,
<                  BUFFER_POOL,FLASH_CACHE,CELL_FLASH_CACHE;
<         
<         
<       EXCEPTION WHEN OTHERS THEN
<         
<         
<         CHANGED := TRUE;
<       END;
<       IF CHANGED THEN
<         IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<           DBMS_SYSTEM.KSDWRT(1, 'idxpart 3: common attributes are changed');
<         END IF;
<         RETURN CHANGED;
<       END IF; 
<     END IF;
<     BEGIN
<       IF P_NAME_INT IS NOT NULL THEN
<         
<         
<         SELECT COUNT(*) INTO ITEM
<         FROM  DBA_IND_PARTITIONS 
<         WHERE INDEX_OWNER=I_OWNER AND 
<               INDEX_NAME=I_NAME AND
<               PARTITION_NAME = P_NAME_INT AND
<               SUBPARTITION_COUNT = 0 AND
<               STATUS = 'USABLE' AND 
<               COMPOSITE = 'NO'; 
<         IF ITEM = 0 THEN
<           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<             DBMS_SYSTEM.KSDWRT(1, 'idxpart 4: attributes of partition ' ||
<                                    P_NAME_INT || ' are changed');
<           END IF;
<           CHANGED := TRUE;
<           RETURN CHANGED;
<         END IF;
<         
<         
<         
<         
<         
<         
<         SELECT COUNT(*) INTO ITEM
<         FROM  DBA_IND_PARTITIONS I, DBA_PART_INDEXES P, DBA_INDEXES D
<         WHERE I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME=I_NAME AND
<               I.PARTITION_NAME = P_NAME_INT AND
<               I.INDEX_NAME = P.INDEX_NAME AND
<               I.INDEX_OWNER = D.OWNER AND I.INDEX_NAME= D.INDEX_NAME AND
<               (P.DEF_TABLESPACE_NAME = I.TABLESPACE_NAME OR
<                P.DEF_TABLESPACE_NAME IS NULL) 
<                AND
<               P.DEF_PCT_FREE        = I.PCT_FREE  AND
<               P.DEF_INI_TRANS       = I.INI_TRANS AND
<               P.DEF_MAX_TRANS       = I.MAX_TRANS AND
<               (P.DEF_LOGGING = I.LOGGING OR
<                ((P.DEF_LOGGING = 'NONE' OR P.DEF_LOGGING = 'UNKNOWN')
<                  AND I.LOGGING = 'YES'))
<               AND
<               P.DEF_BUFFER_POOL     = I.BUFFER_POOL AND 
<               P.DEF_FLASH_CACHE     = I.FLASH_CACHE AND
<               P.DEF_CELL_FLASH_CACHE= I.CELL_FLASH_CACHE AND
<               P.DEF_INITIAL_EXTENT  = 'DEFAULT' AND
<               P.DEF_NEXT_EXTENT     = 'DEFAULT' AND
<               P.DEF_MIN_EXTENTS     = 'DEFAULT' AND
<               P.DEF_MAX_EXTENTS     = 'DEFAULT' AND
<               P.DEF_MAX_SIZE        = 'DEFAULT' AND
<               P.DEF_PCT_INCREASE    = 'DEFAULT' AND
<               ((P.DEF_FREELISTS = 0 AND 
<                 (I.FREELISTS = 1 OR I.FREELISTS IS NULL )) OR
<                (P.DEF_FREELISTS > 0 AND 
<                 P.DEF_FREELISTS = I.FREELISTS))
<               AND
<               ((P.DEF_FREELIST_GROUPS = 0 AND 
<                 (I.FREELIST_GROUPS = 1 OR I.FREELIST_GROUPS IS NULL )) OR
<                (P.DEF_FREELIST_GROUPS > 0 AND 
<                 P.DEF_FREELIST_GROUPS = I.FREELIST_GROUPS)) AND 
<               D.COMPRESSION = I.COMPRESSION;
<         IF ITEM = 0 THEN
<           CHANGED := TRUE;
<           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<             DBMS_SYSTEM.KSDWRT(1, 'idxpart 5: attributes of partition ' ||
<                                    P_NAME_INT || ' are changed from default');
<           END IF;
<           RETURN CHANGED;
<         END IF;
<         
<         
<         
<         
<         
<         
<         SELECT COUNT(*) INTO ITEM
<         FROM  DBA_IND_PARTITIONS I, DBA_TABLESPACES TS
<         WHERE I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME=I_NAME AND
<               I.PARTITION_NAME = P_NAME_INT AND
<               I.TABLESPACE_NAME = TS.TABLESPACE_NAME AND
<               (TS.NEXT_EXTENT IS NULL OR 
<                I.NEXT_EXTENT = TS.NEXT_EXTENT) AND
<               (TS.MIN_EXTENTS IS NULL OR 
<                I.MIN_EXTENT = TS.MIN_EXTENTS) AND
<               (TS.MAX_EXTENTS IS NULL OR 
<                I.MAX_EXTENT = TS.MAX_EXTENTS) AND
<               (TS.MAX_SIZE IS NULL OR 
<                I.MAX_SIZE = TS.MAX_SIZE) AND
<               (TS.PCT_INCREASE IS NULL OR 
<                I.PCT_INCREASE = TS.PCT_INCREASE);
<         IF ITEM = 0 THEN
<           CHANGED := TRUE;
<           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<             DBMS_SYSTEM.KSDWRT(1, 'idxpart 6: storage attributes of partition '
<                                || P_NAME_INT || ' are changed');
<           END IF;
<           RETURN CHANGED;
<         END IF;
<       END IF;
<       IF P_NAME_DEF IS NOT NULL THEN
<         
<         
<         
<         
<         SELECT COUNT(*) INTO ITEM
<         FROM  DBA_IND_PARTITIONS
<         WHERE INDEX_OWNER=I_OWNER AND 
<               INDEX_NAME=I_NAME AND
<               PARTITION_NAME = P_NAME_DEF AND 
<               INITIAL_EXTENT IS NULL AND
<               NEXT_EXTENT IS NULL AND 
<               MIN_EXTENT IS NULL AND 
<               MAX_EXTENT IS NULL AND 
<               MAX_SIZE IS NULL AND 
<               PCT_INCREASE IS NULL AND 
<               FREELISTS IS NULL AND 
<               FREELIST_GROUPS IS NULL; 
<         IF ITEM = 0 THEN
<           
<           
<           
<           
<           IF P_NAME_INT IS NOT NULL THEN
<             BEGIN
<               SELECT COUNT(1) INTO ITEM
<               FROM   DBA_IND_PARTITIONS 
<               WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME AND 
<                      PARTITION_NAME IN (P_NAME_INT, P_NAME_DEF)
<               GROUP BY INITIAL_EXTENT, MIN_EXTENT, NEXT_EXTENT,
<                        MIN_EXTENT, MAX_EXTENT, MAX_SIZE, PCT_INCREASE,
<                        FREELISTS, FREELIST_GROUPS;
<             
<             
<             EXCEPTION WHEN OTHERS THEN
<               
<               CHANGED := TRUE;
<             END;
<           ELSE
<             
<             CHANGED := TRUE;
<           END IF;
<           IF (CHANGED) THEN
<             IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<             DBMS_SYSTEM.KSDWRT(1, 'idxpart 7: partition attributes of ' ||
<                                    P_NAME_DEF || ' are changed');
<             END IF;
<             RETURN CHANGED;
<           END IF;
<         END IF;
<       END IF;
<     EXCEPTION WHEN OTHERS THEN
<       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
<         DBMS_SYSTEM.KSDWRT(1, 'idxpart 8: exception mark as changed');
<       END IF;
<       CHANGED := TRUE;
<     END;
<     RETURN CHANGED;
<   END IDX_PART_ATR_CHG;
1349c1013
<   PROCEDURE ADD_DEP_ERRMSG(RID          IN     PLS_INTEGER,
---
>   PROCEDURE ADD_DEP_ERRMSG(RID           IN     PLS_INTEGER,
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE BODY (JUL2019RUR):
1002a1003,1338
>   
>   
>   
>   
>   
>   FUNCTION IDX_LOC_INT_PART(IDXOWNER IN VARCHAR2,
>                             IDXNAME IN VARCHAR2) RETURN BOOLEAN 
>   IS
>     IND_CONS NUMBER;
>   BEGIN
>     SELECT COUNT(1) INTO IND_CONS
>     FROM  DBA_PART_INDEXES IND
>     WHERE  IND.INDEX_NAME = IDXNAME
>            AND IND.OWNER = IDXOWNER
>            AND IND.LOCALITY = 'LOCAL'
>            AND IND.INTERVAL IS NOT NULL;
>     IF IND_CONS > 0 THEN
>       RETURN TRUE;
>     END IF;
>     RETURN FALSE;
>   EXCEPTION WHEN OTHERS THEN
>     RETURN FALSE;
>   END IDX_LOC_INT_PART;
> 
>   
>   
>   
>   FUNCTION IDX_INCLUDE_PARTITIONS RETURN BOOLEAN IS
>     EVENT_VALUE  BINARY_INTEGER := 0;
>   BEGIN
>     DBMS_SYSTEM.READ_EV(42055, EVENT_VALUE);
>     IF BITAND(EVENT_VALUE, 32) = 32 THEN
>       RETURN TRUE;
>     ELSE
>       RETURN FALSE;
>     END IF;
>   END IDX_INCLUDE_PARTITIONS;
> 
>   
>   
>   
>   
>   FUNCTION IDX_SKIP_ATR_CHK RETURN BOOLEAN IS
>     EVENT_VALUE  BINARY_INTEGER := 0;
>   BEGIN
>     DBMS_SYSTEM.READ_EV(42055, EVENT_VALUE);
>     IF BITAND(EVENT_VALUE, 64) = 64 THEN
>       RETURN TRUE;
>     ELSE
>       RETURN FALSE;
>     END IF;
>   END IDX_SKIP_ATR_CHK;
> 
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   FUNCTION IDX_PART_ATR_CHG(I_OWNER IN VARCHAR2,
>                             I_NAME  IN VARCHAR2,  
>                             T_OWNER IN VARCHAR2,  
>                             T_NAME  IN VARCHAR2) RETURN BOOLEAN
>   IS
>     P_NAME_INT VARCHAR2(128) := NULL;
>     P_NAME_DEF VARCHAR2(128) := NULL;
>     CHANGED    BOOLEAN := FALSE;
>     ITEM       NUMBER;
>     CURSOR PATS IS 
>      SELECT MIN(PARTITION_NAME) NAME ,MIN(INTERVAL) INTERVAL
>      FROM   DBA_IND_PARTITIONS 
>      WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME
>      GROUP BY INTERVAL,COMPOSITE,SUBPARTITION_COUNT,STATUS,TABLESPACE_NAME,
>               PCT_FREE,INI_TRANS,MAX_TRANS,INITIAL_EXTENT, NEXT_EXTENT,
>               MIN_EXTENT,MAX_EXTENT,MAX_SIZE,PCT_INCREASE,FREELISTS,
>               FREELIST_GROUPS,LOGGING,COMPRESSION,BUFFER_POOL,FLASH_CACHE,
>               CELL_FLASH_CACHE,PARAMETERS,DOMIDX_OPSTATUS;
>   BEGIN
>     IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>       DBMS_SYSTEM.KSDWRT(1, 'idxpart : index ' || I_OWNER || '.' || I_NAME ||
>                             ' on ' || T_OWNER || '.' || T_NAME);
>     END IF;
>     
>     
>     
>     IF (IDX_SKIP_ATR_CHK) THEN
>       RETURN FALSE;
>     END IF;
>     
>     
>     
>     
>     SELECT COUNT(*) INTO ITEM
>     FROM DBA_TAB_PARTITIONS U, DBA_IND_PARTITIONS I 
>     WHERE U.TABLE_OWNER=T_OWNER AND U.TABLE_NAME = T_NAME
>          AND I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME = I_NAME
>          AND U.PARTITION_POSITION=I.PARTITION_POSITION
>          AND U.PARTITION_NAME != I.PARTITION_NAME;
>     IF ITEM >0 THEN
>       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>         DBMS_SYSTEM.KSDWRT(1, 'idxpart 1: partition names are changed');
>       END IF;
>       CHANGED := TRUE;
>       RETURN CHANGED;
>     END IF;
>     
>     
>     
>     
>     
>     
>     
>     FOR PAT IN PATS LOOP
>      IF (PATS%ROWCOUNT > 2 ) THEN
>        
>        CHANGED := TRUE;
>        EXIT;
>      END IF;
>      IF PAT.INTERVAL = 'NO' THEN
>        IF P_NAME_DEF IS NULL THEN
>          P_NAME_DEF := PAT.NAME;
>        ELSE
>          
>          CHANGED := TRUE;
>          EXIT;
>        END IF; 
>      ELSE
>        IF P_NAME_INT IS NULL THEN
>          P_NAME_INT := PAT.NAME;
>        ELSE
>          
>          CHANGED := TRUE;
>          EXIT;
>        END IF;
>      END IF;
>     END LOOP;
>     IF P_NAME_INT IS NULL AND 
>        P_NAME_DEF IS NULL THEN
>        
>        CHANGED := TRUE;
>     END IF;
>     IF CHANGED THEN
>       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>         DBMS_SYSTEM.KSDWRT(1, 'idxpart 2: ' ||
>                            'one or more partition attributes are changed');
>       END IF;
>       RETURN CHANGED;
>     END IF; 
>     
>     
>     
>     IF (P_NAME_INT IS NOT NULL) AND (P_NAME_DEF IS NOT NULL)
>     THEN
>       BEGIN
>         SELECT COUNT(1) INTO ITEM
>         FROM   DBA_IND_PARTITIONS 
>         WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME AND 
>                PARTITION_NAME IN (P_NAME_INT, P_NAME_DEF)
>         GROUP BY COMPOSITE,SUBPARTITION_COUNT,STATUS,TABLESPACE_NAME,
>                  PCT_FREE,INI_TRANS,MAX_TRANS, LOGGING,COMPRESSION,
>                  BUFFER_POOL,FLASH_CACHE,CELL_FLASH_CACHE;
>         
>         
>       EXCEPTION WHEN OTHERS THEN
>         
>         
>         CHANGED := TRUE;
>       END;
>       IF CHANGED THEN
>         IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>           DBMS_SYSTEM.KSDWRT(1, 'idxpart 3: common attributes are changed');
>         END IF;
>         RETURN CHANGED;
>       END IF; 
>     END IF;
>     BEGIN
>       IF P_NAME_INT IS NOT NULL THEN
>         
>         
>         SELECT COUNT(*) INTO ITEM
>         FROM  DBA_IND_PARTITIONS 
>         WHERE INDEX_OWNER=I_OWNER AND 
>               INDEX_NAME=I_NAME AND
>               PARTITION_NAME = P_NAME_INT AND
>               SUBPARTITION_COUNT = 0 AND
>               STATUS = 'USABLE' AND 
>               COMPOSITE = 'NO'; 
>         IF ITEM = 0 THEN
>           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>             DBMS_SYSTEM.KSDWRT(1, 'idxpart 4: attributes of partition ' ||
>                                    P_NAME_INT || ' are changed');
>           END IF;
>           CHANGED := TRUE;
>           RETURN CHANGED;
>         END IF;
>         
>         
>         
>         
>         
>         
>         SELECT COUNT(*) INTO ITEM
>         FROM  DBA_IND_PARTITIONS I, DBA_PART_INDEXES P, DBA_INDEXES D
>         WHERE I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME=I_NAME AND
>               I.PARTITION_NAME = P_NAME_INT AND
>               I.INDEX_NAME = P.INDEX_NAME AND
>               I.INDEX_OWNER = D.OWNER AND I.INDEX_NAME= D.INDEX_NAME AND
>               (P.DEF_TABLESPACE_NAME = I.TABLESPACE_NAME OR
>                P.DEF_TABLESPACE_NAME IS NULL) 
>                AND
>               P.DEF_PCT_FREE        = I.PCT_FREE  AND
>               P.DEF_INI_TRANS       = I.INI_TRANS AND
>               P.DEF_MAX_TRANS       = I.MAX_TRANS AND
>               (P.DEF_LOGGING = I.LOGGING OR
>                ((P.DEF_LOGGING = 'NONE' OR P.DEF_LOGGING = 'UNKNOWN')
>                  AND I.LOGGING = 'YES'))
>               AND
>               P.DEF_BUFFER_POOL     = I.BUFFER_POOL AND 
>               P.DEF_FLASH_CACHE     = I.FLASH_CACHE AND
>               P.DEF_CELL_FLASH_CACHE= I.CELL_FLASH_CACHE AND
>               P.DEF_INITIAL_EXTENT  = 'DEFAULT' AND
>               P.DEF_NEXT_EXTENT     = 'DEFAULT' AND
>               P.DEF_MIN_EXTENTS     = 'DEFAULT' AND
>               P.DEF_MAX_EXTENTS     = 'DEFAULT' AND
>               P.DEF_MAX_SIZE        = 'DEFAULT' AND
>               P.DEF_PCT_INCREASE    = 'DEFAULT' AND
>               ((P.DEF_FREELISTS = 0 AND 
>                 (I.FREELISTS = 1 OR I.FREELISTS IS NULL )) OR
>                (P.DEF_FREELISTS > 0 AND 
>                 P.DEF_FREELISTS = I.FREELISTS))
>               AND
>               ((P.DEF_FREELIST_GROUPS = 0 AND 
>                 (I.FREELIST_GROUPS = 1 OR I.FREELIST_GROUPS IS NULL )) OR
>                (P.DEF_FREELIST_GROUPS > 0 AND 
>                 P.DEF_FREELIST_GROUPS = I.FREELIST_GROUPS)) AND 
>               D.COMPRESSION = I.COMPRESSION;
>         IF ITEM = 0 THEN
>           CHANGED := TRUE;
>           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>             DBMS_SYSTEM.KSDWRT(1, 'idxpart 5: attributes of partition ' ||
>                                    P_NAME_INT || ' are changed from default');
>           END IF;
>           RETURN CHANGED;
>         END IF;
>         
>         
>         
>         
>         
>         
>         SELECT COUNT(*) INTO ITEM
>         FROM  DBA_IND_PARTITIONS I, DBA_TABLESPACES TS
>         WHERE I.INDEX_OWNER=I_OWNER AND I.INDEX_NAME=I_NAME AND
>               I.PARTITION_NAME = P_NAME_INT AND
>               I.TABLESPACE_NAME = TS.TABLESPACE_NAME AND
>               (TS.NEXT_EXTENT IS NULL OR 
>                I.NEXT_EXTENT = TS.NEXT_EXTENT) AND
>               (TS.MIN_EXTENTS IS NULL OR 
>                I.MIN_EXTENT = TS.MIN_EXTENTS) AND
>               (TS.MAX_EXTENTS IS NULL OR 
>                I.MAX_EXTENT = TS.MAX_EXTENTS) AND
>               (TS.MAX_SIZE IS NULL OR 
>                I.MAX_SIZE = TS.MAX_SIZE) AND
>               (TS.PCT_INCREASE IS NULL OR 
>                I.PCT_INCREASE = TS.PCT_INCREASE);
>         IF ITEM = 0 THEN
>           CHANGED := TRUE;
>           IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>             DBMS_SYSTEM.KSDWRT(1, 'idxpart 6: storage attributes of partition '
>                                || P_NAME_INT || ' are changed');
>           END IF;
>           RETURN CHANGED;
>         END IF;
>       END IF;
>       IF P_NAME_DEF IS NOT NULL THEN
>         
>         
>         
>         
>         SELECT COUNT(*) INTO ITEM
>         FROM  DBA_IND_PARTITIONS
>         WHERE INDEX_OWNER=I_OWNER AND 
>               INDEX_NAME=I_NAME AND
>               PARTITION_NAME = P_NAME_DEF AND 
>               INITIAL_EXTENT IS NULL AND
>               NEXT_EXTENT IS NULL AND 
>               MIN_EXTENT IS NULL AND 
>               MAX_EXTENT IS NULL AND 
>               MAX_SIZE IS NULL AND 
>               PCT_INCREASE IS NULL AND 
>               FREELISTS IS NULL AND 
>               FREELIST_GROUPS IS NULL; 
>         IF ITEM = 0 THEN
>           
>           
>           
>           
>           IF P_NAME_INT IS NOT NULL THEN
>             BEGIN
>               SELECT COUNT(1) INTO ITEM
>               FROM   DBA_IND_PARTITIONS 
>               WHERE  INDEX_OWNER=I_OWNER AND INDEX_NAME=I_NAME AND 
>                      PARTITION_NAME IN (P_NAME_INT, P_NAME_DEF)
>               GROUP BY INITIAL_EXTENT, MIN_EXTENT, NEXT_EXTENT,
>                        MIN_EXTENT, MAX_EXTENT, MAX_SIZE, PCT_INCREASE,
>                        FREELISTS, FREELIST_GROUPS;
>             
>             
>             EXCEPTION WHEN OTHERS THEN
>               
>               CHANGED := TRUE;
>             END;
>           ELSE
>             
>             CHANGED := TRUE;
>           END IF;
>           IF (CHANGED) THEN
>             IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>             DBMS_SYSTEM.KSDWRT(1, 'idxpart 7: partition attributes of ' ||
>                                    P_NAME_DEF || ' are changed');
>             END IF;
>             RETURN CHANGED;
>           END IF;
>         END IF;
>       END IF;
>     EXCEPTION WHEN OTHERS THEN
>       IF (DBMS_REDEFINITION_INTERNAL.CHECK_TRACE_EVENT) THEN
>         DBMS_SYSTEM.KSDWRT(1, 'idxpart 8: exception mark as changed');
>       END IF;
>       CHANGED := TRUE;
>     END;
>     RETURN CHANGED;
>   END IDX_PART_ATR_CHG;
1013c1349
<   PROCEDURE ADD_DEP_ERRMSG(RID           IN     PLS_INTEGER,
---
>   PROCEDURE ADD_DEP_ERRMSG(RID          IN     PLS_INTEGER,
SYS.DBMS_SNAP_INTERNAL - PACKAGE BODY (JUL2019RUR):
452,453c452,454
<     SECURE_OWNER := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(TABOWNER);
<     SECURE_NAME := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(TABNAME);
---
>     
>     SECURE_OWNER := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABOWNER);
>     SECURE_NAME  := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABNAME); 
581,582c582,584
<       SECURE_OWNER := TABOWNER;
<       SECURE_NAME := TABNAME;
---
>       
>       SECURE_OWNER := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABOWNER);
>       SECURE_NAME  := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABNAME); 
SYS.DBMS_SPACE_ADMIN - PACKAGE BODY (RU):
575a576,579
>     ELSIF (SEGMENT_TYPE = 'TABLE PARTITION') THEN
>       V_PART_NAME  := SUBSTR(PARTITION_NAME, 1, 30);
>       V_TABLE_NAME := SUBSTR(SEGMENT_NAME, 1, 30);
> 
589c593
<   IF (V_SEG_TYPE != 'TABLE') THEN
---
>   IF (V_SEG_TYPE != 'TABLE' AND V_SEG_TYPE != 'TABLE PARTITION') THEN
612a617,620
>                         NULL, NULL);
>   ELSIF (V_SEG_TYPE = 'TABLE PARTITION') THEN
>     
>     ASSM_SEGMENT_REPAIR(V_OWNER, V_TABLE_NAME, V_SEG_TYPE, V_PART_NAME, 29,
SYS.DBMS_STATS - PACKAGE BODY (OCT2019RUR):
51435,51492d51434
< 
<   
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
<   PROCEDURE INIT_ADVISOR_TASK_PARAMETER(
<     TASK_NAME     IN VARCHAR2,
<     PARAMETER     IN VARCHAR2,
<     VALUE         IN VARCHAR2)
<   IS
<     IN_EXEC          BOOLEAN := FALSE;     
<   BEGIN
< 
<     
<     
<     BEGIN
<       DBMS_STATS_ADVISOR.SET_TASK_PARAMETER(TASK_NAME, PARAMETER, VALUE);
<     EXCEPTION
<       WHEN OTHERS THEN
<         IF (SQLCODE = -13647) THEN
<           IN_EXEC := TRUE;
<         ELSE
<           RAISE;
<         END IF;
<     END;
< 
< 
<    
<    
<    IF (IN_EXEC = TRUE) THEN
< 
<      BEGIN
<        DBMS_STATS_ADVISOR.CANCEL_TASK(TASK_NAME);
<      EXCEPTION
<        WHEN OTHERS THEN
<          
<          
<          
<          IF (IS_URGENT_ERROR) THEN
<            RAISE;
<          END IF;
<      END;
< 
<      DBMS_STATS_ADVISOR.SET_TASK_PARAMETER(TASK_NAME, PARAMETER, VALUE);
< 
<    END IF;
< 
<   END INIT_ADVISOR_TASK_PARAMETER;
< 
<      
51498,51509d51439
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
51519,51523d51448
<     ELSE
<       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ASTAT, 
<                                  'DAYS_TO_EXPIRE', 'UNLIMITED');
<       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ASTAT, 
<                                  'EXECUTION_DAYS_TO_EXPIRE', 30);
51532,51536d51456
<     ELSE
<       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ISTAT, 
<                                  'DAYS_TO_EXPIRE', 'UNLIMITED');
<       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ISTAT, 
<                                  'EXECUTION_DAYS_TO_EXPIRE', 30);
SYS.DBMS_STATS - PACKAGE BODY (RU):
34992a34993
>     TRANS_GTT BOOLEAN;           
34994d34994
< 
35079c35079,35087
<         FLUSH_ONE_MON_INFO(TOBJN);
---
>         IF (NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>         THEN
>           
>           
>           
>           
>           
>           FLUSH_ONE_MON_INFO(TOBJN);
>         END IF;
35740d35747
< 
35744c35751,35752
<   BEGIN  
---
>     TRANS_GTT     BOOLEAN;     
>   BEGIN                        
36417c36425,36427
<         (PREPARESTATJOBS OR SEQSTATJOBS)) THEN
---
>         (PREPARESTATJOBS OR SEQSTATJOBS) AND
>         NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>     THEN
36419a36430,36436
>       
>       
>       
> 
>       
>       
> 
SYS.DBMS_STATS - PACKAGE BODY (JUL2019RUR):
51434a51435,51492
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   PROCEDURE INIT_ADVISOR_TASK_PARAMETER(
>     TASK_NAME     IN VARCHAR2,
>     PARAMETER     IN VARCHAR2,
>     VALUE         IN VARCHAR2)
>   IS
>     IN_EXEC          BOOLEAN := FALSE;     
>   BEGIN
> 
>     
>     
>     BEGIN
>       DBMS_STATS_ADVISOR.SET_TASK_PARAMETER(TASK_NAME, PARAMETER, VALUE);
>     EXCEPTION
>       WHEN OTHERS THEN
>         IF (SQLCODE = -13647) THEN
>           IN_EXEC := TRUE;
>         ELSE
>           RAISE;
>         END IF;
>     END;
> 
> 
>    
>    
>    IF (IN_EXEC = TRUE) THEN
> 
>      BEGIN
>        DBMS_STATS_ADVISOR.CANCEL_TASK(TASK_NAME);
>      EXCEPTION
>        WHEN OTHERS THEN
>          
>          
>          
>          IF (IS_URGENT_ERROR) THEN
>            RAISE;
>          END IF;
>      END;
> 
>      DBMS_STATS_ADVISOR.SET_TASK_PARAMETER(TASK_NAME, PARAMETER, VALUE);
> 
>    END IF;
> 
>   END INIT_ADVISOR_TASK_PARAMETER;
> 
>      
51439a51498,51509
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
51448a51519,51523
>     ELSE
>       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ASTAT, 
>                                  'DAYS_TO_EXPIRE', 'UNLIMITED');
>       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ASTAT, 
>                                  'EXECUTION_DAYS_TO_EXPIRE', 30);
51456a51532,51536
>     ELSE
>       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ISTAT, 
>                                  'DAYS_TO_EXPIRE', 'UNLIMITED');
>       INIT_ADVISOR_TASK_PARAMETER(PRVT_ADVISOR.TASK_RESERVED_NAME_ISTAT, 
>                                  'EXECUTION_DAYS_TO_EXPIRE', 30);
SYS.DBMS_STATS_ADVISOR - PACKAGE BODY (OCT2019RUR):
3307,3316d3306
<     
<     
<     
<     
<     DBMS_STATS.SET_ADVISOR_TASK_PARAMETER(TNAME, 
<       'DAYS_TO_EXPIRE', 'UNLIMITED');
<     DBMS_STATS.SET_ADVISOR_TASK_PARAMETER(TNAME, 
<       'EXECUTION_DAYS_TO_EXPIRE', 30);
< 
<     
4590,4596d4579
< 
<       
<       WHEN UPPER(PARAMETER) = 'DAYS_TO_EXPIRE' THEN
<         DBMS_ADVISOR.SET_TASK_PARAMETER(TNAMEU, PARAMETER, VALUE);
< 
<       WHEN UPPER(PARAMETER) = 'EXECUTION_DAYS_TO_EXPIRE' THEN
<         DBMS_ADVISOR.SET_TASK_PARAMETER(TNAMEU, PARAMETER, VALUE);
SYS.DBMS_STATS_ADVISOR - PACKAGE BODY (JUL2019RUR):
3306a3307,3316
>     
>     
>     
>     
>     DBMS_STATS.SET_ADVISOR_TASK_PARAMETER(TNAME, 
>       'DAYS_TO_EXPIRE', 'UNLIMITED');
>     DBMS_STATS.SET_ADVISOR_TASK_PARAMETER(TNAME, 
>       'EXECUTION_DAYS_TO_EXPIRE', 30);
> 
>     
4579a4590,4596
> 
>       
>       WHEN UPPER(PARAMETER) = 'DAYS_TO_EXPIRE' THEN
>         DBMS_ADVISOR.SET_TASK_PARAMETER(TNAMEU, PARAMETER, VALUE);
> 
>       WHEN UPPER(PARAMETER) = 'EXECUTION_DAYS_TO_EXPIRE' THEN
>         DBMS_ADVISOR.SET_TASK_PARAMETER(TNAMEU, PARAMETER, VALUE);
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE BODY (RU):
26102c26102
<     COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>     DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED    := FALSE;
26283c26283
<   COMMON_SECTIONS_INITIALIZED    := FALSE;
---
>   DBMS_AWR_PROTECTED.COMMON_SECTIONS_INITIALIZED    := FALSE;
SYS.DBMS_SYNC_REFRESH_INTERNAL - PACKAGE BODY (JUL2019RUR):
571,572c571,574
< 
<     MV_NAME VARCHAR2(258) := NULL;
---
>   
>     
>     
>     MV_NAME VARCHAR2(2*(ORA_MAX_NAME_LEN + 2) + 1) := NULL;
575c577
<       MV_NAME := REC.SOWNER || '.' || REC.VNAME;
---
>       MV_NAME := '"' || REC.SOWNER || '"."' || REC.VNAME || '"';
SYS.KUPW$WORKER - PACKAGE BODY (RU):
25553c25553
<                        V_SINGLE_DDL_CLOB);
---
>                        DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB, 1500, 1));
26043c26043,26046
<   SEND_TRACE_MSG(NULL, 'In RECREATE_DDL with bind_pattern: ' || BIND_PATTERN);
---
>   SEND_TRACE_MSG(NULL, 'In RECREATE_DDL with bind_pattern: ' || 
>                  NVL(TO_CHAR(BIND_PATTERN), 'NULL') || ', ddllen=' ||
>                  LENGTH(V_SINGLE_DDL_CLOB) || ', ' ||
>                  DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB,250,1));
32967c32970
<                 SUBSTR(NVL(NVL(RTN, V_EXT_RTN), MSG), 0, KUPCC.K_1K);
---
>                 SUBSTRB(NVL(NVL(RTN, V_EXT_RTN), MSG), 0, KUPCC.K_1K);
SYS.PRVT_ILM - PACKAGE BODY (JUL2019RUR):
5929,5930c5929
<            TRACE(ILM_DEBUG_ENTRY_EXIT,
<                   'Exiting execute_ilm_policies ');
---
> 
5932,5936d5930
<           BEGIN
<              PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
<              EXCEPTION
<           WHEN OTHERS THEN
<          
5939,5941c5933,5939
<             NULL;
<           END;
<          
---
>           
>           IF (V_TAB_ILMJOB.COUNT > 0) THEN
>             BEGIN
>                PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
>                EXCEPTION
>             WHEN OTHERS THEN
>             
5944c5942,5955
<           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;              
> 
7875c7886,7887
<           WHERE V_TABTASKINFO(I).N_UNRESOL = 0;
---
>           WHERE V_TABTASKINFO(I).N_UNRESOL = 0
>             AND EXECUTION_ID = V_TABTASKINFO(I).TASK_ID;
SYS.PRVT_ILM - PACKAGE BODY (RU):
7834a7835,7847
>     
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
7836,7859c7849,7864
<       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);
SYS.PRVT_ILM - PACKAGE BODY (OCT2019RUR):
5929,5932c5929,5930
< 
<           
< 
< 
---
>            TRACE(ILM_DEBUG_ENTRY_EXIT,
>                   'Exiting execute_ilm_policies ');
5934,5940c5932,5936
<           IF (V_TAB_ILMJOB.COUNT > 0) THEN
<             BEGIN
<                PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
<                EXCEPTION
<             WHEN OTHERS THEN
<             
< 
---
>           BEGIN
>              PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
>              EXCEPTION
>           WHEN OTHERS THEN
>          
5942,5944d5937
<               NULL;
<             END;
<             
5945a5939,5941
>             NULL;
>           END;
>          
5947,5954d5942
<             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;              
5955a5944
>           PRVT_ILM.UPDATE_TAB_ILMJOB(V_TAB_ILMJOB);
7886,7887c7875
<           WHERE V_TABTASKINFO(I).N_UNRESOL = 0
<             AND EXECUTION_ID = V_TABTASKINFO(I).TASK_ID;
---
>           WHERE V_TABTASKINFO(I).N_UNRESOL = 0;
SYS.DBA_APPLY_ERROR - VIEW (JUL2019RUR):
6a7
>           when e.flags > 255                then 'UNDEFINED'
8c9,10
<           when (bitand(e.flags, 132) = 132) then 'PROCEDURE ERROR WITH LCRS'
---
>           when (bitand(e.flags, 32) = 32)   then 'REPLICAT RETRIED'
>           when (bitand(e.flags, 130) = 130) then 'PROCEDURE ERROR WITH LCRS'
11,14c13,22
<                when (bitand(e.flags, 66) = 66) then 'CONFLICT INFO, RECORD LCR'
<                when (bitand(e.flags, 2) = 2) then 'RECORD LCR'
<                when (bitand(e.flags, 16) = 16) then 'RECORD TXN NO LCRS'
<                else 'RECORD TXN WITH LCRS'
---
>               when (bitand(e.flags, 66) = 66) then 'CONFLICT INFO, RECORD LCR'
>               when (bitand(e.flags, 2) = 2) then 'RECORD LCR'
>               when (bitand(e.flags, 128) = 128) then 'PROCEDURE ERROR NO LCRS'
>               when (bitand(e.flags, 16) = 16) then 'RECORD TXN NO LCRS'
>               else 'RECORD TXN WITH LCRS'
>              end)
>           when (bitand(e.flags, 16) = 16) then
>             (case
>               when (bitand(e.flags, 128) = 128) then 'PROCEDURE ERROR NO LCRS'
>               else 'UNHANDLED ERROR NO LCRS'
16d23
<           when (bitand(e.flags, 16) = 16) then 'UNHANDLED ERROR NO LCRS'
18c25
<           else NULL
---
>           else 'UNHANDLED ERROR WITH LCRS'
SYS.DBA_APPLY_ERROR - VIEW (OCT2019RUR):
7d6
<           when e.flags > 255                then 'UNDEFINED'
9,10c8
<           when (bitand(e.flags, 32) = 32)   then 'REPLICAT RETRIED'
<           when (bitand(e.flags, 130) = 130) then 'PROCEDURE ERROR WITH LCRS'
---
>           when (bitand(e.flags, 132) = 132) then 'PROCEDURE ERROR WITH LCRS'
13,22c11,14
<               when (bitand(e.flags, 66) = 66) then 'CONFLICT INFO, RECORD LCR'
<               when (bitand(e.flags, 2) = 2) then 'RECORD LCR'
<               when (bitand(e.flags, 128) = 128) then 'PROCEDURE ERROR NO LCRS'
<               when (bitand(e.flags, 16) = 16) then 'RECORD TXN NO LCRS'
<               else 'RECORD TXN WITH LCRS'
<              end)
<           when (bitand(e.flags, 16) = 16) then
<             (case
<               when (bitand(e.flags, 128) = 128) then 'PROCEDURE ERROR NO LCRS'
<               else 'UNHANDLED ERROR NO LCRS'
---
>                when (bitand(e.flags, 66) = 66) then 'CONFLICT INFO, RECORD LCR'
>                when (bitand(e.flags, 2) = 2) then 'RECORD LCR'
>                when (bitand(e.flags, 16) = 16) then 'RECORD TXN NO LCRS'
>                else 'RECORD TXN WITH LCRS'
23a16
>           when (bitand(e.flags, 16) = 16) then 'UNHANDLED ERROR NO LCRS'
25c18
<           else 'UNHANDLED ERROR WITH LCRS'
---
>           else NULL

18.0.0.0

SYS.DBMS_AWR_PROTECTED - PACKAGE (RU):
2c2,3
< ACCESSIBLE BY (DBMS_AWR_REPORT_LAYOUT, DBMS_SWRF_REPORT_INTERNAL)
---
> ACCESSIBLE BY (PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT, 
>                PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL)
SYS.DBMS_AWR_PROTECTED - PACKAGE (18.7RUR):
2c2,3
< ACCESSIBLE BY (DBMS_AWR_REPORT_LAYOUT, DBMS_SWRF_REPORT_INTERNAL)
---
> ACCESSIBLE BY (PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT,
>                PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL)
SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.08.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.09.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.08.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.08.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.08.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('18.08.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.09.00.00', 1, fsn - 1));
31c31
<                to_number(substr('18.08.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.09.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.08.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.09.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.08.00.00',  psn + 1));
---
>                              to_number(substr('18.09.00.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.8RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.08.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.08.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.08.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.08.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.08.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('18.08.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.08.01.00', 1, fsn - 1));
31c31
<                to_number(substr('18.08.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.08.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.08.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.08.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.08.00.00',  psn + 1));
---
>                              to_number(substr('18.08.01.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.7RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.07.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.07.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.07.01.00', '.');
<   msn  CONSTANT NUMBER := instr('18.07.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.07.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('18.07.02.00', '.');
>   msn  CONSTANT NUMBER := instr('18.07.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('18.07.02.00', '.', msn + 1);
29c29
<                            to_number(substr('18.07.01.00', 1, fsn - 1));
---
>                            to_number(substr('18.07.02.00', 1, fsn - 1));
31c31
<                to_number(substr('18.07.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.07.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.07.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.07.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.07.01.00',  psn + 1));
---
>                              to_number(substr('18.07.02.00',  psn + 1));
SYS.DBMS_MVIEW_STATS_INTERNAL - PACKAGE (18.7RUR):
2c2
< ACCESSIBLE BY (DBMS_MVIEW_STATS) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_MVIEW_STATS) IS
SYS.DBMS_REGISTRY - PACKAGE (18.7RUR):
13c13
<                                '18.7.1.0.0';
---
>                                '18.7.2.0.0';
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '18.8.0.0.0';
---
>                                '18.9.0.0.0';
SYS.DBMS_REGISTRY - PACKAGE (18.8RUR):
13c13
<                                '18.8.0.0.0';
---
>                                '18.8.1.0.0';
SYS.DBMS_SYNC_REFRESH_INTERNAL - PACKAGE (18.7RUR):
2c2
< ACCESSIBLE BY (DBMS_SYNC_REFRESH) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_SYNC_REFRESH) IS
SYS.DBMS_UMF_PROTECTED - PACKAGE (18.7RUR):
2,5c2,5
<   ACCESSIBLE BY (DBMS_WORKLOAD_REPOSITORY
<                 ,DBMS_SWRF_REPORT_INTERNAL
<                 ,DBMS_AWR_REPORT_LAYOUT
<                 ,DBMS_ASH_INTERNAL) AS
---
>   ACCESSIBLE BY (PACKAGE SYS.DBMS_WORKLOAD_REPOSITORY
>                 ,PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL
>                 ,PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT
>                 ,PACKAGE SYS.DBMS_ASH_INTERNAL) AS
SYS.DBMS_UMF_PROTECTED - PACKAGE (RU):
2,5c2,6
<   ACCESSIBLE BY (DBMS_WORKLOAD_REPOSITORY
<                 ,DBMS_SWRF_REPORT_INTERNAL
<                 ,DBMS_AWR_REPORT_LAYOUT
<                 ,DBMS_ASH_INTERNAL) AS
---
>   ACCESSIBLE BY (PACKAGE SYS.DBMS_WORKLOAD_REPOSITORY
>                 ,PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL
>                 ,PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT
>                 ,PACKAGE SYS.DBMS_ASH_INTERNAL) AS
> 
SYS.DBMS_RCVMAN - PACKAGE BODY (18.8RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.01.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (18.7RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.07.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.07.02.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.09.00.00'; 
SYS.DBMS_STATS - PACKAGE BODY (RU):
36710a36711
>     TRANS_GTT BOOLEAN;           
36716a36718
> 
36907,36909c36909,36918
<         
<         DBMS_STATS_INTERNAL.ADDOBJTONUMTAB(OBJTAB, TOBJN);   
<         FLUSHMONMODINFO(OBJTAB);
---
>         IF (NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>         THEN
>           
>           
>           
>           
>           
>           DBMS_STATS_INTERNAL.ADDOBJTONUMTAB(OBJTAB, TOBJN);   
>           FLUSHMONMODINFO(OBJTAB);
>         END IF;
37623d37631
< 
37625a37634
>     TRANS_GTT     BOOLEAN;     
37629d37637
<     
38325c38333,38338
<         (PREPARESTATJOBS OR SEQSTATJOBS)) THEN
---
>         (PREPARESTATJOBS OR SEQSTATJOBS) AND
>         NOT DBMS_STATS_INTERNAL.IS_TEMP_TAB(NULL, NULL, TOBJN, TRANS_GTT)) 
>     THEN
>       
>       
>       
38327a38341,38344
> 
>       
>       
> 
SYS.KUPW$WORKER - PACKAGE BODY (RU):
26311c26311
<                        V_SINGLE_DDL_CLOB);
---
>                        DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB, 1500, 1));
26824,26825c26824,26827
<   SEND_TRACE_MSG(NULL, 'In RECREATE_DDL with bind_pattern: ' || BIND_PATTERN ||
<                        ' '||DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB,100,1));
---
>   SEND_TRACE_MSG(NULL, 'In RECREATE_DDL with bind_pattern: ' || 
>                  NVL(TO_CHAR(BIND_PATTERN), 'NULL') || ', ddllen=' ||
>                  LENGTH(V_SINGLE_DDL_CLOB) || ', ' ||
>                  DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB,250,1));
33670c33672
<                 SUBSTR(NVL(NVL(RTN, V_EXT_RTN), FACILITY || L_SPACER || MSG), 
---
>                 SUBSTRB(NVL(NVL(RTN, V_EXT_RTN), FACILITY || L_SPACER || MSG), 
SYS.PRVT_ILM - PACKAGE BODY (RU):
7865a7866,7878
>     
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
7867,7890c7880,7895
<       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);

19.0.0.0

MDSYS.SDO_RDF - PACKAGE (RU):
2017a2018,2156
>   --------------------------- Jena helper functions ------------------------
>   -- Needed because of restrictions in ATP-D environment. Regular users   --
>   -- cannot create Java stored procedures, so we need to create these     --
>   -- at install time as MDSYS.                                            --
>   --------------------------------------------------------------------------
>   PROCEDURE ORACLE_ORARDF_S2SGETSRC (
>     query              varchar2,
>     nsp                MDSYS.RDF_Aliases,
>     defaultG_out   OUT MDSYS.RDF_GRAPHS,
>     sig_out        OUT MDSYS.RDF_GRAPHS);
> 
>   PROCEDURE ORACLE_ORARDF_S2SGETSRCCLOB (
>     query              clob,
>     nsp                MDSYS.RDF_Aliases,
>     defaultG_out   OUT MDSYS.RDF_GRAPHS,
>     sig_out        OUT MDSYS.RDF_GRAPHS);
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVR (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     idxStatus          varchar2,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2);
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNG (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number,
>     networkOwner       varchar2,
>     networkName        varchar2);
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOB (
>     attrs              SYS.ODCINumberList,
>     query              clob,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number,
>     networkOwner       varchar2,
>     networkName        varchar2);
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGNPV (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number);
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOBNPV (
>     attrs              SYS.ODCINumberList,
>     query              clob,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number);
> 
>   FUNCTION ORACLE_ORARDF_SGC (
>     query varchar2)
>   RETURN MDSYS.RDF_varcharArray;
> 
>   FUNCTION ORACLE_ORARDF_SGCCLOB (
>     query clob)
>   RETURN MDSYS.RDF_varcharArray;
> 
>   -------------------- End Jena Helper Functions ---------------------------
> 
MDSYS.SDO_RDF_JAVA_STP - PACKAGE (RU):
354a355,634
>   --------------------------- Jena helper functions ------------------------
>   -- Needed because of restrictions in ATP-D environment. Regular users   --
>   -- cannot create Java stored procedures, so we need to create these     --
>   -- at install time as MDSYS.                                            --
>   --------------------------------------------------------------------------
>   PROCEDURE ORACLE_ORARDF_S2SGETSRC (
>     query              varchar2,
>     nsp                MDSYS.RDF_Aliases,
>     defaultG_out   OUT MDSYS.RDF_GRAPHS,
>     sig_out        OUT MDSYS.RDF_GRAPHS)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.getSources(
>        java.lang.String,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[])';
> 
>   PROCEDURE ORACLE_ORARDF_S2SGETSRCCLOB (
>     query              clob,
>     nsp                MDSYS.RDF_Aliases,
>     defaultG_out   OUT MDSYS.RDF_GRAPHS,
>     sig_out        OUT MDSYS.RDF_GRAPHS)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.getSources(
>        oracle.jdbc.OracleClob,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[])';
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVR (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     idxStatus          varchar2,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.translateQueryPattern(
>        oracle.sql.ARRAY,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        java.lang.String,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        int,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[],
>        java.lang.String,
>        java.lang.String,
>        int[],
>        oracle.sql.ARRAY[],
>        java.lang.String[])';
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNG (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number,
>     networkOwner       varchar2,
>     networkName        varchar2)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.translateQueryPattern(
>        oracle.sql.ARRAY,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        java.lang.String,
>        long,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        int,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[],
>        java.lang.String,
>        java.lang.String,
>        int[],
>        oracle.sql.ARRAY[],
>        java.lang.String[],
>        oracle.sql.ARRAY,
>        int,
>        java.lang.String,
>        java.lang.String)';
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOB (
>     attrs              SYS.ODCINumberList,
>     query              clob,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number,
>     networkOwner       varchar2,
>     networkName        varchar2)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.translateQueryPattern(
>        oracle.sql.ARRAY,
>        oracle.jdbc.OracleClob,
>        oracle.sql.ARRAY,
>        java.lang.String,
>        long,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        int,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[],
>        java.lang.String,
>        java.lang.String,
>        int[],
>        oracle.sql.ARRAY[],
>        java.lang.String[],
>        oracle.sql.ARRAY,
>        int,
>        java.lang.String,
>        java.lang.String)';
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGNPV (
>     attrs              SYS.ODCINumberList,
>     query              varchar2,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.translateQueryPattern(
>        oracle.sql.ARRAY,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        java.lang.String,
>        long,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        int,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[],
>        java.lang.String,
>        java.lang.String,
>        int[],
>        oracle.sql.ARRAY[],
>        java.lang.String[],
>        oracle.sql.ARRAY,
>        int)';
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOBNPV (
>     attrs              SYS.ODCINumberList,
>     query              clob,
>     models             MDSYS.RDF_Models,
>     precompIdx         varchar2,
>     precompIdxID       number,
>     idxStatus          varchar2,
>     defaultGIDs        SYS.ODCINumberList,
>     namedGIDs          SYS.ODCINumberList,
>     defaultMIDs        SYS.ODCINumberList,
>     defaultModels      MDSYS.RDF_Models,
>     nsp                MDSYS.RDF_Aliases,
>     flag               number,
>     str_out        OUT MDSYS.RDF_longVarcharArray,
>     sig_out        OUT MDSYS.RDF_varcharArray,
>     options            varchar2,
>     vmViewName         varchar2,
>     flag_out       OUT number,
>     valIdCover_out OUT SYS.ODCINumberList,
>     orderBy_out    OUT varchar2,
>     model_types        SYS.ODCINumberList,
>     isRDFVModel        number)
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.translateQueryPattern(
>        oracle.sql.ARRAY,
>        oracle.jdbc.OracleClob,
>        oracle.sql.ARRAY,
>        java.lang.String,
>        long,
>        java.lang.String,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        oracle.sql.ARRAY,
>        int,
>        oracle.sql.ARRAY[],
>        oracle.sql.ARRAY[],
>        java.lang.String,
>        java.lang.String,
>        int[],
>        oracle.sql.ARRAY[],
>        java.lang.String[],
>        oracle.sql.ARRAY,
>        int)';
> 
>   FUNCTION ORACLE_ORARDF_SGC (
>     query varchar2)
>   RETURN MDSYS.RDF_varcharArray
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.getPatternVariables(
>        java.lang.String)
>      return oracle.sql.STRUCT';
> 
>   FUNCTION ORACLE_ORARDF_SGCCLOB (
>     query clob)
>   RETURN MDSYS.RDF_varcharArray
>   IS
>   language java name
>     'oracle.spatial.rdf.server.SQLEntryPoints.getPatternVariables(
>        oracle.jdbc.OracleClob)
>      return oracle.sql.STRUCT';
> 
>   -------------------- End Jena Helper Functions ---------------------------
> 
MDSYS.SDO_RDF - PACKAGE BODY (RU):
26514a26515,26798
>   
>   
>   
>   
>   
> 
>   PROCEDURE ORACLE_ORARDF_S2SGETSRC (
>     QUERY              VARCHAR2,
>     NSP                MDSYS.RDF_ALIASES,
>     DEFAULTG_OUT   OUT MDSYS.RDF_GRAPHS,
>     SIG_OUT        OUT MDSYS.RDF_GRAPHS)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SGETSRC(
>       QUERY,
>       NSP,
>       DEFAULTG_OUT,
>       SIG_OUT);
>   END ORACLE_ORARDF_S2SGETSRC;
> 
>   PROCEDURE ORACLE_ORARDF_S2SGETSRCCLOB (
>     QUERY              CLOB,
>     NSP                MDSYS.RDF_ALIASES,
>     DEFAULTG_OUT   OUT MDSYS.RDF_GRAPHS,
>     SIG_OUT        OUT MDSYS.RDF_GRAPHS)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SGETSRCCLOB(
>       QUERY,
>       NSP,
>       DEFAULTG_OUT,
>       SIG_OUT);
>   END ORACLE_ORARDF_S2SGETSRCCLOB;
>  
>   PROCEDURE ORACLE_ORARDF_S2SSVR (
>     ATTRS              SYS.ODCINUMBERLIST,
>     QUERY              VARCHAR2,
>     MODELS             MDSYS.RDF_MODELS,
>     PRECOMPIDX         VARCHAR2,
>     IDXSTATUS          VARCHAR2,
>     NSP                MDSYS.RDF_ALIASES,
>     FLAG               NUMBER,
>     STR_OUT        OUT MDSYS.RDF_LONGVARCHARARRAY,
>     SIG_OUT        OUT MDSYS.RDF_VARCHARARRAY,
>     OPTIONS            VARCHAR2,
>     VMVIEWNAME         VARCHAR2,
>     FLAG_OUT       OUT NUMBER,
>     VALIDCOVER_OUT OUT SYS.ODCINUMBERLIST,
>     ORDERBY_OUT    OUT VARCHAR2)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SSVR(
>       ATTRS,
>       QUERY,
>       MODELS,
>       PRECOMPIDX,
>       IDXSTATUS,
>       NSP,
>       FLAG,
>       STR_OUT,
>       SIG_OUT,
>       OPTIONS,
>       VMVIEWNAME,
>       FLAG_OUT,
>       VALIDCOVER_OUT,
>       ORDERBY_OUT);
>   END ORACLE_ORARDF_S2SSVR;
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNG (
>     ATTRS              SYS.ODCINUMBERLIST,
>     QUERY              VARCHAR2,
>     MODELS             MDSYS.RDF_MODELS,
>     PRECOMPIDX         VARCHAR2,
>     PRECOMPIDXID       NUMBER,
>     IDXSTATUS          VARCHAR2,
>     DEFAULTGIDS        SYS.ODCINUMBERLIST,
>     NAMEDGIDS          SYS.ODCINUMBERLIST,
>     DEFAULTMIDS        SYS.ODCINUMBERLIST,
>     DEFAULTMODELS      MDSYS.RDF_MODELS,
>     NSP                MDSYS.RDF_ALIASES,
>     FLAG               NUMBER,
>     STR_OUT        OUT MDSYS.RDF_LONGVARCHARARRAY,
>     SIG_OUT        OUT MDSYS.RDF_VARCHARARRAY,
>     OPTIONS            VARCHAR2,
>     VMVIEWNAME         VARCHAR2,
>     FLAG_OUT       OUT NUMBER,
>     VALIDCOVER_OUT OUT SYS.ODCINUMBERLIST,
>     ORDERBY_OUT    OUT VARCHAR2,
>     MODEL_TYPES        SYS.ODCINUMBERLIST,
>     ISRDFVMODEL        NUMBER,
>     NETWORKOWNER       VARCHAR2,
>     NETWORKNAME        VARCHAR2)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SSVRNG(
>       ATTRS,
>       QUERY,
>       MODELS,
>       PRECOMPIDX,
>       PRECOMPIDXID,
>       IDXSTATUS,
>       DEFAULTGIDS,
>       NAMEDGIDS,
>       DEFAULTMIDS,
>       DEFAULTMODELS,
>       NSP,
>       FLAG,
>       STR_OUT,
>       SIG_OUT,
>       OPTIONS,
>       VMVIEWNAME,
>       FLAG_OUT,
>       VALIDCOVER_OUT,
>       ORDERBY_OUT,
>       MODEL_TYPES,
>       ISRDFVMODEL,
>       NETWORKOWNER,
>       NETWORKNAME);
>   END ORACLE_ORARDF_S2SSVRNG;
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOB (
>     ATTRS              SYS.ODCINUMBERLIST,
>     QUERY              CLOB,
>     MODELS             MDSYS.RDF_MODELS,
>     PRECOMPIDX         VARCHAR2,
>     PRECOMPIDXID       NUMBER,
>     IDXSTATUS          VARCHAR2,
>     DEFAULTGIDS        SYS.ODCINUMBERLIST,
>     NAMEDGIDS          SYS.ODCINUMBERLIST,
>     DEFAULTMIDS        SYS.ODCINUMBERLIST,
>     DEFAULTMODELS      MDSYS.RDF_MODELS,
>     NSP                MDSYS.RDF_ALIASES,
>     FLAG               NUMBER,
>     STR_OUT        OUT MDSYS.RDF_LONGVARCHARARRAY,
>     SIG_OUT        OUT MDSYS.RDF_VARCHARARRAY,
>     OPTIONS            VARCHAR2,
>     VMVIEWNAME         VARCHAR2,
>     FLAG_OUT       OUT NUMBER,
>     VALIDCOVER_OUT OUT SYS.ODCINUMBERLIST,
>     ORDERBY_OUT    OUT VARCHAR2,
>     MODEL_TYPES        SYS.ODCINUMBERLIST,
>     ISRDFVMODEL        NUMBER,
>     NETWORKOWNER       VARCHAR2,
>     NETWORKNAME        VARCHAR2)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SSVRNGCLOB(
>       ATTRS,
>       QUERY,
>       MODELS,
>       PRECOMPIDX,
>       PRECOMPIDXID,
>       IDXSTATUS,
>       DEFAULTGIDS,
>       NAMEDGIDS,
>       DEFAULTMIDS,
>       DEFAULTMODELS,
>       NSP,
>       FLAG,
>       STR_OUT,
>       SIG_OUT,
>       OPTIONS,
>       VMVIEWNAME,
>       FLAG_OUT,
>       VALIDCOVER_OUT,
>       ORDERBY_OUT,
>       MODEL_TYPES,
>       ISRDFVMODEL,
>       NETWORKOWNER,
>       NETWORKNAME);
>   END ORACLE_ORARDF_S2SSVRNGCLOB;
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGNPV (
>     ATTRS              SYS.ODCINUMBERLIST,
>     QUERY              VARCHAR2,
>     MODELS             MDSYS.RDF_MODELS,
>     PRECOMPIDX         VARCHAR2,
>     PRECOMPIDXID       NUMBER,
>     IDXSTATUS          VARCHAR2,
>     DEFAULTGIDS        SYS.ODCINUMBERLIST,
>     NAMEDGIDS          SYS.ODCINUMBERLIST,
>     DEFAULTMIDS        SYS.ODCINUMBERLIST,
>     DEFAULTMODELS      MDSYS.RDF_MODELS,
>     NSP                MDSYS.RDF_ALIASES,
>     FLAG               NUMBER,
>     STR_OUT        OUT MDSYS.RDF_LONGVARCHARARRAY,
>     SIG_OUT        OUT MDSYS.RDF_VARCHARARRAY,
>     OPTIONS            VARCHAR2,
>     VMVIEWNAME         VARCHAR2,
>     FLAG_OUT       OUT NUMBER,
>     VALIDCOVER_OUT OUT SYS.ODCINUMBERLIST,
>     ORDERBY_OUT    OUT VARCHAR2,
>     MODEL_TYPES        SYS.ODCINUMBERLIST,
>     ISRDFVMODEL        NUMBER)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SSVRNGNPV(
>       ATTRS,
>       QUERY,
>       MODELS,
>       PRECOMPIDX,
>       PRECOMPIDXID,
>       IDXSTATUS,
>       DEFAULTGIDS,
>       NAMEDGIDS,
>       DEFAULTMIDS,
>       DEFAULTMODELS,
>       NSP,
>       FLAG,
>       STR_OUT,
>       SIG_OUT,
>       OPTIONS,
>       VMVIEWNAME,
>       FLAG_OUT,
>       VALIDCOVER_OUT,
>       ORDERBY_OUT,
>       MODEL_TYPES,
>       ISRDFVMODEL);
>   END ORACLE_ORARDF_S2SSVRNGNPV;
> 
>   PROCEDURE ORACLE_ORARDF_S2SSVRNGCLOBNPV (
>     ATTRS              SYS.ODCINUMBERLIST,
>     QUERY              CLOB,
>     MODELS             MDSYS.RDF_MODELS,
>     PRECOMPIDX         VARCHAR2,
>     PRECOMPIDXID       NUMBER,
>     IDXSTATUS          VARCHAR2,
>     DEFAULTGIDS        SYS.ODCINUMBERLIST,
>     NAMEDGIDS          SYS.ODCINUMBERLIST,
>     DEFAULTMIDS        SYS.ODCINUMBERLIST,
>     DEFAULTMODELS      MDSYS.RDF_MODELS,
>     NSP                MDSYS.RDF_ALIASES,
>     FLAG               NUMBER,
>     STR_OUT        OUT MDSYS.RDF_LONGVARCHARARRAY,
>     SIG_OUT        OUT MDSYS.RDF_VARCHARARRAY,
>     OPTIONS            VARCHAR2,
>     VMVIEWNAME         VARCHAR2,
>     FLAG_OUT       OUT NUMBER,
>     VALIDCOVER_OUT OUT SYS.ODCINUMBERLIST,
>     ORDERBY_OUT    OUT VARCHAR2,
>     MODEL_TYPES        SYS.ODCINUMBERLIST,
>     ISRDFVMODEL        NUMBER)
>   AS
>   BEGIN
>     SDO_RDF_JAVA_STP.ORACLE_ORARDF_S2SSVRNGCLOBNPV(
>       ATTRS,
>       QUERY,
>       MODELS,
>       PRECOMPIDX,
>       PRECOMPIDXID,
>       IDXSTATUS,
>       DEFAULTGIDS,
>       NAMEDGIDS,
>       DEFAULTMIDS,
>       DEFAULTMODELS,
>       NSP,
>       FLAG,
>       STR_OUT,
>       SIG_OUT,
>       OPTIONS,
>       VMVIEWNAME,
>       FLAG_OUT,
>       VALIDCOVER_OUT,
>       ORDERBY_OUT,
>       MODEL_TYPES,
>       ISRDFVMODEL);
>   END ORACLE_ORARDF_S2SSVRNGCLOBNPV;
> 
>   FUNCTION ORACLE_ORARDF_SGC (QUERY VARCHAR2) 
>   RETURN MDSYS.RDF_VARCHARARRAY
>   AS
>   BEGIN
>     RETURN SDO_RDF_JAVA_STP.ORACLE_ORARDF_SGC(QUERY);
>   END ORACLE_ORARDF_SGC;
> 
>   FUNCTION ORACLE_ORARDF_SGCCLOB (QUERY CLOB)
>   RETURN MDSYS.RDF_VARCHARARRAY
>   AS
>   BEGIN
>     RETURN SDO_RDF_JAVA_STP.ORACLE_ORARDF_SGCCLOB(QUERY);
>   END ORACLE_ORARDF_SGCCLOB;
> 
>   
> 
MDSYS.SDO_TPIDX - PACKAGE BODY (RU):
1c1
< PACKAGE BODY sdo_tpidx AS
---
> PACKAGE BODY       sdo_tpidx AS
3,4c3,4
< INVALID_TG_LAYER_ID       EXCEPTION;
< INVALID_TG_LAYER_GTYPE    EXCEPTION;
---
> INVALID_TG_LAYER_ID       exception;
> INVALID_TG_LAYER_GTYPE    exception;
6,27c6,33
<  FUNCTION INDEX_UPDATE (IA SYS.ODCIINDEXINFO, RID VARCHAR2,
<                         OLDVAL MDSYS.SDO_TOPO_GEOMETRY,
<                         NEWVAL MDSYS.SDO_TOPO_GEOMETRY,
<                         ENV SYS.ODCIENV) RETURN NUMBER IS
<     RETVAL NUMBER;
<     STMT VARCHAR2(1000);
<     UPD_STMT VARCHAR2(1000);
<     CNT NUMBER;
<     TOPOLOGY VARCHAR2(130);
<     TOPOLOGY_IN VARCHAR2(130);
<     TYPE        CURSOR_TYPE IS REF CURSOR;
<     QUERY_CRS   CURSOR_TYPE ;
<     P_TGL_ID    NUMBER;
<     LAYER_LEVEL NUMBER;
<     STMT_N     VARCHAR2(200);
<     STMT_E     VARCHAR2(200);
<     STMT_F     VARCHAR2(200);
<     ID         NUMBER;
<     WS         VARCHAR2(130);
<     ISVERSIONED NUMBER;
<    BEGIN
<      
---
>  FUNCTION Index_Update (ia sys.odciindexinfo, rid varchar2,
>                         oldval mdsys.sdo_topo_geometry,
>                         newval mdsys.sdo_topo_geometry,
>                         env sys.ODCIEnv) return number is
>     retval number;
>     stmt varchar2(1000);
>     upd_stmt varchar2(1000);
>     cnt NUMBER;
>     topology varchar2(130);
>     topology_in varchar2(130);
>     type        cursor_type is REF CURSOR;
>     query_crs   cursor_type ;
>     p_tgl_id    number;
>     layer_level number;
>     stmt_n     varchar2(200);
>     stmt_e     varchar2(200);
>     stmt_f     varchar2(200);
>     id         number;
>     WS         varchar2(130);
>     isVersioned number;
>    begin
>      /* In the relation table, copy over the old values to the new
>         topo_geometry if there are records.
>         1. Delete for the old tg_id those records that are set with a 'D'
>            for the new tg_id.
>         2. Delete the records with a 'D' for the new tg_id.
>         2. Copy the rows from the old tg_id to the new tg_id.
>       */
28a35,805
>      IF ( (newval is NOT NULL) AND (oldval is not NULL) ) THEN
>       stmt := ' SELECT distinct topology from mdsys.user_sdo_topo_metadata ' ||
>               ' WHERE topology_id = :id ';
>        EXECUTE IMMEDIATE stmt into topology_in USING newval.topology_id;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>       isVersioned := sdo_tpidx.isversioned(topology);
> 
>       /* first cleanup the higher level layers so that they point to the
>          new tg_id in the relation$ table.
>           for each parent layer with current layer as the child layer
>             update the relation$
>        */
> 
>        stmt := ' select TG_LAYER_ID from mdsys.user_sdo_topo_metadata '||
>                ' where topology_id = :id and CHILD_LAYER_ID = :chlid';
>        OPEN query_crs FOR stmt using newval.topology_id,
>                                 abs(newval.tg_layer_id);
>        LOOP
>          BEGIN
>            FETCH query_crs INTO p_tgl_id;
>            EXIT when query_crs%NOTFOUND ;
>             upd_stmt := ' update '||topology||'_RELATION$ ' ||
>                         ' set topo_type = :tgid '||
>                         ' WHERE tg_layer_id = :ptglid '||
>                         ' and topo_type = :tgid ';
>             EXECUTE immediate upd_stmt
>                      USING newval.tg_id, p_tgl_id, oldval.tg_id;
>          END;
>        END LOOP ;
>        CLOSE query_crs ;
> 
> 
>        /* lock the old rows from the primitive tables, if the tg_layer_id
>           is a leaf level layer */
>         EXECUTE IMMEDIATE
>           ' SELECT TG_LAYER_LEVEL from mdsys.user_sdo_topo_metadata ' ||
>               ' WHERE topology_id = :tid and tg_layer_id = abs(:tglid) '
>          into layer_level using newval.topology_id,  newval.tg_layer_id;
> 
>         if ( newval.tg_layer_id < 0) then
>            layer_level := 0;
>         end if;
> 
>         IF (layer_level = 0) then
> 
>           stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 1 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
>           stmt_e := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 2 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
>           stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 3 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
> 
>          stmt := ' select node_id from  '||topology||'_NODE$'  ||
>                  ' where node_id in ( ' ||stmt_n|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                 IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                  'begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                   USING WS, topology||'_NODE$', 'node_id = '||sdo_util.number_to_char(id) ;
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
> 
>          stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>                  ' where edge_id in ( ' ||stmt_e|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                 IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                 ' begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                   USING WS, topology||'_EDGE$', 'edge_id = '||sdo_util.number_to_char(id) ;
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
> 
>          stmt := ' select face_id from  '||topology||'_FACE$'  ||
>                  ' where face_id in ( ' ||stmt_f|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                 ' begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                  USING WS, topology||'_FACE$', 'face_id = '||sdo_util.number_to_char(id);
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
> 
>         end if;
> 
>       /* delete rows from the old tg_id corresponding to rows set to 'D' for
>          new tg_id */
>       stmt := ' DELETE FROM '||topology||'_RELATION$ ' ||
>               ' WHERE (tg_layer_id, tg_id, topo_id, topo_type) IN '||
>               ' ( SELECT tg_layer_id, '||sdo_util.number_to_char(oldval.tg_id)||', '||
>               '   topo_id, topo_type FROM  MDSYS.SDO_TOPO_RELATION_DATA '||
>               '   WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>               '   AND topo_attribute = ''D'' ) ';
>       EXECUTE IMMEDIATE stmt using newval.tg_layer_id, newval.tg_id;
> 
>       /* if there are rows to append from the old tg_id, do it here */
>       /* and do this only if the tg_id is different from the old value */
> 
>       if (newval.tg_id <> oldval.tg_id) then
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                 ' WHERE tg_layer_id = :tg_l_id and tg_id = :n_tg_id '||
>                 ' AND topo_attribute = ''A'' ';
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
> 
>          IF (cnt = 1) THEN  /* we need to copy the rows from oldval to newval */
>           stmt := ' INSERT INTO '||topology||'_RELATION$ ' ||
>                   ' SELECT tg_layer_id, '||sdo_util.number_to_char(newval.tg_id)||', '||
>                   '  topo_id, topo_type, topo_attribute '||
>                   ' FROM '||topology||'_RELATION$ '||
>                   ' WHERE tg_layer_id = :tg_l_id and tg_id = :o_tg_id ';
>           EXECUTE IMMEDIATE stmt USING
>                      oldval.tg_layer_id, oldval.tg_id;
>          END IF;
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                 ' WHERE tg_layer_id = :tg_l_id and tg_id = :n_tg_id ';
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
>          IF (cnt = 0) THEN  /* Error: bug 4681927 */
>               mderr.raise_md_error('MD','SDO',-13122);
>          END IF;
>        end if;
> 
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                ' WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>                ' AND (topo_attribute = ''A'' OR topo_attribute = ''D'') ';
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
>      END IF;
> 
>      /* remove the dummy entries in MDSYS.SDO_TOPO_RELATION_DATA
>         for this special case */
>      if ( (oldval is NULL) AND (newval is not NULL) ) then
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                ' WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>                ' AND (topo_attribute = ''A'' OR topo_attribute = ''D'') ';
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
>      end if;
> 
>      if ( (newval is not NULL) AND (oldval is not NULL) AND
>                   (oldval.tg_id = newval.tg_id) ) then
>         retval := sdo_tpidx.index_delete(ia, null, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, null, newval, env);
>      else
>         retval := sdo_tpidx.index_delete(ia, rid, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, rid, newval, env);
>      end if;
>      return retval;
>    end;
> 
>   -----------------------------index_insert------------------------------------
>   ---
>   --- BUGS:
>   ---   internal: 02/27/04, add the collection type dealing
>   ---
>   FUNCTION index_insert (ia sys.odciindexinfo, rid varchar2,
>                           newval mdsys.sdo_topo_geometry,
>                           env sys.ODCIEnv)
>   RETURN NUMBER IS
>   stmt          varchar2(1000);
>   stmt1          varchar2(1000);
>   table_name    varchar2(260);
>   column_name   varchar2(130);
>   topology      varchar2(130);
>   topology_in   varchar2(130);
>   topology_id   number;
>   feature_L_id  number;
>   feature_type  number;
>   feature_id    number;
>   idx_columns   SYS.ODCIColInfoList;
>   cnt           number;
>   layer_gtype   varchar2(32);
>   idx_tab       varchar2(260);
>   BEGIN
> 
>     IF (newval is NULL) THEN
>       return SYS.ODCIConst.Success;
>     END IF;
> 
>     idx_columns := ia.IndexCols;
>     table_name := idx_columns(1).TableName;
>     column_name := idx_columns(1).ColName;
>     column_name := REPLACE(column_name, '"');
>     topology_id := newval.topology_id;
>     feature_L_id := newval.tg_layer_id;
>     feature_id := newval.tg_id;
> 
>     BEGIN
>       IF (feature_L_id IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
>       END IF;
> 
>       -- check the layer_id consistency
>       topology_in := NULL;
> 
>       stmt := 'select topology from mdsys.user_sdo_topo_info where owner = :owner ' ||
>               ' AND topology_id = :topo_id AND table_name = :tab  ' ||
>               ' AND column_name = :col AND TG_Layer_ID = :flid';
>       BEGIN
>         EXECUTE IMMEDIATE stmt INTO topology_in
>           USING ia.IndexSchema, topology_id,table_name,
>                 column_name, abs(feature_L_id);
>       EXCEPTION
>       WHEN OTHERS THEN
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
>         RAISE;
>       END;
> 
>       IF (topology_in IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13261, stmt);
>         raise INVALID_TG_LAYER_ID;
>       END IF;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
> 
>       -- check the feature type consistency
>       stmt := ' select SDO_LAYER_GTYPE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and  SDO_INDEX_NAME = :iname ';
>       EXECUTE IMMEDIATE stmt INTO layer_gtype USING ia.IndexSchema, ia.IndexName;
> 
>       IF (layer_gtype = 'POLYGON' ) THEN
>         IF (newval.tg_type <> 3) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF  (layer_gtype = 'LINE'  OR layer_gtype = 'CURVE' ) THEN
>         IF (newval.tg_type <> 2) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>          raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'POINT' ) THEN
>         IF (newval.tg_type <> 1) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'COLLECTION') THEN
>         IF ((newval.tg_type < 1) OR
>             (newval.tg_type > 4)) THEN
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       END IF;
> 
>       /* insert into the relation$ table */
>       stmt := ' INSERT INTO '||topology||'_RELATION$ '||
>               ' SELECT * from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
>               ' WHERE A.tg_layer_id =  :flid and A.tg_id = :fid ';
>       EXECUTE immediate stmt USING feature_L_id, feature_id;
> 
>        -- PARTITION OR NON PARTITION CASE
>        IF (ia.IndexPartition IS NULL ) THEN
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>                  ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ';
>          EXECUTE IMMEDIATE stmt into idx_tab using ia.IndexSchema, ia.IndexName;
>        ELSE
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>                  ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = ' ||
>                  ' :iname AND SDO_INDEX_PARTITION = :indpart ';
> 
>          EXECUTE IMMEDIATE stmt INTO idx_tab USING
>            ia.IndexSchema, ia.IndexName, ia.IndexPartition;
>        END IF;
> 
> 
>        -- insert into the index table
>        /* do this only if rid is not NULL */
>        IF (rid is not NULL) THEN
>          idx_tab := ia.IndexSchema||'.'||idx_tab;
>          stmt := ' INSERT INTO ' ||
>                  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
>                  ' values (:fid, :rid) ';
>          EXECUTE IMMEDIATE stmt USING feature_id, rid;
>        END IF;
> 
>        stmt := ' DELETE  from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
>                ' WHERE A.tg_layer_id =  :flid and A.tg_id = :fid ';
>        EXECUTE immediate stmt USING feature_L_id, feature_id;
> 
>     EXCEPTION
>     WHEN INVALID_TG_LAYER_GTYPE THEN
>       dbms_output.put_line(sdo_util.number_to_char(feature_L_id));
>       mderr.raise_md_error('MD', 'SDO', -13121, SYS.DBMS_ASSERT.noop(stmt));
>       RETURN SYS.ODCIConst.Error;
>       RAISE;
> 
>     WHEN INVALID_TG_LAYER_ID THEN
>       stmt1 := sdo_util.number_to_char(cnt) || '::'||ia.IndexSchema||'::'||topology||
>               '::'||table_name||'::'||column_name;
>       mderr.raise_md_error('MD', 'SDO', -13113, SYS.DBMS_ASSERT.noop(stmt1));
>       RETURN SYS.ODCIConst.Error;
>       RAISE;
>     END;
>     RETURN SYS.ODCIConst.Success;
>   END;
> 
>   FUNCTION index_delete (ia sys.odciindexinfo, rid varchar2,
>                          oldval mdsys.sdo_topo_geometry,
>                          env sys.ODCIEnv)
>   RETURN NUMBER IS
>   stmt          varchar2(1000);
>   q_stmt        varchar2(1000);
>   topology      varchar2(21);
>   topology_in   varchar2(21);
>   topology_id   number;
>   feature_L_id  number;
>   feature_id    number;
>   idx_tab       varchar2(260);
>   type        cursor_type is REF CURSOR;
>   query_crs   cursor_type ;
>   p_tgl_id    number;
>   cnt         number;
>   layer_level number;
>   id          number;
>   stmt_n      varchar2(200);
>   stmt_e      varchar2(200);
>   stmt_f      varchar2(200);
>   WS          varchar2(130);
>   old_sp    varchar2(128);
>   old_ws     varchar2(128);
>   parent_sp varchar2(128) ;
>   parent_ws varchar2(128) ;
>   isVersioned number;
>   idx_columns   SYS.ODCIColInfoList;
>   table_name varchar2(130);
>   ver_status  varchar2(10);
> 
>   BEGIN
> 
>     IF (oldval IS NULL) THEN
>         RETURN SYS.ODCIConst.Success;
>     END IF;
> 
>     topology_id := oldval.topology_id;
>     feature_L_id := oldval.tg_layer_id;
>     feature_id := oldval.tg_id;
> 
>     stmt := ' select topology from mdsys.user_sdo_topo_info where ' ||
>             ' topology_id = : topo_id and tg_layer_id = :flid ';
>     EXECUTE IMMEDIATE stmt INTO topology_in USING topology_id, abs(feature_L_id);
> 
> 
>     topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>     /* lock the old rows from the primitive tables, if the tg_layer_id
>        is a leaf level layer */
>     EXECUTE IMMEDIATE
>       ' SELECT TG_LAYER_LEVEL  from mdsys.user_sdo_topo_metadata ' ||
>       ' WHERE topology_id = :tid and tg_layer_id = abs(:tglid) '
>     INTO layer_level USING topology_id,  feature_l_id;
> 
>     IF ( feature_l_id < 0) THEN
>        layer_level := 0;
>     END IF;
> 
>     IF (layer_level = 0) THEN
> 
>       stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 1 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt_e := ' select abs(topo_id) from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 2 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 3 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt := ' select node_id from  '||topology||'_NODE$'  ||
>               ' where node_id in ( ' ||stmt_n|| ') for update ';
> 
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>       stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>               ' where edge_id in ( ' ||stmt_e|| ') for update ';
> 
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>       stmt := ' select face_id from  '||topology||'_FACE$'  ||
>               ' where face_id in ( ' ||stmt_f|| ') for update ';
> 
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>     END IF;
> 
>     -- delete from the <>_Relation$ table the rows for feature
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               =  SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
>       IF (rid is not NULL) THEN
>         stmt := 'delete from '||topology||'_relation$ where  ' ||
>                 ' tg_layer_id = :flid and tg_id = :fid ';
>         EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>       END IF;
>     END IF;
> 
>     -- PARTITION OR NON PARTITION CASE
>     IF (ia.IndexPartition IS NULL ) THEN
>       -- insert the rowid, feature id into the index table
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ';
> 
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING ia.IndexSchema, ia.IndexName;
>     ELSE
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ' ||
>               ' AND SDO_INDEX_PARTITION = :indpart ';
> 
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING
>         ia.IndexSchema, ia.IndexName, ia.IndexPartition;
>     END IF;
> 
>     /* see if this tg_is is referred to by any other layer in the relation
>        table for each parent layer that has this layer as the child layer
>        count the rows in relation tables pointing to this tg_id
>        if count > 0 then this violates the hierarchical constraint */
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               = SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
> 
>       IF (rid IS NOT NULL) THEN
>         EXECUTE IMMEDIATE
>           'select /*+ ordered use_nl (b,a) index ' ||
>           '(a '||topology||'_REL_LID$ ) */   count(*) ' ||
>           'from mdsys.user_sdo_topo_info b, ' || topology || '_RELATION$ a ' ||
>           'WHERE b.topology_id = :id ' ||
>           'AND b.child_layer_id = :chlid ' ||
>           'AND b.tg_layer_id = a.tg_layer_id ' ||
>           'AND a.topo_type = :tgid   AND rownum < 2'
>         INTO cnt USING oldval.topology_id, abs(oldval.tg_layer_id), oldval.tg_id;
> 
>         IF (cnt > 0)  THEN
>           BEGIN
>             /* this is hierarchical case */
>             /* setup the variables for WM check  bug 9206217*/
>             isVersioned := 0;
>             ver_status := NULL;
>             idx_columns := ia.IndexCols;
>             table_name := idx_columns(1).TableName;
>             table_name := substr(table_name, 1, length(table_name)-3);
> 
>             EXECUTE IMMEDIATE 'select count(*)' ||
>                               ' from wmsys.ALL_WM_VERSIONED_TABLES' ||
>                               ' where owner = :1 and table_name = :2'
>             INTO isVersioned
>             USING idx_columns(1).tableschema, table_name;
> 
>             IF (isVersioned > 0)  THEN
>               BEGIN
>                 EXECUTE IMMEDIATE 'select state' ||
>                                   ' from wmsys.ALL_WM_VERSIONED_TABLES' ||
>                                   ' where owner = :1 and table_name = :2'
>                 INTO ver_status USING idx_columns(1).tableschema, table_name;
> 
>                 /* need more checks if this is version enabled topology */
>                 EXECUTE IMMEDIATE
>                   'select nvl(sys_context(''lt_ctx'', ''savepoint_name''),' ||
>                   ' ''LATEST'') from SYS.DUAL  '
>                 INTO old_sp;
> 
>                 EXECUTE IMMEDIATE
>                   'select wmsys.lt.getworkspace from SYS.DUAL' INTO old_ws;
> 
>                 EXECUTE IMMEDIATE
>                   'select parent_workspace, parent_savepoint' ||
>                   ' from wmsys.all_workspaces' ||
>                   ' where workspace = dbms_wm.getworkspace '
>                 INTO parent_ws, parent_sp;
> 
>                 IF (parent_sp IS NOT NULL) THEN
>                   EXECUTE IMMEDIATE 'declare begin ' ||
>                     'dbms_wm.gotoworkspace(:parent_workspace); ' ||
>                     'dbms_wm.gotosavepoint(:parent_savepoint); end; '
>                   USING parent_ws, parent_sp;
>                 END IF;
> 
>                 cnt := -1;
>                 EXECUTE IMMEDIATE 'select count(*) from ' || topology ||
>                   '_RELATION$ where tg_layer_id = :tglid and tg_id = :tgid'
>                 INTO cnt USING abs(feature_L_id), feature_id;
> 
>                 EXECUTE IMMEDIATE 'declare begin ' ||
>                   'dbms_wm.gotoworkspace(:old_ws); end; '
>                 USING  old_ws;
> 
>                 IF (old_sp <> 'LATEST') THEN
>                   EXECUTE IMMEDIATE 'declare begin ' ||
>                     'dbms_wm.gotosavepoint(:old_sp);  end; '
>                   USING  old_sp;
>                 END IF;
> 
>                 IF ( (cnt = 0) AND (ver_status <> 'DV') ) THEN
>                   mderr.raise_md_error('MD', 'SDO', -13199,
>                     'Cannot delete a TG object with dependent parent objects');
>                   RETURN SYS.ODCIConst.Error;
>                 END IF;
>               END;
>             ELSE
>               BEGIN
>                 mderr.raise_md_error('MD', 'SDO', -13199,
>                   'Cannot delete a TG object with dependent parent objects');
>                 RETURN SYS.ODCIConst.Error;
>               END;
>             END IF;  /* isVersioned */
>           END;
>         END IF;  /* cnt > 0 */
>       END IF;  /* RID is not NULL */
>     END IF;
> 
>     -- delete from the index table
>     IF (rid is not NULL) THEN
>       idx_tab := ia.IndexSchema||'.'||idx_tab;
>       stmt := 'DELETE '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
>               ' WHERE SDO_TG_ID = :fid' ||
>               ' AND sdo_rowid = :rid';
>       EXECUTE IMMEDIATE stmt USING feature_id, rid;
>     END IF;
> 
>     RETURN SYS.ODCIConst.Success;
>   END;
> 
>   FUNCTION isversioned(topology IN VARCHAR2) return integer IS
>     topo_name varchar2(130);
>     owner varchar2(130);
>     stmt varchar2(200);
>     versionedTopology integer;
>     owmInstalled integer;
>   BEGIN
>     mdsys.SDO_TOPO_METADATA.extract_topo_owner(
>       nls_upper(SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topology)), owner,topo_name);
>     versionedTopology := 0;
> 
>     SELECT MDSYS.SDO_OWM_INSTALLED INTO owmInstalled FROM SYS.DUAL;
> 
>     IF ( owmInstalled > 0 ) THEN
>       stmt := '  select count(*) ' ||
>         ' from   wmsys.ALL_WM_VERSIONED_TABLES  ' ||
>         ' where  owner =  :1  and   table_name =  :2';
>       EXECUTE IMMEDIATE stmt INTO versionedTopology
>         USING owner, SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topo_name) || '_NODE$';
>     END IF;
> 
>     RETURN versionedTopology;
>   END;
> 
> END sdo_tpidx;
> 
> PACKAGE BODY       sdo_tpidx AS
> 
> INVALID_TG_LAYER_ID       exception;
> INVALID_TG_LAYER_GTYPE    exception;
> 
>  FUNCTION Index_Update (ia sys.odciindexinfo, rid varchar2,
>                         oldval mdsys.sdo_topo_geometry,
>                         newval mdsys.sdo_topo_geometry,
>                         env sys.ODCIEnv) return number is
>     retval number;
>     stmt varchar2(1000);
>     upd_stmt varchar2(1000);
>     cnt NUMBER;
>     topology varchar2(130);
>     topology_in varchar2(130);
>     type        cursor_type is REF CURSOR;
>     query_crs   cursor_type ;
>     p_tgl_id    number;
>     layer_level number;
>     stmt_n     varchar2(200);
>     stmt_e     varchar2(200);
>     stmt_f     varchar2(200);
>     id         number;
>     WS         varchar2(130);
>     isVersioned number;
>    begin
>      /* In the relation table, copy over the old values to the new
>         topo_geometry if there are records.
>         1. Delete for the old tg_id those records that are set with a 'D'
>            for the new tg_id.
>         2. Delete the records with a 'D' for the new tg_id.
>         2. Copy the rows from the old tg_id to the new tg_id.
>       */
> 
>      IF ( (newval is NOT NULL) AND (oldval is not NULL) ) THEN
>       stmt := ' SELECT distinct topology from mdsys.user_sdo_topo_metadata ' ||
>               ' WHERE topology_id = :id ';
>        EXECUTE IMMEDIATE stmt into topology_in USING newval.topology_id;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>       isVersioned := sdo_tpidx.isversioned(topology);
> 
>       /* first cleanup the higher level layers so that they point to the
>          new tg_id in the relation$ table.
>           for each parent layer with current layer as the child layer
>             update the relation$
>        */
> 
>        stmt := ' select TG_LAYER_ID from mdsys.user_sdo_topo_metadata '||
>                ' where topology_id = :id and CHILD_LAYER_ID = :chlid';
>        OPEN query_crs FOR stmt using newval.topology_id,
>                                 abs(newval.tg_layer_id);
>        LOOP
>          BEGIN
>            FETCH query_crs INTO p_tgl_id;
>            EXIT when query_crs%NOTFOUND ;
>             upd_stmt := ' update '||topology||'_RELATION$ ' ||
>                         ' set topo_type = :tgid '||
>                         ' WHERE tg_layer_id = :ptglid '||
>                         ' and topo_type = :tgid ';
>             EXECUTE immediate upd_stmt
>                      USING newval.tg_id, p_tgl_id, oldval.tg_id;
>          END;
>        END LOOP ;
>        CLOSE query_crs ;
> 
> 
>        /* lock the old rows from the primitive tables, if the tg_layer_id
>           is a leaf level layer */
>         EXECUTE IMMEDIATE
>           ' SELECT TG_LAYER_LEVEL from mdsys.user_sdo_topo_metadata ' ||
>               ' WHERE topology_id = :tid and tg_layer_id = abs(:tglid) '
>          into layer_level using newval.topology_id,  newval.tg_layer_id;
> 
>         if ( newval.tg_layer_id < 0) then
>            layer_level := 0;
>         end if;
> 
>         IF (layer_level = 0) then
> 
>           stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 1 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
>           stmt_e := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 2 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
>           stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
>                   ' where topo_type = 3 and tg_id = :fid '||
>                   ' and tg_layer_id = :lid ';
> 
>          stmt := ' select node_id from  '||topology||'_NODE$'  ||
>                  ' where node_id in ( ' ||stmt_n|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                 IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                  'begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                   USING WS, topology||'_NODE$', 'node_id = '||sdo_util.number_to_char(id) ;
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
> 
>          stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>                  ' where edge_id in ( ' ||stmt_e|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                 IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                 ' begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                   USING WS, topology||'_EDGE$', 'edge_id = '||sdo_util.number_to_char(id) ;
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
> 
>          stmt := ' select face_id from  '||topology||'_FACE$'  ||
>                  ' where face_id in ( ' ||stmt_f|| ') for update ';
> 
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
>          LOOP
>            BEGIN
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
>                IF (WS <> 'LIVE') THEN
>                 EXECUTE IMMEDIATE
>                 ' begin DBMS_WM.LockRows(:ws, :tab, :qry); end; '
>                  USING WS, topology||'_FACE$', 'face_id = '||sdo_util.number_to_char(id);
>                 END IF;
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
>            END;
>          END LOOP;
>          CLOSE query_crs;
29a807,817
>         end if;
> 
>       /* delete rows from the old tg_id corresponding to rows set to 'D' for
>          new tg_id */
>       stmt := ' DELETE FROM '||topology||'_RELATION$ ' ||
>               ' WHERE (tg_layer_id, tg_id, topo_id, topo_type) IN '||
>               ' ( SELECT tg_layer_id, '||sdo_util.number_to_char(oldval.tg_id)||', '||
>               '   topo_id, topo_type FROM  MDSYS.SDO_TOPO_RELATION_DATA '||
>               '   WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>               '   AND topo_attribute = ''D'' ) ';
>       EXECUTE IMMEDIATE stmt using newval.tg_layer_id, newval.tg_id;
30a819,820
>       /* if there are rows to append from the old tg_id, do it here */
>       /* and do this only if the tg_id is different from the old value */
31a822,826
>       if (newval.tg_id <> oldval.tg_id) then
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                 ' WHERE tg_layer_id = :tg_l_id and tg_id = :n_tg_id '||
>                 ' AND topo_attribute = ''A'' ';
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
32a828,843
>          IF (cnt = 1) THEN  /* we need to copy the rows from oldval to newval */
>           stmt := ' INSERT INTO '||topology||'_RELATION$ ' ||
>                   ' SELECT tg_layer_id, '||sdo_util.number_to_char(newval.tg_id)||', '||
>                   '  topo_id, topo_type, topo_attribute '||
>                   ' FROM '||topology||'_RELATION$ '||
>                   ' WHERE tg_layer_id = :tg_l_id and tg_id = :o_tg_id ';
>           EXECUTE IMMEDIATE stmt USING
>                      oldval.tg_layer_id, oldval.tg_id;
>          END IF;
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                 ' WHERE tg_layer_id = :tg_l_id and tg_id = :n_tg_id ';
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
>          IF (cnt = 0) THEN  /* Error: bug 4681927 */
>               mderr.raise_md_error('MD','SDO',-13122);
>          END IF;
>        end if;
33a845,850
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                ' WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>                ' AND (topo_attribute = ''A'' OR topo_attribute = ''D'') ';
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
>      END IF;
35,38c852,1130
<      IF ( (NEWVAL IS NOT NULL) AND (OLDVAL IS NOT NULL) ) THEN
<       STMT := ' SELECT distinct topology from mdsys.user_sdo_topo_metadata ' ||
<               ' WHERE topology_id = :id ';
<        EXECUTE IMMEDIATE STMT INTO TOPOLOGY_IN USING NEWVAL.TOPOLOGY_ID;
---
>      /* remove the dummy entries in MDSYS.SDO_TOPO_RELATION_DATA
>         for this special case */
>      if ( (oldval is NULL) AND (newval is not NULL) ) then
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
>                ' WHERE tg_layer_id = :tg_l_id AND tg_id = :n_tg_id '||
>                ' AND (topo_attribute = ''A'' OR topo_attribute = ''D'') ';
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
>      end if;
> 
>      if ( (newval is not NULL) AND (oldval is not NULL) AND
>                   (oldval.tg_id = newval.tg_id) ) then
>         retval := sdo_tpidx.index_delete(ia, null, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, null, newval, env);
>      else
>         retval := sdo_tpidx.index_delete(ia, rid, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, rid, newval, env);
>      end if;
>      return retval;
>    end;
> 
>   -----------------------------index_insert------------------------------------
>   ---
>   --- BUGS:
>   ---   internal: 02/27/04, add the collection type dealing
>   ---
>   FUNCTION index_insert (ia sys.odciindexinfo, rid varchar2,
>                           newval mdsys.sdo_topo_geometry,
>                           env sys.ODCIEnv)
>   RETURN NUMBER IS
>   stmt          varchar2(1000);
>   stmt1          varchar2(1000);
>   table_name    varchar2(260);
>   column_name   varchar2(130);
>   topology      varchar2(130);
>   topology_in   varchar2(130);
>   topology_id   number;
>   feature_L_id  number;
>   feature_type  number;
>   feature_id    number;
>   idx_columns   SYS.ODCIColInfoList;
>   cnt           number;
>   layer_gtype   varchar2(32);
>   idx_tab       varchar2(260);
>   BEGIN
> 
>     IF (newval is NULL) THEN
>       return SYS.ODCIConst.Success;
>     END IF;
> 
>     idx_columns := ia.IndexCols;
>     table_name := idx_columns(1).TableName;
>     column_name := idx_columns(1).ColName;
>     column_name := REPLACE(column_name, '"');
>     topology_id := newval.topology_id;
>     feature_L_id := newval.tg_layer_id;
>     feature_id := newval.tg_id;
> 
>     BEGIN
>       IF (feature_L_id IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
>       END IF;
> 
>       -- check the layer_id consistency
>       topology_in := NULL;
> 
>       stmt := 'select topology from mdsys.user_sdo_topo_info where owner = :owner ' ||
>               ' AND topology_id = :topo_id AND table_name = :tab  ' ||
>               ' AND column_name = :col AND TG_Layer_ID = :flid';
>       BEGIN
>         EXECUTE IMMEDIATE stmt INTO topology_in
>           USING ia.IndexSchema, topology_id,table_name,
>                 column_name, abs(feature_L_id);
>       EXCEPTION
>       WHEN OTHERS THEN
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
>         RAISE;
>       END;
> 
>       IF (topology_in IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13261, stmt);
>         raise INVALID_TG_LAYER_ID;
>       END IF;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
> 
>       -- check the feature type consistency
>       stmt := ' select SDO_LAYER_GTYPE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and  SDO_INDEX_NAME = :iname ';
>       EXECUTE IMMEDIATE stmt INTO layer_gtype USING ia.IndexSchema, ia.IndexName;
> 
>       IF (layer_gtype = 'POLYGON' ) THEN
>         IF (newval.tg_type <> 3) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF  (layer_gtype = 'LINE'  OR layer_gtype = 'CURVE' ) THEN
>         IF (newval.tg_type <> 2) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>          raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'POINT' ) THEN
>         IF (newval.tg_type <> 1) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'COLLECTION') THEN
>         IF ((newval.tg_type < 1) OR
>             (newval.tg_type > 4)) THEN
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       END IF;
> 
>       /* insert into the relation$ table */
>       stmt := ' INSERT INTO '||topology||'_RELATION$ '||
>               ' SELECT * from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
>               ' WHERE A.tg_layer_id =  :flid and A.tg_id = :fid ';
>       EXECUTE immediate stmt USING feature_L_id, feature_id;
> 
>        -- PARTITION OR NON PARTITION CASE
>        IF (ia.IndexPartition IS NULL ) THEN
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>                  ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ';
>          EXECUTE IMMEDIATE stmt into idx_tab using ia.IndexSchema, ia.IndexName;
>        ELSE
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>                  ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = ' ||
>                  ' :iname AND SDO_INDEX_PARTITION = :indpart ';
> 
>          EXECUTE IMMEDIATE stmt INTO idx_tab USING
>            ia.IndexSchema, ia.IndexName, ia.IndexPartition;
>        END IF;
> 
> 
>        -- insert into the index table
>        /* do this only if rid is not NULL */
>        IF (rid is not NULL) THEN
>          idx_tab := ia.IndexSchema||'.'||idx_tab;
>          stmt := ' INSERT INTO ' ||
>                  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
>                  ' values (:fid, :rid) ';
>          EXECUTE IMMEDIATE stmt USING feature_id, rid;
>        END IF;
> 
>        stmt := ' DELETE  from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
>                ' WHERE A.tg_layer_id =  :flid and A.tg_id = :fid ';
>        EXECUTE immediate stmt USING feature_L_id, feature_id;
> 
>     EXCEPTION
>     WHEN INVALID_TG_LAYER_GTYPE THEN
>       dbms_output.put_line(sdo_util.number_to_char(feature_L_id));
>       mderr.raise_md_error('MD', 'SDO', -13121, SYS.DBMS_ASSERT.noop(stmt));
>       RETURN SYS.ODCIConst.Error;
>       RAISE;
> 
>     WHEN INVALID_TG_LAYER_ID THEN
>       stmt1 := sdo_util.number_to_char(cnt) || '::'||ia.IndexSchema||'::'||topology||
>               '::'||table_name||'::'||column_name;
>       mderr.raise_md_error('MD', 'SDO', -13113, SYS.DBMS_ASSERT.noop(stmt1));
>       RETURN SYS.ODCIConst.Error;
>       RAISE;
>     END;
>     RETURN SYS.ODCIConst.Success;
>   END;
> 
>   FUNCTION index_delete (ia sys.odciindexinfo, rid varchar2,
>                          oldval mdsys.sdo_topo_geometry,
>                          env sys.ODCIEnv)
>   RETURN NUMBER IS
>   stmt          varchar2(1000);
>   q_stmt        varchar2(1000);
>   topology      varchar2(21);
>   topology_in   varchar2(21);
>   topology_id   number;
>   feature_L_id  number;
>   feature_id    number;
>   idx_tab       varchar2(260);
>   type        cursor_type is REF CURSOR;
>   query_crs   cursor_type ;
>   p_tgl_id    number;
>   cnt         number;
>   layer_level number;
>   id          number;
>   stmt_n      varchar2(200);
>   stmt_e      varchar2(200);
>   stmt_f      varchar2(200);
>   WS          varchar2(130);
>   old_sp    varchar2(128);
>   old_ws     varchar2(128);
>   parent_sp varchar2(128) ;
>   parent_ws varchar2(128) ;
>   isVersioned number;
>   idx_columns   SYS.ODCIColInfoList;
>   table_name varchar2(130);
>   ver_status  varchar2(10);
> 
>   BEGIN
> 
>     IF (oldval IS NULL) THEN
>         RETURN SYS.ODCIConst.Success;
>     END IF;
> 
>     topology_id := oldval.topology_id;
>     feature_L_id := oldval.tg_layer_id;
>     feature_id := oldval.tg_id;
> 
>     stmt := ' select topology from mdsys.user_sdo_topo_info where ' ||
>             ' topology_id = : topo_id and tg_layer_id = :flid ';
>     EXECUTE IMMEDIATE stmt INTO topology_in USING topology_id, abs(feature_L_id);
> 
> 
>     topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>     /* lock the old rows from the primitive tables, if the tg_layer_id
>        is a leaf level layer */
>     EXECUTE IMMEDIATE
>       ' SELECT TG_LAYER_LEVEL  from mdsys.user_sdo_topo_metadata ' ||
>       ' WHERE topology_id = :tid and tg_layer_id = abs(:tglid) '
>     INTO layer_level USING topology_id,  feature_l_id;
> 
>     IF ( feature_l_id < 0) THEN
>        layer_level := 0;
>     END IF;
> 
>     IF (layer_level = 0) THEN
> 
>       stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 1 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt_e := ' select abs(topo_id) from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 2 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
>                 ' where topo_type = 3 and tg_id = :fid '||
>                 ' and tg_layer_id = :lid ';
> 
>       stmt := ' select node_id from  '||topology||'_NODE$'  ||
>               ' where node_id in ( ' ||stmt_n|| ') for update ';
> 
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>       stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>               ' where edge_id in ( ' ||stmt_e|| ') for update ';
> 
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>       stmt := ' select face_id from  '||topology||'_FACE$'  ||
>               ' where face_id in ( ' ||stmt_f|| ') for update ';
40,43c1132,1311
<       TOPOLOGY := SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(TOPOLOGY_IN);
<       ISVERSIONED := SDO_TPIDX.ISVERSIONED(TOPOLOGY);
<      
<       
---
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
>       LOOP
>         BEGIN
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
>         END;
>       END LOOP;
>       CLOSE query_crs;
> 
>     END IF;
> 
>     -- delete from the <>_Relation$ table the rows for feature
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               =  SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
>       IF (rid is not NULL) THEN
>         stmt := 'delete from '||topology||'_relation$ where  ' ||
>                 ' tg_layer_id = :flid and tg_id = :fid ';
>         EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>       END IF;
>     END IF;
> 
>     -- PARTITION OR NON PARTITION CASE
>     IF (ia.IndexPartition IS NULL ) THEN
>       -- insert the rowid, feature id into the index table
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ';
> 
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING ia.IndexSchema, ia.IndexName;
>     ELSE
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
>               ' where SDO_INDEX_OWNER = :owner and SDO_INDEX_NAME = :iname ' ||
>               ' AND SDO_INDEX_PARTITION = :indpart ';
> 
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING
>         ia.IndexSchema, ia.IndexName, ia.IndexPartition;
>     END IF;
> 
>     /* see if this tg_is is referred to by any other layer in the relation
>        table for each parent layer that has this layer as the child layer
>        count the rows in relation tables pointing to this tg_id
>        if count > 0 then this violates the hierarchical constraint */
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               = SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
> 
>       IF (rid IS NOT NULL) THEN
>         EXECUTE IMMEDIATE
>           'select /*+ ordered use_nl (b,a) index ' ||
>           '(a '||topology||'_REL_LID$ ) */   count(*) ' ||
>           'from mdsys.user_sdo_topo_info b, ' || topology || '_RELATION$ a ' ||
>           'WHERE b.topology_id = :id ' ||
>           'AND b.child_layer_id = :chlid ' ||
>           'AND b.tg_layer_id = a.tg_layer_id ' ||
>           'AND a.topo_type = :tgid   AND rownum < 2'
>         INTO cnt USING oldval.topology_id, abs(oldval.tg_layer_id), oldval.tg_id;
> 
>         IF (cnt > 0)  THEN
>           BEGIN
>             /* this is hierarchical case */
>             /* setup the variables for WM check  bug 9206217*/
>             isVersioned := 0;
>             ver_status := NULL;
>             idx_columns := ia.IndexCols;
>             table_name := idx_columns(1).TableName;
>             table_name := substr(table_name, 1, length(table_name)-3);
> 
>             EXECUTE IMMEDIATE 'select count(*)' ||
>                               ' from wmsys.ALL_WM_VERSIONED_TABLES' ||
>                               ' where owner = :1 and table_name = :2'
>             INTO isVersioned
>             USING idx_columns(1).tableschema, table_name;
> 
>             IF (isVersioned > 0)  THEN
>               BEGIN
>                 EXECUTE IMMEDIATE 'select state' ||
>                                   ' from wmsys.ALL_WM_VERSIONED_TABLES' ||
>                                   ' where owner = :1 and table_name = :2'
>                 INTO ver_status USING idx_columns(1).tableschema, table_name;
> 
>                 /* need more checks if this is version enabled topology */
>                 EXECUTE IMMEDIATE
>                   'select nvl(sys_context(''lt_ctx'', ''savepoint_name''),' ||
>                   ' ''LATEST'') from SYS.DUAL  '
>                 INTO old_sp;
> 
>                 EXECUTE IMMEDIATE
>                   'select wmsys.lt.getworkspace from SYS.DUAL' INTO old_ws;
> 
>                 EXECUTE IMMEDIATE
>                   'select parent_workspace, parent_savepoint' ||
>                   ' from wmsys.all_workspaces' ||
>                   ' where workspace = dbms_wm.getworkspace '
>                 INTO parent_ws, parent_sp;
> 
>                 IF (parent_sp IS NOT NULL) THEN
>                   EXECUTE IMMEDIATE 'declare begin ' ||
>                     'dbms_wm.gotoworkspace(:parent_workspace); ' ||
>                     'dbms_wm.gotosavepoint(:parent_savepoint); end; '
>                   USING parent_ws, parent_sp;
>                 END IF;
> 
>                 cnt := -1;
>                 EXECUTE IMMEDIATE 'select count(*) from ' || topology ||
>                   '_RELATION$ where tg_layer_id = :tglid and tg_id = :tgid'
>                 INTO cnt USING abs(feature_L_id), feature_id;
> 
>                 EXECUTE IMMEDIATE 'declare begin ' ||
>                   'dbms_wm.gotoworkspace(:old_ws); end; '
>                 USING  old_ws;
> 
>                 IF (old_sp <> 'LATEST') THEN
>                   EXECUTE IMMEDIATE 'declare begin ' ||
>                     'dbms_wm.gotosavepoint(:old_sp);  end; '
>                   USING  old_sp;
>                 END IF;
> 
>                 IF ( (cnt = 0) AND (ver_status <> 'DV') ) THEN
>                   mderr.raise_md_error('MD', 'SDO', -13199,
>                     'Cannot delete a TG object with dependent parent objects');
>                   RETURN SYS.ODCIConst.Error;
>                 END IF;
>               END;
>             ELSE
>               BEGIN
>                 mderr.raise_md_error('MD', 'SDO', -13199,
>                   'Cannot delete a TG object with dependent parent objects');
>                 RETURN SYS.ODCIConst.Error;
>               END;
>             END IF;  /* isVersioned */
>           END;
>         END IF;  /* cnt > 0 */
>       END IF;  /* RID is not NULL */
>     END IF;
> 
>     -- delete from the index table
>     IF (rid is not NULL) THEN
>       idx_tab := ia.IndexSchema||'.'||idx_tab;
>       stmt := 'DELETE '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
>               ' WHERE SDO_TG_ID = :fid' ||
>               ' AND sdo_rowid = :rid';
>       EXECUTE IMMEDIATE stmt USING feature_id, rid;
>     END IF;
> 
>     RETURN SYS.ODCIConst.Success;
>   END;
> 
>   FUNCTION isversioned(topology IN VARCHAR2) return integer IS
>     topo_name varchar2(130);
>     owner varchar2(130);
>     stmt varchar2(200);
>     versionedTopology integer;
>     owmInstalled integer;
>   BEGIN
>     mdsys.SDO_TOPO_METADATA.extract_topo_owner(
>       nls_upper(SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topology)), owner,topo_name);
>     versionedTopology := 0;
> 
>     SELECT MDSYS.SDO_OWM_INSTALLED INTO owmInstalled FROM SYS.DUAL;
> 
>     IF ( owmInstalled > 0 ) THEN
>       stmt := '  select count(*) ' ||
>         ' from   wmsys.ALL_WM_VERSIONED_TABLES  ' ||
>         ' where  owner =  :1  and   table_name =  :2';
>       EXECUTE IMMEDIATE stmt INTO versionedTopology
>         USING owner, SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topo_name) || '_NODE$';
>     END IF;
> 
>     RETURN versionedTopology;
>   END;
> 
> END sdo_tpidx;
44a1313
> PACKAGE BODY       sdo_tpidx AS
45a1315,1316
> INVALID_TG_LAYER_ID       exception;
> INVALID_TG_LAYER_GTYPE    exception;
46a1318,1345
>  FUNCTION Index_Update (ia sys.odciindexinfo, rid varchar2,
>                         oldval mdsys.sdo_topo_geometry,
>                         newval mdsys.sdo_topo_geometry,
>                         env sys.ODCIEnv) return number is
>     retval number;
>     stmt varchar2(1000);
>     upd_stmt varchar2(1000);
>     cnt NUMBER;
>     topology varchar2(130);
>     topology_in varchar2(130);
>     type        cursor_type is REF CURSOR;
>     query_crs   cursor_type ;
>     p_tgl_id    number;
>     layer_level number;
>     stmt_n     varchar2(200);
>     stmt_e     varchar2(200);
>     stmt_f     varchar2(200);
>     id         number;
>     WS         varchar2(130);
>     isVersioned number;
>    begin
>      /* In the relation table, copy over the old values to the new
>         topo_geometry if there are records.
>         1. Delete for the old tg_id those records that are set with a 'D'
>            for the new tg_id.
>         2. Delete the records with a 'D' for the new tg_id.
>         2. Copy the rows from the old tg_id to the new tg_id.
>       */
47a1347,1353
>      IF ( (newval is NOT NULL) AND (oldval is not NULL) ) THEN
>       stmt := ' SELECT distinct topology from mdsys.user_sdo_topo_metadata ' ||
>               ' WHERE topology_id = :id ';
>        EXECUTE IMMEDIATE stmt into topology_in USING newval.topology_id;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>       isVersioned := sdo_tpidx.isversioned(topology);
49c1355,1361
<        STMT := ' select TG_LAYER_ID from mdsys.user_sdo_topo_metadata '||
---
>       /* first cleanup the higher level layers so that they point to the
>          new tg_id in the relation$ table.
>           for each parent layer with current layer as the child layer
>             update the relation$
>        */
> 
>        stmt := ' select TG_LAYER_ID from mdsys.user_sdo_topo_metadata '||
51,52c1363,1364
<        OPEN QUERY_CRS FOR STMT USING NEWVAL.TOPOLOGY_ID,
<                                 ABS(NEWVAL.TG_LAYER_ID);
---
>        OPEN query_crs FOR stmt using newval.topology_id,
>                                 abs(newval.tg_layer_id);
55,57c1367,1369
<            FETCH QUERY_CRS INTO P_TGL_ID;
<            EXIT WHEN QUERY_CRS%NOTFOUND ;
<             UPD_STMT := ' update '||TOPOLOGY||'_RELATION$ ' ||
---
>            FETCH query_crs INTO p_tgl_id;
>            EXIT when query_crs%NOTFOUND ;
>             upd_stmt := ' update '||topology||'_RELATION$ ' ||
61,62c1373,1374
<             EXECUTE IMMEDIATE UPD_STMT 
<                      USING NEWVAL.TG_ID, P_TGL_ID, OLDVAL.TG_ID;
---
>             EXECUTE immediate upd_stmt
>                      USING newval.tg_id, p_tgl_id, oldval.tg_id;
65,66c1377
<        CLOSE QUERY_CRS ;
< 
---
>        CLOSE query_crs ;
68d1378
<        
70c1380,1382
<         EXECUTE IMMEDIATE 
---
>        /* lock the old rows from the primitive tables, if the tg_layer_id
>           is a leaf level layer */
>         EXECUTE IMMEDIATE
73c1385
<          INTO LAYER_LEVEL USING NEWVAL.TOPOLOGY_ID,  NEWVAL.TG_LAYER_ID;     
---
>          into layer_level using newval.topology_id,  newval.tg_layer_id;
75,77c1387,1389
<         IF ( NEWVAL.TG_LAYER_ID < 0) THEN 
<            LAYER_LEVEL := 0;
<         END IF;
---
>         if ( newval.tg_layer_id < 0) then
>            layer_level := 0;
>         end if;
79c1391
<         IF (LAYER_LEVEL = 0) THEN
---
>         IF (layer_level = 0) then
81c1393
<           STMT_N := ' select topo_id from  '||TOPOLOGY||'_RELATION$ '||
---
>           stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
83,84c1395,1396
<                   ' and tg_layer_id = :lid '; 
<           STMT_E := ' select topo_id from  '||TOPOLOGY||'_RELATION$ '||
---
>                   ' and tg_layer_id = :lid ';
>           stmt_e := ' select topo_id from  '||topology||'_RELATION$ '||
86,87c1398,1399
<                   ' and tg_layer_id = :lid '; 
<           STMT_F := ' select topo_id from  '||TOPOLOGY||'_RELATION$ '||
---
>                   ' and tg_layer_id = :lid ';
>           stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
91,92c1403,1404
<          STMT := ' select node_id from  '||TOPOLOGY||'_NODE$'  ||
<                  ' where node_id in ( ' ||STMT_N|| ') for update ';
---
>          stmt := ' select node_id from  '||topology||'_NODE$'  ||
>                  ' where node_id in ( ' ||stmt_n|| ') for update ';
94c1406
<          OPEN QUERY_CRS FOR STMT USING NEWVAL.TG_ID, NEWVAL.TG_LAYER_ID; 
---
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
97,99c1409,1411
<               FETCH QUERY_CRS INTO ID;
<                IF (ID IS NOT NULL AND ISVERSIONED = 1) THEN
<                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' INTO WS;
---
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
101c1413
<                 EXECUTE IMMEDIATE 
---
>                 EXECUTE IMMEDIATE
103c1415
<                   USING WS, TOPOLOGY||'_NODE$', 'node_id = '||SDO_UTIL.NUMBER_TO_CHAR(ID) ; 
---
>                   USING WS, topology||'_NODE$', 'node_id = '||sdo_util.number_to_char(id) ;
105,106c1417,1418
<                END IF; 
<               EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
109c1421
<          CLOSE QUERY_CRS;
---
>          CLOSE query_crs;
111,112c1423,1424
<          STMT := ' select edge_id from  '||TOPOLOGY||'_EDGE$'  ||
<                  ' where edge_id in ( ' ||STMT_E|| ') for update ';
---
>          stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>                  ' where edge_id in ( ' ||stmt_e|| ') for update ';
114c1426
<          OPEN QUERY_CRS FOR STMT USING NEWVAL.TG_ID, NEWVAL.TG_LAYER_ID; 
---
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
117,119c1429,1431
<               FETCH QUERY_CRS INTO ID;
<                IF (ID IS NOT NULL AND ISVERSIONED = 1) THEN
<                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' INTO WS;
---
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
121c1433
<                 EXECUTE IMMEDIATE 
---
>                 EXECUTE IMMEDIATE
123c1435
<                   USING WS, TOPOLOGY||'_EDGE$', 'edge_id = '||SDO_UTIL.NUMBER_TO_CHAR(ID) ; 
---
>                   USING WS, topology||'_EDGE$', 'edge_id = '||sdo_util.number_to_char(id) ;
125,126c1437,1438
<                END IF; 
<               EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
129c1441
<          CLOSE QUERY_CRS;
---
>          CLOSE query_crs;
131,132c1443,1444
<          STMT := ' select face_id from  '||TOPOLOGY||'_FACE$'  ||
<                  ' where face_id in ( ' ||STMT_F|| ') for update ';
---
>          stmt := ' select face_id from  '||topology||'_FACE$'  ||
>                  ' where face_id in ( ' ||stmt_f|| ') for update ';
134c1446
<          OPEN QUERY_CRS FOR STMT USING NEWVAL.TG_ID, NEWVAL.TG_LAYER_ID; 
---
>          OPEN query_crs FOR stmt using newval.tg_id, newval.tg_layer_id;
137,139c1449,1451
<               FETCH QUERY_CRS INTO ID;
<                IF (ID IS NOT NULL AND ISVERSIONED = 1) THEN
<                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' INTO WS;
---
>               FETCH query_crs into id;
>                IF (id is not NULL AND isVersioned = 1) THEN
>                 EXECUTE IMMEDIATE 'SELECT DBMS_WM.GetWorkspace FROM SYS.DUAL ' into WS;
141c1453
<                 EXECUTE IMMEDIATE 
---
>                 EXECUTE IMMEDIATE
143c1455
<                  USING WS, TOPOLOGY||'_FACE$', 'face_id = '||SDO_UTIL.NUMBER_TO_CHAR(ID); 
---
>                  USING WS, topology||'_FACE$', 'face_id = '||sdo_util.number_to_char(id);
145,146c1457,1458
<                END IF; 
<               EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>                END IF;
>               EXIT when query_crs%NOTFOUND ;
149,151c1461
<          CLOSE QUERY_CRS;
< 
<         END IF;
---
>          CLOSE query_crs;
153c1463
<       
---
>         end if;
155c1465,1467
<       STMT := ' DELETE FROM '||TOPOLOGY||'_RELATION$ ' ||
---
>       /* delete rows from the old tg_id corresponding to rows set to 'D' for
>          new tg_id */
>       stmt := ' DELETE FROM '||topology||'_RELATION$ ' ||
157c1469
<               ' ( SELECT tg_layer_id, '||SDO_UTIL.NUMBER_TO_CHAR(OLDVAL.TG_ID)||', '||
---
>               ' ( SELECT tg_layer_id, '||sdo_util.number_to_char(oldval.tg_id)||', '||
161c1473
<       EXECUTE IMMEDIATE STMT USING NEWVAL.TG_LAYER_ID, NEWVAL.TG_ID;
---
>       EXECUTE IMMEDIATE stmt using newval.tg_layer_id, newval.tg_id;
163,164c1475,1476
<       
<       
---
>       /* if there are rows to append from the old tg_id, do it here */
>       /* and do this only if the tg_id is different from the old value */
166,167c1478,1479
<       IF (NEWVAL.TG_ID <> OLDVAL.TG_ID) THEN
<         STMT := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
---
>       if (newval.tg_id <> oldval.tg_id) then
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
170c1482
<          EXECUTE IMMEDIATE STMT INTO CNT USING NEWVAL.TG_LAYER_ID, NEWVAL.TG_ID;
---
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
172,174c1484,1486
<          IF (CNT = 1) THEN  
<           STMT := ' INSERT INTO '||TOPOLOGY||'_RELATION$ ' ||
<                   ' SELECT tg_layer_id, '||SDO_UTIL.NUMBER_TO_CHAR(NEWVAL.TG_ID)||', '||
---
>          IF (cnt = 1) THEN  /* we need to copy the rows from oldval to newval */
>           stmt := ' INSERT INTO '||topology||'_RELATION$ ' ||
>                   ' SELECT tg_layer_id, '||sdo_util.number_to_char(newval.tg_id)||', '||
176c1488
<                   ' FROM '||TOPOLOGY||'_RELATION$ '||
---
>                   ' FROM '||topology||'_RELATION$ '||
178,179c1490,1491
<           EXECUTE IMMEDIATE STMT USING 
<                      OLDVAL.TG_LAYER_ID, OLDVAL.TG_ID;       
---
>           EXECUTE IMMEDIATE stmt USING
>                      oldval.tg_layer_id, oldval.tg_id;
181c1493
<         STMT := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
---
>         stmt := ' SELECT count(*) from MDSYS.SDO_TOPO_RELATION_DATA ' ||
183,185c1495,1497
<          EXECUTE IMMEDIATE STMT INTO CNT USING NEWVAL.TG_LAYER_ID, NEWVAL.TG_ID;
<          IF (CNT = 0) THEN  
<               MDERR.RAISE_MD_ERROR('MD','SDO',-13122);
---
>          EXECUTE IMMEDIATE stmt into cnt using newval.TG_LAYER_ID, newval.TG_ID;
>          IF (cnt = 0) THEN  /* Error: bug 4681927 */
>               mderr.raise_md_error('MD','SDO',-13122);
187c1499
<        END IF;
---
>        end if;
189,190c1501,1502
<       
<        STMT := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
---
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
193c1505
<        EXECUTE IMMEDIATE STMT USING NEWVAL.TG_LAYER_ID, NEWVAL.TG_ID;
---
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
196,200c1508,1512
<      
< 
<      IF ( (OLDVAL IS NULL) AND (NEWVAL IS NOT NULL) ) THEN
<       
<        STMT := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
---
>      /* remove the dummy entries in MDSYS.SDO_TOPO_RELATION_DATA
>         for this special case */
>      if ( (oldval is NULL) AND (newval is not NULL) ) then
>       /* now cleanup the rows with 'A' and 'D' values for the topo_attribute */
>        stmt := ' DELETE FROM MDSYS.SDO_TOPO_RELATION_DATA ' ||
203,215c1515,1516
<        EXECUTE IMMEDIATE STMT USING NEWVAL.TG_LAYER_ID, NEWVAL.TG_ID;
<      END IF;
<    
<      IF ( (NEWVAL IS NOT NULL) AND (OLDVAL IS NOT NULL) AND 
<                   (OLDVAL.TG_ID = NEWVAL.TG_ID) ) THEN
<         RETVAL := SDO_TPIDX.INDEX_DELETE(IA, NULL, OLDVAL, ENV);
<         RETVAL := SDO_TPIDX.INDEX_INSERT(IA, NULL, NEWVAL, ENV);
<      ELSE
<         RETVAL := SDO_TPIDX.INDEX_DELETE(IA, RID, OLDVAL, ENV);
<         RETVAL := SDO_TPIDX.INDEX_INSERT(IA, RID, NEWVAL, ENV);
<      END IF;
<      RETURN RETVAL;
<    END;
---
>        EXECUTE IMMEDIATE stmt using newval.TG_LAYER_ID, newval.TG_ID;
>      end if;
217,224c1518,1536
<   
<   
<   
<   
<   
<   FUNCTION INDEX_INSERT (IA SYS.ODCIINDEXINFO, RID VARCHAR2,
<                           NEWVAL MDSYS.SDO_TOPO_GEOMETRY,
<                           ENV SYS.ODCIENV)
---
>      if ( (newval is not NULL) AND (oldval is not NULL) AND
>                   (oldval.tg_id = newval.tg_id) ) then
>         retval := sdo_tpidx.index_delete(ia, null, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, null, newval, env);
>      else
>         retval := sdo_tpidx.index_delete(ia, rid, oldval, env);
>         retval := sdo_tpidx.index_insert(ia, rid, newval, env);
>      end if;
>      return retval;
>    end;
> 
>   -----------------------------index_insert------------------------------------
>   ---
>   --- BUGS:
>   ---   internal: 02/27/04, add the collection type dealing
>   ---
>   FUNCTION index_insert (ia sys.odciindexinfo, rid varchar2,
>                           newval mdsys.sdo_topo_geometry,
>                           env sys.ODCIEnv)
226,239c1538,1551
<   STMT          VARCHAR2(1000);
<   STMT1          VARCHAR2(1000);
<   TABLE_NAME    VARCHAR2(260);
<   COLUMN_NAME   VARCHAR2(130);
<   TOPOLOGY      VARCHAR2(130);
<   TOPOLOGY_IN   VARCHAR2(130);
<   TOPOLOGY_ID   NUMBER;
<   FEATURE_L_ID  NUMBER;
<   FEATURE_TYPE  NUMBER;
<   FEATURE_ID    NUMBER;
<   IDX_COLUMNS   SYS.ODCICOLINFOLIST;
<   CNT           NUMBER;
<   LAYER_GTYPE   VARCHAR2(32);
<   IDX_TAB       VARCHAR2(260);
---
>   stmt          varchar2(1000);
>   stmt1          varchar2(1000);
>   table_name    varchar2(260);
>   column_name   varchar2(130);
>   topology      varchar2(130);
>   topology_in   varchar2(130);
>   topology_id   number;
>   feature_L_id  number;
>   feature_type  number;
>   feature_id    number;
>   idx_columns   SYS.ODCIColInfoList;
>   cnt           number;
>   layer_gtype   varchar2(32);
>   idx_tab       varchar2(260);
242,243c1554,1555
<     IF (NEWVAL IS NULL) THEN
<       RETURN SYS.ODCICONST.SUCCESS;
---
>     IF (newval is NULL) THEN
>       return SYS.ODCIConst.Success;
246,252c1558,1564
<     IDX_COLUMNS := IA.INDEXCOLS;
<     TABLE_NAME := IDX_COLUMNS(1).TABLENAME;
<     COLUMN_NAME := IDX_COLUMNS(1).COLNAME;
<     COLUMN_NAME := REPLACE(COLUMN_NAME, '"');
<     TOPOLOGY_ID := NEWVAL.TOPOLOGY_ID;
<     FEATURE_L_ID := NEWVAL.TG_LAYER_ID;
<     FEATURE_ID := NEWVAL.TG_ID;
---
>     idx_columns := ia.IndexCols;
>     table_name := idx_columns(1).TableName;
>     column_name := idx_columns(1).ColName;
>     column_name := REPLACE(column_name, '"');
>     topology_id := newval.topology_id;
>     feature_L_id := newval.tg_layer_id;
>     feature_id := newval.tg_id;
255,257c1567,1569
<       IF (FEATURE_L_ID IS NULL) THEN
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13113);
<         RETURN SYS.ODCICONST.ERROR;
---
>       IF (feature_L_id IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
260,261c1572,1573
<       
<       TOPOLOGY_IN := NULL;
---
>       -- check the layer_id consistency
>       topology_in := NULL;
263c1575
<       STMT := 'select topology from mdsys.user_sdo_topo_info where owner = :owner ' ||
---
>       stmt := 'select topology from mdsys.user_sdo_topo_info where owner = :owner ' ||
267,269c1579,1581
<         EXECUTE IMMEDIATE STMT INTO TOPOLOGY_IN
<           USING IA.INDEXSCHEMA, TOPOLOGY_ID,TABLE_NAME,
<                 COLUMN_NAME, ABS(FEATURE_L_ID);
---
>         EXECUTE IMMEDIATE stmt INTO topology_in
>           USING ia.IndexSchema, topology_id,table_name,
>                 column_name, abs(feature_L_id);
272,273c1584,1585
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13113);
<         RETURN SYS.ODCICONST.ERROR;
---
>         mderr.raise_md_error('MD', 'SDO', -13113);
>         RETURN SYS.ODCIConst.Error;
276,285c1588,1597
<  
<       IF (TOPOLOGY_IN IS NULL) THEN
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13261, STMT);
<         RAISE INVALID_TG_LAYER_ID;
<       END IF;
<    
<       TOPOLOGY := SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(TOPOLOGY_IN);
<  
<       
<       STMT := ' select SDO_LAYER_GTYPE from mdsys.all_sdo_index_metadata ' ||
---
> 
>       IF (topology_in IS NULL) THEN
>         mderr.raise_md_error('MD', 'SDO', -13261, stmt);
>         raise INVALID_TG_LAYER_ID;
>       END IF;
> 
>       topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
> 
>       -- check the feature type consistency
>       stmt := ' select SDO_LAYER_GTYPE from mdsys.all_sdo_index_metadata ' ||
287c1599,1633
<       EXECUTE IMMEDIATE STMT INTO LAYER_GTYPE USING IA.INDEXSCHEMA, IA.INDEXNAME;
---
>       EXECUTE IMMEDIATE stmt INTO layer_gtype USING ia.IndexSchema, ia.IndexName;
> 
>       IF (layer_gtype = 'POLYGON' ) THEN
>         IF (newval.tg_type <> 3) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF  (layer_gtype = 'LINE'  OR layer_gtype = 'CURVE' ) THEN
>         IF (newval.tg_type <> 2) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>          raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'POINT' ) THEN
>         IF (newval.tg_type <> 1) THEN
>           -- rollback if there is an error
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       ELSIF (layer_gtype = 'COLLECTION') THEN
>         IF ((newval.tg_type < 1) OR
>             (newval.tg_type > 4)) THEN
>           stmt := 'delete from '||topology||'_relation$ where  ' ||
>                   ' tg_layer_id = :flid and tg_id = :fid';
>           EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
>           raise INVALID_TG_LAYER_GTYPE;
>         END IF;
>       END IF;
289,324c1635,1636
<       IF (LAYER_GTYPE = 'POLYGON' ) THEN
<         IF (NEWVAL.TG_TYPE <> 3) THEN
<           
<           STMT := 'delete from '||TOPOLOGY||'_relation$ where  ' ||
<                   ' tg_layer_id = :flid and tg_id = :fid';
<           EXECUTE IMMEDIATE STMT USING FEATURE_L_ID,  FEATURE_ID;
<           RAISE INVALID_TG_LAYER_GTYPE;
<         END IF;
<       ELSIF  (LAYER_GTYPE = 'LINE'  OR LAYER_GTYPE = 'CURVE' ) THEN
<         IF (NEWVAL.TG_TYPE <> 2) THEN
<           
<           STMT := 'delete from '||TOPOLOGY||'_relation$ where  ' ||
<                   ' tg_layer_id = :flid and tg_id = :fid';
<           EXECUTE IMMEDIATE STMT USING FEATURE_L_ID,  FEATURE_ID;
<          RAISE INVALID_TG_LAYER_GTYPE;
<         END IF;
<       ELSIF (LAYER_GTYPE = 'POINT' ) THEN
<         IF (NEWVAL.TG_TYPE <> 1) THEN
<           
<           STMT := 'delete from '||TOPOLOGY||'_relation$ where  ' ||
<                   ' tg_layer_id = :flid and tg_id = :fid';
<           EXECUTE IMMEDIATE STMT USING FEATURE_L_ID,  FEATURE_ID;
<           RAISE INVALID_TG_LAYER_GTYPE;
<         END IF;
<       ELSIF (LAYER_GTYPE = 'COLLECTION') THEN
<         IF ((NEWVAL.TG_TYPE < 1) OR
<             (NEWVAL.TG_TYPE > 4)) THEN
<           STMT := 'delete from '||TOPOLOGY||'_relation$ where  ' ||
<                   ' tg_layer_id = :flid and tg_id = :fid';
<           EXECUTE IMMEDIATE STMT USING FEATURE_L_ID,  FEATURE_ID;
<           RAISE INVALID_TG_LAYER_GTYPE;
<         END IF; 
<       END IF;
<    
<       
<       STMT := ' INSERT INTO '||TOPOLOGY||'_RELATION$ '||
---
>       /* insert into the relation$ table */
>       stmt := ' INSERT INTO '||topology||'_RELATION$ '||
327c1639
<       EXECUTE IMMEDIATE STMT USING FEATURE_L_ID, FEATURE_ID;
---
>       EXECUTE immediate stmt USING feature_L_id, feature_id;
329,332c1641,1644
<        
<        IF (IA.INDEXPARTITION IS NULL ) THEN
<          
<          STMT := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
---
>        -- PARTITION OR NON PARTITION CASE
>        IF (ia.IndexPartition IS NULL ) THEN
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
334c1646
<          EXECUTE IMMEDIATE STMT INTO IDX_TAB USING IA.INDEXSCHEMA, IA.INDEXNAME;
---
>          EXECUTE IMMEDIATE stmt into idx_tab using ia.IndexSchema, ia.IndexName;
336,337c1648,1649
<          
<          STMT := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
---
>          -- insert the rowid, feature id into the index table
>          stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
341,342c1653,1654
<          EXECUTE IMMEDIATE STMT INTO IDX_TAB USING
<            IA.INDEXSCHEMA, IA.INDEXNAME, IA.INDEXPARTITION;
---
>          EXECUTE IMMEDIATE stmt INTO idx_tab USING
>            ia.IndexSchema, ia.IndexName, ia.IndexPartition;
346,351c1658,1663
<        
<        
<        IF (RID IS NOT NULL) THEN
<          IDX_TAB := IA.INDEXSCHEMA||'.'||IDX_TAB;
<          STMT := ' INSERT INTO ' ||
<                  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(IDX_TAB) || 
---
>        -- insert into the index table
>        /* do this only if rid is not NULL */
>        IF (rid is not NULL) THEN
>          idx_tab := ia.IndexSchema||'.'||idx_tab;
>          stmt := ' INSERT INTO ' ||
>                  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
353c1665
<          EXECUTE IMMEDIATE STMT USING FEATURE_ID, RID;
---
>          EXECUTE IMMEDIATE stmt USING feature_id, rid;
356c1668
<        STMT := ' DELETE  from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
---
>        stmt := ' DELETE  from MDSYS.SDO_TOPO_RELATION_DATA A ' ||
358c1670
<        EXECUTE IMMEDIATE STMT USING FEATURE_L_ID, FEATURE_ID;
---
>        EXECUTE immediate stmt USING feature_L_id, feature_id;
362,364c1674,1676
<       DBMS_OUTPUT.PUT_LINE(SDO_UTIL.NUMBER_TO_CHAR(FEATURE_L_ID));
<       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13121, SYS.DBMS_ASSERT.NOOP(STMT));
<       RETURN SYS.ODCICONST.ERROR;
---
>       dbms_output.put_line(sdo_util.number_to_char(feature_L_id));
>       mderr.raise_md_error('MD', 'SDO', -13121, SYS.DBMS_ASSERT.noop(stmt));
>       RETURN SYS.ODCIConst.Error;
368,371c1680,1683
<       STMT1 := SDO_UTIL.NUMBER_TO_CHAR(CNT) || '::'||IA.INDEXSCHEMA||'::'||TOPOLOGY||
<               '::'||TABLE_NAME||'::'||COLUMN_NAME;
<       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13113, SYS.DBMS_ASSERT.NOOP(STMT1));
<       RETURN SYS.ODCICONST.ERROR;
---
>       stmt1 := sdo_util.number_to_char(cnt) || '::'||ia.IndexSchema||'::'||topology||
>               '::'||table_name||'::'||column_name;
>       mderr.raise_md_error('MD', 'SDO', -13113, SYS.DBMS_ASSERT.noop(stmt1));
>       RETURN SYS.ODCIConst.Error;
374c1686
<     RETURN SYS.ODCICONST.SUCCESS;
---
>     RETURN SYS.ODCIConst.Success;
377,379c1689,1691
<   FUNCTION INDEX_DELETE (IA SYS.ODCIINDEXINFO, RID VARCHAR2,
<                          OLDVAL MDSYS.SDO_TOPO_GEOMETRY,
<                          ENV SYS.ODCIENV)
---
>   FUNCTION index_delete (ia sys.odciindexinfo, rid varchar2,
>                          oldval mdsys.sdo_topo_geometry,
>                          env sys.ODCIEnv)
381,406c1693,1718
<   STMT          VARCHAR2(1000);
<   Q_STMT        VARCHAR2(1000);
<   TOPOLOGY      VARCHAR2(21);
<   TOPOLOGY_IN   VARCHAR2(21);
<   TOPOLOGY_ID   NUMBER;
<   FEATURE_L_ID  NUMBER;
<   FEATURE_ID    NUMBER;
<   IDX_TAB       VARCHAR2(260);
<   TYPE        CURSOR_TYPE IS REF CURSOR;
<   QUERY_CRS   CURSOR_TYPE ;
<   P_TGL_ID    NUMBER;
<   CNT         NUMBER;
<   LAYER_LEVEL NUMBER;
<   ID          NUMBER;
<   STMT_N      VARCHAR2(200);
<   STMT_E      VARCHAR2(200);
<   STMT_F      VARCHAR2(200);
<   WS          VARCHAR2(130);
<   OLD_SP    VARCHAR2(128);
<   OLD_WS     VARCHAR2(128);
<   PARENT_SP VARCHAR2(128) ;
<   PARENT_WS VARCHAR2(128) ;
<   ISVERSIONED NUMBER;
<   IDX_COLUMNS   SYS.ODCICOLINFOLIST;
<   TABLE_NAME VARCHAR2(130);
<   VER_STATUS  VARCHAR2(10);
---
>   stmt          varchar2(1000);
>   q_stmt        varchar2(1000);
>   topology      varchar2(21);
>   topology_in   varchar2(21);
>   topology_id   number;
>   feature_L_id  number;
>   feature_id    number;
>   idx_tab       varchar2(260);
>   type        cursor_type is REF CURSOR;
>   query_crs   cursor_type ;
>   p_tgl_id    number;
>   cnt         number;
>   layer_level number;
>   id          number;
>   stmt_n      varchar2(200);
>   stmt_e      varchar2(200);
>   stmt_f      varchar2(200);
>   WS          varchar2(130);
>   old_sp    varchar2(128);
>   old_ws     varchar2(128);
>   parent_sp varchar2(128) ;
>   parent_ws varchar2(128) ;
>   isVersioned number;
>   idx_columns   SYS.ODCIColInfoList;
>   table_name varchar2(130);
>   ver_status  varchar2(10);
410,411c1722,1723
<     IF (OLDVAL IS NULL) THEN
<         RETURN SYS.ODCICONST.SUCCESS;
---
>     IF (oldval IS NULL) THEN
>         RETURN SYS.ODCIConst.Success;
414,416c1726,1728
<     TOPOLOGY_ID := OLDVAL.TOPOLOGY_ID;
<     FEATURE_L_ID := OLDVAL.TG_LAYER_ID;
<     FEATURE_ID := OLDVAL.TG_ID;
---
>     topology_id := oldval.topology_id;
>     feature_L_id := oldval.tg_layer_id;
>     feature_id := oldval.tg_id;
418c1730
<     STMT := ' select topology from mdsys.user_sdo_topo_info where ' ||
---
>     stmt := ' select topology from mdsys.user_sdo_topo_info where ' ||
420c1732
<     EXECUTE IMMEDIATE STMT INTO TOPOLOGY_IN USING TOPOLOGY_ID, ABS(FEATURE_L_ID);
---
>     EXECUTE IMMEDIATE stmt INTO topology_in USING topology_id, abs(feature_L_id);
423,426c1735,1738
<     TOPOLOGY := SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(TOPOLOGY_IN);
<     
< 
<     EXECUTE IMMEDIATE 
---
>     topology := SYS.DBMS_ASSERT.qualified_sql_name(topology_in);
>     /* lock the old rows from the primitive tables, if the tg_layer_id
>        is a leaf level layer */
>     EXECUTE IMMEDIATE
429c1741
<     INTO LAYER_LEVEL USING TOPOLOGY_ID,  FEATURE_L_ID;     
---
>     INTO layer_level USING topology_id,  feature_l_id;
431,432c1743,1744
<     IF ( FEATURE_L_ID < 0) THEN
<        LAYER_LEVEL := 0;
---
>     IF ( feature_l_id < 0) THEN
>        layer_level := 0;
435c1747
<     IF (LAYER_LEVEL = 0) THEN
---
>     IF (layer_level = 0) THEN
437c1749
<       STMT_N := ' select topo_id from  '||TOPOLOGY||'_RELATION$ '||
---
>       stmt_n := ' select topo_id from  '||topology||'_RELATION$ '||
439c1751
<                 ' and tg_layer_id = :lid '; 
---
>                 ' and tg_layer_id = :lid ';
441c1753
<       STMT_E := ' select abs(topo_id) from  '||TOPOLOGY||'_RELATION$ '||
---
>       stmt_e := ' select abs(topo_id) from  '||topology||'_RELATION$ '||
443c1755
<                 ' and tg_layer_id = :lid '; 
---
>                 ' and tg_layer_id = :lid ';
445c1757
<       STMT_F := ' select topo_id from  '||TOPOLOGY||'_RELATION$ '||
---
>       stmt_f := ' select topo_id from  '||topology||'_RELATION$ '||
449,450c1761,1762
<       STMT := ' select node_id from  '||TOPOLOGY||'_NODE$'  ||
<               ' where node_id in ( ' ||STMT_N|| ') for update ';
---
>       stmt := ' select node_id from  '||topology||'_NODE$'  ||
>               ' where node_id in ( ' ||stmt_n|| ') for update ';
452c1764
<       OPEN QUERY_CRS FOR STMT USING FEATURE_ID, FEATURE_L_ID; 
---
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
455,456c1767,1768
<           FETCH QUERY_CRS INTO ID;
<           EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
459c1771
<       CLOSE QUERY_CRS;
---
>       CLOSE query_crs;
461,462c1773,1774
<       STMT := ' select edge_id from  '||TOPOLOGY||'_EDGE$'  ||
<               ' where edge_id in ( ' ||STMT_E|| ') for update ';
---
>       stmt := ' select edge_id from  '||topology||'_EDGE$'  ||
>               ' where edge_id in ( ' ||stmt_e|| ') for update ';
464c1776
<       OPEN QUERY_CRS FOR STMT USING FEATURE_ID, FEATURE_L_ID; 
---
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
467,468c1779,1780
<           FETCH QUERY_CRS INTO ID;
<           EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
471c1783
<       CLOSE QUERY_CRS;
---
>       CLOSE query_crs;
473,474c1785,1786
<       STMT := ' select face_id from  '||TOPOLOGY||'_FACE$'  ||
<               ' where face_id in ( ' ||STMT_F|| ') for update ';
---
>       stmt := ' select face_id from  '||topology||'_FACE$'  ||
>               ' where face_id in ( ' ||stmt_f|| ') for update ';
476c1788
<       OPEN QUERY_CRS FOR STMT USING FEATURE_ID, FEATURE_L_ID; 
---
>       OPEN query_crs FOR stmt USING feature_id, feature_l_id;
479,480c1791,1792
<           FETCH QUERY_CRS INTO ID;
<           EXIT WHEN QUERY_CRS%NOTFOUND ;
---
>           FETCH query_crs INTO id;
>           EXIT when query_crs%NOTFOUND ;
483c1795
<       CLOSE QUERY_CRS;
---
>       CLOSE query_crs;
487,496c1799,1808
<     
<     
<     IF ( ( (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.ROWMIGRATION) 
<               = SYS.ODCICONST.ROWMIGRATION) AND
<            (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.INDEXKEYCHANGED) 
<               =  SYS.ODCICONST.INDEXKEYCHANGED) ) OR
<          (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.ROWMIGRATION)
<               <> SYS.ODCICONST.ROWMIGRATION) ) THEN
<       IF (RID IS NOT NULL) THEN
<         STMT := 'delete from '||TOPOLOGY||'_relation$ where  ' ||
---
>     -- delete from the <>_Relation$ table the rows for feature
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               =  SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
>       IF (rid is not NULL) THEN
>         stmt := 'delete from '||topology||'_relation$ where  ' ||
498c1810
<         EXECUTE IMMEDIATE STMT USING FEATURE_L_ID,  FEATURE_ID;
---
>         EXECUTE IMMEDIATE stmt USING feature_L_id,  feature_id;
502,505c1814,1817
<     
<     IF (IA.INDEXPARTITION IS NULL ) THEN
<       
<       STMT := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
---
>     -- PARTITION OR NON PARTITION CASE
>     IF (ia.IndexPartition IS NULL ) THEN
>       -- insert the rowid, feature id into the index table
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
508c1820
<       EXECUTE IMMEDIATE STMT INTO IDX_TAB USING IA.INDEXSCHEMA, IA.INDEXNAME;
---
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING ia.IndexSchema, ia.IndexName;
510c1822
<       STMT := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
---
>       stmt := 'select SDO_INDEX_TABLE from mdsys.all_sdo_index_metadata ' ||
514,515c1826,1827
<       EXECUTE IMMEDIATE STMT INTO IDX_TAB USING
<         IA.INDEXSCHEMA, IA.INDEXNAME, IA.INDEXPARTITION;
---
>       EXECUTE IMMEDIATE stmt INTO idx_tab USING
>         ia.IndexSchema, ia.IndexName, ia.IndexPartition;
518,528c1830,1840
<     
< 
< 
< 
<     
<     IF ( ( (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.ROWMIGRATION)
<               = SYS.ODCICONST.ROWMIGRATION) AND
<            (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.INDEXKEYCHANGED)
<               = SYS.ODCICONST.INDEXKEYCHANGED) ) OR
<          (BITAND( ENV.ENVFLAGS, SYS.ODCICONST.ROWMIGRATION)
<               <> SYS.ODCICONST.ROWMIGRATION) ) THEN
---
>     /* see if this tg_is is referred to by any other layer in the relation
>        table for each parent layer that has this layer as the child layer
>        count the rows in relation tables pointing to this tg_id
>        if count > 0 then this violates the hierarchical constraint */
>     -- do  this only if this is not a row migration case
>     IF ( ( (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               = SYS.ODCIConst.RowMigration) AND
>            (bitand( env.EnvFlags, SYS.ODCIConst.IndexKeyChanged)
>               = SYS.ODCIConst.IndexKeyChanged) ) OR
>          (bitand( env.EnvFlags, SYS.ODCIConst.RowMigration)
>               <> SYS.ODCIConst.RowMigration) ) THEN
530,531c1842,1843
<       IF (RID IS NOT NULL) THEN
<         EXECUTE IMMEDIATE 
---
>       IF (rid IS NOT NULL) THEN
>         EXECUTE IMMEDIATE
533,534c1845,1846
<           '(a '||TOPOLOGY||'_REL_LID$ ) */   count(*) ' ||
<           'from mdsys.user_sdo_topo_info b, ' || TOPOLOGY || '_RELATION$ a ' ||
---
>           '(a '||topology||'_REL_LID$ ) */   count(*) ' ||
>           'from mdsys.user_sdo_topo_info b, ' || topology || '_RELATION$ a ' ||
539,541c1851,1853
<         INTO CNT USING OLDVAL.TOPOLOGY_ID, ABS(OLDVAL.TG_LAYER_ID), OLDVAL.TG_ID; 
<         
<         IF (CNT > 0)  THEN 
---
>         INTO cnt USING oldval.topology_id, abs(oldval.tg_layer_id), oldval.tg_id;
> 
>         IF (cnt > 0)  THEN
543,549c1855,1861
<             
<             
<             ISVERSIONED := 0;
<             VER_STATUS := NULL;
<             IDX_COLUMNS := IA.INDEXCOLS;
<             TABLE_NAME := IDX_COLUMNS(1).TABLENAME;
<             TABLE_NAME := SUBSTR(TABLE_NAME, 1, LENGTH(TABLE_NAME)-3);
---
>             /* this is hierarchical case */
>             /* setup the variables for WM check  bug 9206217*/
>             isVersioned := 0;
>             ver_status := NULL;
>             idx_columns := ia.IndexCols;
>             table_name := idx_columns(1).TableName;
>             table_name := substr(table_name, 1, length(table_name)-3);
554,555c1866,1867
<             INTO ISVERSIONED
<             USING IDX_COLUMNS(1).TABLESCHEMA, TABLE_NAME;
---
>             INTO isVersioned
>             USING idx_columns(1).tableschema, table_name;
557c1869
<             IF (ISVERSIONED > 0)  THEN
---
>             IF (isVersioned > 0)  THEN
562c1874
<                 INTO VER_STATUS USING IDX_COLUMNS(1).TABLESCHEMA, TABLE_NAME;
---
>                 INTO ver_status USING idx_columns(1).tableschema, table_name;
564,565c1876,1877
<                 
<                 EXECUTE IMMEDIATE 
---
>                 /* need more checks if this is version enabled topology */
>                 EXECUTE IMMEDIATE
568c1880,1883
<                 INTO OLD_SP;
---
>                 INTO old_sp;
> 
>                 EXECUTE IMMEDIATE
>                   'select wmsys.lt.getworkspace from SYS.DUAL' INTO old_ws;
570,577c1885,1889
<                 EXECUTE IMMEDIATE 
<                   'select wmsys.lt.getworkspace from SYS.DUAL' INTO OLD_WS;
<        
<                 EXECUTE IMMEDIATE
<                   'select parent_workspace, parent_savepoint' || 
<                   ' from sys.all_workspaces' ||
<                   ' where workspace = dbms_wm.getworkspace ' 
<                 INTO PARENT_WS, PARENT_SP;
---
>                 EXECUTE IMMEDIATE
>                   'select parent_workspace, parent_savepoint' ||
>                   ' from wmsys.all_workspaces' ||
>                   ' where workspace = dbms_wm.getworkspace '
>                 INTO parent_ws, parent_sp;
579c1891
<                 IF (PARENT_SP IS NOT NULL) THEN
---
>                 IF (parent_sp IS NOT NULL) THEN
583c1895
<                   USING PARENT_WS, PARENT_SP;
---
>                   USING parent_ws, parent_sp;
586,587c1898,1899
<                 CNT := -1;
<                 EXECUTE IMMEDIATE 'select count(*) from ' || TOPOLOGY ||
---
>                 cnt := -1;
>                 EXECUTE IMMEDIATE 'select count(*) from ' || topology ||
589c1901
<                 INTO CNT USING ABS(FEATURE_L_ID), FEATURE_ID;
---
>                 INTO cnt USING abs(feature_L_id), feature_id;
593,595c1905,1907
<                 USING  OLD_WS;
<        
<                 IF (OLD_SP <> 'LATEST') THEN
---
>                 USING  old_ws;
> 
>                 IF (old_sp <> 'LATEST') THEN
598c1910
<                   USING  OLD_SP;
---
>                   USING  old_sp;
601,602c1913,1914
<                 IF ( (CNT = 0) AND (VER_STATUS <> 'DV') ) THEN
<                   MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
---
>                 IF ( (cnt = 0) AND (ver_status <> 'DV') ) THEN
>                   mderr.raise_md_error('MD', 'SDO', -13199,
604c1916
<                   RETURN SYS.ODCICONST.ERROR;
---
>                   RETURN SYS.ODCIConst.Error;
608,609c1920,1921
<               BEGIN 
<                 MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
---
>               BEGIN
>                 mderr.raise_md_error('MD', 'SDO', -13199,
611c1923
<                 RETURN SYS.ODCICONST.ERROR;
---
>                 RETURN SYS.ODCIConst.Error;
613c1925
<             END IF;  
---
>             END IF;  /* isVersioned */
615,616c1927,1928
<         END IF;  
<       END IF;  
---
>         END IF;  /* cnt > 0 */
>       END IF;  /* RID is not NULL */
619,622c1931,1934
<     
<     IF (RID IS NOT NULL) THEN
<       IDX_TAB := IA.INDEXSCHEMA||'.'||IDX_TAB;
<       STMT := 'DELETE '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(IDX_TAB) || 
---
>     -- delete from the index table
>     IF (rid is not NULL) THEN
>       idx_tab := ia.IndexSchema||'.'||idx_tab;
>       stmt := 'DELETE '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(idx_tab) ||
625c1937
<       EXECUTE IMMEDIATE STMT USING FEATURE_ID, RID;
---
>       EXECUTE IMMEDIATE stmt USING feature_id, rid;
628c1940
<     RETURN SYS.ODCICONST.SUCCESS;
---
>     RETURN SYS.ODCIConst.Success;
631,636c1943,1948
<   FUNCTION ISVERSIONED(TOPOLOGY IN VARCHAR2) RETURN INTEGER IS
<     TOPO_NAME VARCHAR2(130);
<     OWNER VARCHAR2(130);
<     STMT VARCHAR2(200);
<     VERSIONEDTOPOLOGY INTEGER;
<     OWMINSTALLED INTEGER;
---
>   FUNCTION isversioned(topology IN VARCHAR2) return integer IS
>     topo_name varchar2(130);
>     owner varchar2(130);
>     stmt varchar2(200);
>     versionedTopology integer;
>     owmInstalled integer;
638,640c1950,1952
<     MDSYS.SDO_TOPO_METADATA.EXTRACT_TOPO_OWNER(
<       NLS_UPPER(SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(TOPOLOGY)), OWNER,TOPO_NAME);
<     VERSIONEDTOPOLOGY := 0;
---
>     mdsys.SDO_TOPO_METADATA.extract_topo_owner(
>       nls_upper(SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topology)), owner,topo_name);
>     versionedTopology := 0;
642c1954
<     SELECT MDSYS.SDO_OWM_INSTALLED INTO OWMINSTALLED FROM SYS.DUAL;
---
>     SELECT MDSYS.SDO_OWM_INSTALLED INTO owmInstalled FROM SYS.DUAL;
644,645c1956,1957
<     IF ( OWMINSTALLED > 0 ) THEN
<       STMT := '  select count(*) ' ||
---
>     IF ( owmInstalled > 0 ) THEN
>       stmt := '  select count(*) ' ||
648,649c1960,1961
<       EXECUTE IMMEDIATE STMT INTO VERSIONEDTOPOLOGY
<         USING OWNER, SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(TOPO_NAME) || '_NODE$';
---
>       EXECUTE IMMEDIATE stmt INTO versionedTopology
>         USING owner, SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(topo_name) || '_NODE$';
652c1964
<     RETURN VERSIONEDTOPOLOGY;
---
>     RETURN versionedTopology;
655c1967,1968
< END SDO_TPIDX;
---
> END sdo_tpidx;
> 
SYS.AQ$_GET_SUBSCRIBERS - FUNCTION (RU):
22a23
>   sqlrc1         SYS_REFCURSOR;
45c46
<     OPEN sqlrc FOR sel_txt using deq_user, queue_name;
---
>     sqlrc1 := dbms_aq_sub.get_sub_cursor(queue_schema, deq_user, queue_table, queue_name, qtab_flags);
47,48c48,49
<       FETCH sqlrc INTO sub_name, sub_addr, sub_proto,sub_trans, sub_type, sub_rule;
<       EXIT WHEN sqlrc%NOTFOUND;
---
>       FETCH sqlrc1 INTO sub_name, sub_addr, sub_proto,sub_trans, sub_type, sub_rule;
>       EXIT WHEN sqlrc1%NOTFOUND;
51a53
>     CLOSE sqlrc1;
59c61
<                'WHERE queue_id = :1 and '||
---
>                'WHERE queue_id = :1 and ' ||
61a64
> 
74a78
>     CLOSE sqlrc;
83c87,88
<     OPEN sqlrc FOR sel_txt using queue_name;
---
> 
>     sqlrc1 := dbms_aq_sub.get_sub_cursor(queue_schema, deq_user, queue_table, queue_name, qtab_flags);
85,86c90,91
<       FETCH sqlrc INTO sub_name, sub_addr, sub_proto, sub_trans, sub_type, sub_rule;
<       EXIT WHEN sqlrc%NOTFOUND;
---
>       FETCH sqlrc1 INTO sub_name, sub_addr, sub_proto, sub_trans, sub_type, sub_rule;
>       EXIT WHEN sqlrc1%NOTFOUND;
89a95
>      CLOSE sqlrc1;
SYS.DBMS_AQ_INV - PACKAGE (RU):
100c100,101
<       IFJMS           IN BOOLEAN DEFAULT FALSE);
---
>       IFJMS           IN BOOLEAN DEFAULT FALSE,
>       INVOKER         IN VARCHAR2 DEFAULT NULL);
113c114,115
<       PURGE_CONDITION IN VARCHAR2);
---
>       PURGE_CONDITION IN VARCHAR2,
>       INVOKER         IN VARCHAR2 DEFAULT NULL);
SYS.DBMS_AQ_SUB - PACKAGE (RU):
0a1,10
> PACKAGE dbms_aq_sub AUTHID CURRENT_USER AS
> 
>   FUNCTION get_sub_cursor(schema    IN VARCHAR2,
>                           dquser    IN VARCHAR2,
>                           qtname    IN VARCHAR2,
>                           qname     IN VARCHAR2,
>                           qtflags  IN BINARY_INTEGER)
>                                 RETURN SYS_REFCURSOR;
> END dbms_aq_sub;
> 
SYS.DBMS_ASH - PACKAGE (RU):
120c120
<   REPORT_INTERNAL_VERSION CONSTANT VARCHAR2(64) := '42';
---
>   REPORT_INTERNAL_VERSION CONSTANT VARCHAR2(64) := '44';
SYS.DBMS_AUTO_INDEX - PACKAGE (RU):
161c161
<                          the specified retention. Default value is 31 days.
---
>                          the specified retention. Default value is 373 days.
175c175,177
<                          NULL (interpreted as user default tablespace).
---
>                          NULL. By default auto indexes are created in the
>                          default tablespace of the owner of the table for
>                          which the index is being created.
185,188c187,200
<                          'AUTO_INDEX_SPACE_BUDGET' -  Percent of user default
<                          tablespace that can be used for auto index. This is
<                          ignored if 'AUTO_INDEX_DEFAULT_TABLESPACE' has been
<                          set to a valid value. Default value is NULL.
---
>                          'AUTO_INDEX_SPACE_BUDGET' -  Percent of space used
>                          by auto indexes over total space used by all objects
>                          in the tablespace. Default is 50. i.e. Auto indexing
>                          will use up to 50% of the total space used by all
>                          objects in the tablespace. In other words, if X is
>                          the total space consumed by auto indexes and Y is the
>                          total space consumed by all objects including auto
>                          indexes, the ratio (X/Y)*100 should be <= 50. 100 is
>                          a special value. If 100 is specified, auto indexing
>                          will use up all space available in tablespace. This
>                          parameter is ignored if AUTO_INDEX_DEFAULT_TABLESPACE
>                          is specified. if it is specified, auto indexing will
>                          use up all space available in the tablespace specified
>                          by AUTO_INDEX_DEFAULT_TABLESPACE.
251d262
< 
255,258c266,273
<      Drops indexes that are not used for constraints for given (optional)
<      schema and table. If no schema is given, all indexes which the user has
<      priviledges on will be dropped. If no table is given, all indexes within
<      the given schema will be dropped.
---
>      Drops indexes that are not used for constraints for given
>      schema and table.
>      If OWNER is explicitly set to null and TABLE_NAME is explicitly set to
>      null all secondary indexes which the user has privileges on will be
>      dropped.
> 
>      If OWNER is explicitly specified and TABLE_NAME is set to null, all
>      secondary indexes within the given schema will be dropped.
261,262c276,277
<      ownname    -   schema name (IN)
<      tabname    -   table name (IN)
---
>      owner        -   schema name (IN)
>      table_name   -   table name (IN)
273,274c288,326
<   procedure drop_secondary_indexes(ownname varchar2 default null,
<                                    tabname varchar2 default null);
---
>   procedure drop_secondary_indexes(
>     owner      varchar2,
>     table_name varchar2);
> 
>  /*
>     Procedure: drop_auto_indexes
> 
>     Drops indexes created by auto index task.
> 
>     If OWNER is explicitly set to null and INDEX_NAME is explicitly set to null
>     all auto indexes which the user has privileges on will be dropped.
> 
>     If OWNER is explicitly specified and INDEX_NAME is set to null, all auto
>     indexes within the given schema will be dropped. The dropped indexes are
>     not recreated automatically by the system by default.
>     Specify allow_recreate argument 'TRUE' to change this behavior.
> 
>     If the index to be dropped does not exist, the procedure simply mark the
>     index to be allowed to be recreated or not based on allow_recreate param
> 
>     Parameters:
>          owner                  -   name of the owner of the index (IN)
>          index_name             -   index name (IN) - - (NO DEFAULT VALUE)
>          allow_recreate         -   allow/disallow automatic creation of the
>                                     dropped index again (IN)
> 
>     Exceptions:
> 
>         Notes:
> 
>         Examples:
> 
>         Returns:
>           Nothing.
>  */
>  procedure drop_auto_indexes(
>    owner          varchar2,
>    index_name     varchar2,
>    allow_recreate boolean default false);
SYS.DBMS_AUTO_INDEX_INTERNAL - PACKAGE (RU):
86,90d85
<   ERR_INVALID_PARAM_NAME         CONSTANT NUMBER := -38133;
<   ERR_INVALID_PARAM_VALUE        CONSTANT NUMBER := -38134;
< 
<   
<   
545a541,580
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     
>   FUNCTION AUTO_INDEX_ALLOW(OPT_ENV RAW)
>   RETURN NUMBER;
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   PROCEDURE SET_DROPPED_INDEX_STATUS(
>     OWNER             IN DBMS_ID, 
>     INDEX_NAME        IN DBMS_ID, 
>     ALLOW_RECREATE    IN BOOLEAN);
SYS.DBMS_AWR_PROTECTED - PACKAGE (19.4RUR):
2c2,3
< ACCESSIBLE BY (DBMS_AWR_REPORT_LAYOUT, DBMS_SWRF_REPORT_INTERNAL)
---
> ACCESSIBLE BY (PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT, 
>                PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL)
SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.05.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.06.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.05.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.05.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.05.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('19.05.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.06.00.00', 1, fsn - 1));
31c31
<                to_number(substr('19.05.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.06.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.05.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.06.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.05.00.00',  psn + 1));
---
>                              to_number(substr('19.06.00.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.4RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.04.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.04.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.04.01.00', '.');
<   msn  CONSTANT NUMBER := instr('19.04.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.04.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('19.04.02.00', '.');
>   msn  CONSTANT NUMBER := instr('19.04.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('19.04.02.00', '.', msn + 1);
29c29
<                            to_number(substr('19.04.01.00', 1, fsn - 1));
---
>                            to_number(substr('19.04.02.00', 1, fsn - 1));
31c31
<                to_number(substr('19.04.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.04.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.04.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.04.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.04.01.00',  psn + 1));
---
>                              to_number(substr('19.04.02.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.5RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.05.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.05.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.05.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.05.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.05.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('19.05.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.05.01.00', 1, fsn - 1));
31c31
<                to_number(substr('19.05.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.05.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.05.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.05.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.05.00.00',  psn + 1));
---
>                              to_number(substr('19.05.01.00',  psn + 1));
SYS.DBMS_JSON0 - PACKAGE (RU):
24a25
> FUNCTION  GETMAXVCSIZE RETURN NUMBER;
SYS.DBMS_MVIEW_STATS_INTERNAL - PACKAGE (19.4RUR):
2c2
< ACCESSIBLE BY (DBMS_MVIEW_STATS) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_MVIEW_STATS) IS
SYS.DBMS_RCVMAN - PACKAGE (RU):
3715a3716,3732
> -- NOTE: the below 3 functions for listing and retrieving PDBs within
> --       a CDB are only to be called at the auxiliary instance.
> --       Do not call using recovery catalog.
> 
> PROCEDURE listPdbs;
> -- Open cursor for pdbs in a target cdb
> 
> FUNCTION listGetPdb(
>    pdbName  OUT VARCHAR2,
>    pdbId    OUT NUMBER,
>    pdbGuid  OUT VARCHAR2)
> RETURN NUMBER;
> -- Get pdbs for given cdb root
> 
> PROCEDURE endListPdbs;
> -- Close cursor for pdbs in a target cdb
> 
SYS.DBMS_REGISTRY - PACKAGE (19.5RUR):
13c13
<                                '19.5.0.0.0';
---
>                                '19.5.1.0.0';
SYS.DBMS_REGISTRY - PACKAGE (19.4RUR):
13c13
<                                '19.4.1.0.0';
---
>                                '19.4.2.0.0';
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '19.5.0.0.0';
---
>                                '19.6.0.0.0';
SYS.DBMS_SPM_INTERNAL - PACKAGE (RU):
39a40,49
>   
>   
>   SPACE_BUDGET_PERCENT   CONSTANT VARCHAR2(21) := 'SPACE_BUDGET_PERCENT';
>   PLAN_RETENTION_WEEKS   CONSTANT VARCHAR2(21) := 'PLAN_RETENTION_WEEKS';
>   SPM_TRACING            CONSTANT VARCHAR2(12) := 'SPM_TRACING';
> 
>   
>   SPACE_BUDGET_PERCENT_DEFAULT   CONSTANT NUMBER := 10;
>   PLAN_RETENTION_WEEKS_DEFAULT   CONSTANT NUMBER := 53;
>   SPM_TRACING_DEFAULT            CONSTANT NUMBER := 0;
65a76,77
>   
>   
423d434
< 
436c447,450
<   PROCEDURE LOAD_AUTO_EVOLVE_TASK_CONFIG;
---
>   
>   
>   
>   PROCEDURE LOAD_SPM_SMB_CONFIG;
SYS.DBMS_SYNC_REFRESH_INTERNAL - PACKAGE (19.4RUR):
2c2
< ACCESSIBLE BY (DBMS_SYNC_REFRESH) IS
---
> ACCESSIBLE BY (PACKAGE DBMS_SYNC_REFRESH) IS
SYS.DBMS_UMF_PROTECTED - PACKAGE (19.4RUR):
2,5c2,5
<   ACCESSIBLE BY (DBMS_WORKLOAD_REPOSITORY
<                 ,DBMS_SWRF_REPORT_INTERNAL
<                 ,DBMS_AWR_REPORT_LAYOUT
<                 ,DBMS_ASH_INTERNAL) AS
---
>   ACCESSIBLE BY (PACKAGE SYS.DBMS_WORKLOAD_REPOSITORY
>                 ,PACKAGE SYS.DBMS_SWRF_REPORT_INTERNAL
>                 ,PACKAGE SYS.DBMS_AWR_REPORT_LAYOUT
>                 ,PACKAGE SYS.DBMS_ASH_INTERNAL) AS
SYS.DBMS_AQADM_INV - PACKAGE BODY (RU):
11c11
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
44a45,106
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE ,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE , 
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER ,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
526c588
<     IGNORE_DDL_DML_ERROR IN     BOOLEAN DEFAULT FALSE)
---
>     IGNORE_DDL_DML_ERROR IN     BOOLEAN  DEFAULT FALSE)
707,768d768
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
SYS.DBMS_AQADM_SYS - PACKAGE BODY (RU):
56c56
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
107a108,199
>   SCH_JOB_NOT_SCHEDULED  EXCEPTION;
>   PRAGMA                 EXCEPTION_INIT(SCH_JOB_NOT_SCHEDULED, -27476);
> 
>   INDEX_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INDEX_DOES_NOT_EXIST, -1418);
> 
>   NAME_IN_USE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(NAME_IN_USE, -955);
> 
>   INVALID_COLUMN EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INVALID_COLUMN, -904);
> 
>   COLUMN_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COLUMN_EXISTS, -1430);
> 
>   PRIMARY_KEY_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(PRIMARY_KEY_EXISTS, -2260);
> 
>   COMPILE_ERROR  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COMPILE_ERROR, -24344);
> 
>   SEQUENCE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(SEQUENCE_DOES_NOT_EXIST, -2289);
> 
>   INSUFFICIENT_PRIVILEGE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INSUFFICIENT_PRIVILEGE, -1031);
> 
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL 
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
> 
>   
>   
108a201,328
>   PROCEDURE EXECUTE_STMT_IN_KERNEL_CURSOR(
>               SQL_STMT        IN VARCHAR2,
>               IGNORE_DDL      IN BOOLEAN DEFAULT TRUE,
>               OPCODE          IN NUMBER  DEFAULT NULL,
>               BYPASS_DV       IN BOOLEAN DEFAULT TRUE,
>               BYPASS_AUDIT    IN BOOLEAN DEFAULT TRUE,
>               IN_STR_ARRAY    IN STR_ARRAY_TYPE DEFAULT NULL,
>               IN_STRPOS_ARRAY IN NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY    IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_NUMPOS_ARRAY IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_RAW_PARAM1   IN RAW DEFAULT NULL,
>               IN_RAW_PARAM2   IN RAW DEFAULT NULL,
>               IN_TIME_PARAM1  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL) IS
> 
>   OUT_STR_ARR    STR_ARRAY_TYPE;
>   OUT_NUM_ARR    NUM_ARRAY_TYPE;
>   OUT_RAW_PRM1   RAW(32737);
>   OUT_RAW_PRM2   RAW(32737);
>   OUT_BINT_PRM1  BINARY_INTEGER;
>   OUT_BINT_PRM2  BINARY_INTEGER;
>   OUT_INT_PRM1   PLS_INTEGER;
>   OUT_INT_PRM2   PLS_INTEGER;
>   OUT_TIME_PRM1  TIMESTAMP WITH TIME ZONE;
>   OUT_TIME_PRM2  TIMESTAMP WITH TIME ZONE;
>   BEGIN
>     AQ_INTERNAL_EXESTMT(
>                 SQL_STMT       =>      SQL_STMT,
>                 OPCODE         =>      OPCODE,
>                 BYPASS_DV      =>      BYPASS_DV,
>                 BYPASS_AUDIT   =>      BYPASS_AUDIT,
>                 IN_STR_ARRAY   =>      IN_STR_ARRAY,
>                 IN_STRPOS_ARRAY=>      IN_STRPOS_ARRAY,
>                 IN_NUM_ARRAY   =>      IN_NUM_ARRAY,
>                 IN_NUMPOS_ARRAY=>      IN_NUMPOS_ARRAY,
>                 IN_RAW_PARAM1  =>      IN_RAW_PARAM1,
>                 IN_RAW_PARAM2  =>      IN_RAW_PARAM2,
>                 IN_TIME_PARAM1 =>      IN_TIME_PARAM1,
>                 IN_TIME_PARAM2 =>      IN_TIME_PARAM2,
>                 OUT_STR_ARRAY  =>      OUT_STR_ARR,
>                 OUT_STRPOS_ARRAY=>     NULL,
>                 OUT_NUM_ARRAY  =>      OUT_NUM_ARR,
>                 OUT_NUMPOS_ARRAY=>     NULL,
>                 IN_BINT_PARAM1 =>      NULL,
>                 IN_BINT_PARAM2 =>      NULL,
>                 IN_INT_PARAM1  =>      NULL,
>                 IN_INT_PARAM2  =>      NULL,
>                 OUT_RAW_PARAM1 =>      OUT_RAW_PRM1,
>                 OUT_RAW_PARAM2 =>      OUT_RAW_PRM2,
>                 OUT_BINT_PARAM1=>      OUT_BINT_PRM1,
>                 OUT_BINT_PARAM2=>      OUT_BINT_PRM2,
>                 OUT_INT_PARAM1 =>      OUT_INT_PRM1,
>                 OUT_INT_PARAM2 =>      OUT_INT_PRM2,
>                 OUT_TIME_PARAM1=>      OUT_TIME_PRM1,
>                 OUT_TIME_PARAM2=>      OUT_TIME_PRM1);
>   EXCEPTION  
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (IGNORE_DDL = FALSE) THEN
>         RAISE;
>       END IF;
>   END;
> 
>   
>   
>   
>   
>   PROCEDURE EXECUTE_STMTCUSR(
>     STMT                 IN     VARCHAR2,
>     CURRENT_USER         IN     VARCHAR2 DEFAULT NULL,
>     IGNORE_DDL_DML_ERROR IN     BOOLEAN  DEFAULT FALSE,
>     BYPASS_DV            IN     BOOLEAN  DEFAULT TRUE)
>   IS
>     DUMMY          VARCHAR2(32767); 
>     STREAMS_CAPTURE_OFF BOOLEAN;
>   BEGIN
>     STREAMS_CAPTURE_OFF := DBMS_AQADM_SYSCALLS.KWQA_3GL_ISSTREAMSCAPTUREOFF;
>     
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(TRUE);
>     END IF;
> 
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmtCusr: '|| STMT,
>                 EVENT_LEVEL => DBMS_AQADM_SYS.TRACE_FLAG_AQ_DEBUG);
> 
>     IF (CURRENT_USER IS NOT NULL) THEN
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SQL_STMT => STMT, OPCODE => 256, BYPASS_DV => BYPASS_DV,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(CURRENT_USER));
>     ELSE
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
>     END IF;
> 
>     
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>     END IF;
>   EXCEPTION
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>         RAISE;
>       ELSE
>         DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       END IF;
>     WHEN NO_DATA_FOUND THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>        RAISE;
>       ELSE
>       DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       END IF;
>    WHEN OBJECT_ALREADY_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>         RAISE;
>       END IF;
>    WHEN OTHERS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       RAISE;
>   END;
139a360,385
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
164a411,420
>     OUT_STR_ARR  STR_ARRAY_TYPE;
>     OUT_NUM_ARR  NUM_ARRAY_TYPE;
>     OUT_RAW1     RAW(32737);
>     OUT_RAW2     RAW(32737);
>     OUT_BINT1    BINARY_INTEGER;
>     OUT_BINT2    BINARY_INTEGER;
>     OUT_INT1     PLS_INTEGER;
>     OUT_INT2     PLS_INTEGER;
>     TM1          TIMESTAMP WITH TIME ZONE;
>     TM2          TIMESTAMP WITH TIME ZONE;
167c423,432
<     KWQA_3GL_EXECUTESTMTBNDDFN(STMT, NULL, NULL, 0, 0, OUTVAR);
---
>     OUT_STR_ARR := STR_ARRAY_TYPE();
>     OUT_STR_ARR.EXTEND(1);
>     AQ_INTERNAL_EXESTMT(SQL_STMT => STMT, OUT_STR_ARRAY => OUT_STR_ARR,
>                         OUT_NUM_ARRAY => OUT_NUM_ARR, OUT_RAW_PARAM1 => OUT_RAW1,
>                         OUT_RAW_PARAM2 => OUT_RAW2, OUT_BINT_PARAM1 => OUT_BINT1,
>                         OUT_BINT_PARAM2 => OUT_BINT2, OUT_INT_PARAM1 => OUT_INT1,
>                         OUT_INT_PARAM2 => OUT_INT2, OUT_TIME_PARAM1 => TM1,
>                         OUT_TIME_PARAM2 => TM2);
> 
>     OUTVAR := OUT_STR_ARR(1);
252c517,605
<  
---
> 
> 
>   
>   
>   
>   
>   
>   
>   
> 
>   PROCEDURE EXECUTE_STMT3(STMT                   IN  VARCHAR2,
>                           IGNORE_DDL_ERROR       IN  BOOLEAN DEFAULT FALSE,
>                           IGNORE_COMPERR         IN  BOOLEAN DEFAULT FALSE) IS
> 
>   STREAMS_CAPTURE_OFF BOOLEAN;
> 
>   BEGIN
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmt2: '|| STMT);
>     STREAMS_CAPTURE_OFF := DBMS_AQADM_SYSCALLS.KWQA_3GL_ISSTREAMSCAPTUREOFF;
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(TRUE);
>     END IF;
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>     END IF;
>   EXCEPTION
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INDEX_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN NAME_IN_USE THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INVALID_COLUMN THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN COLUMN_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN PRIMARY_KEY_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
> WHEN COMPILE_ERROR THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_COMPERR THEN
>         RAISE;
>       END IF;
>     WHEN SEQUENCE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN OTHERS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       RAISE;
>   END;
724c1077
<      DBMS_AQADM_INV.EXECUTE_STMT2(
---
>      EXECUTE_STMT3(
729c1082
<      DBMS_AQADM_INV.EXECUTE_STMT2(
---
>      EXECUTE_STMT3(
733c1086
<      DBMS_AQADM_INV.EXECUTE_STMT2(
---
>      EXECUTE_STMT3(
737c1090
<      DBMS_AQADM_INV.EXECUTE_STMT2(
---
>      EXECUTE_STMT3(
759c1112
<      DBMS_AQADM_INV.EXECUTE_STMT(' alter table ' ||
---
>      EXECUTE_STMT3(' alter table ' ||
763c1116
<      DBMS_AQADM_INV.EXECUTE_STMT(' alter table ' || 
---
>      EXECUTE_STMT3(' alter table ' || 
767c1120
<      DBMS_AQADM_INV.EXECUTE_STMT(' alter table ' || 
---
>      EXECUTE_STMT3(' alter table ' || 
941,942c1294,1295
<    
<   SQLCURSOR   NUMBER;   
---
>   BNDS        AQ$_BND_ARRAY;
>   CUR         SYS_REFCURSOR; 
947,948d1299
<      SQLCURSOR := DBMS_SQL.OPEN_CURSOR;
< 
953,960d1303
<      DBMS_SYS_SQL.PARSE_AS_USER( SQLCURSOR, ' BEGIN ' ||
<                 'sys.dbms_aqadm.get_type_info@' || 
<                 DBMS_ASSERT.ENQUOTE_NAME(DQT || 
<                   DBMS_ASSERT.QUALIFIED_SQL_NAME(CANON_DEST) || DQT) ||
<                 ' (:schema, :qname, TRUE, :rc, :toid, :version, :tds, :qs, ' ||
<                 ' :ntw); '|| ' END;', DBMS_SQL.V7, USERID);
<      
<      WRITE_TRACE('get_remote_qtype_info_ttc:binding remote get_type info') ;
962,969c1305
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'rc', RC);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'schema', DEST_SCHEMA);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'qname', DEST_QNAME);
<      DBMS_SQL.BIND_VARIABLE_RAW(SQLCURSOR, 'toid', DEST_TOID, 16);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'version', DEST_VERSION);
<      DBMS_SQL.BIND_VARIABLE_RAW(SQLCURSOR, 'tds', DEST_TDS, 32000);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'qs', QUEUE_STYLE, 30);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'ntw', NETWORK_NAME, M_NETWORK_LEN);
---
>      WRITE_TRACE('get_remote_qtype_info_ttc:binding remote get_type info') ;
971c1307,1324
<      WRITE_TRACE('get_remote_qtype_info_ttc:executing remote get_type info') ;
---
>      
>      BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => DEST_SCHEMA),
>                AQ$_BND(STR_VAL => DEST_QNAME),
>                AQ$_BND(NUM_VAL => RC, BMODE => 1),
>                AQ$_BND(RAW_VAL => DEST_TOID, BMODE => 1, SZ => 16),
>                AQ$_BND(NUM_VAL => DEST_VERSION, BMODE => 1),
>                AQ$_BND(RAW_VAL => DEST_TDS, BMODE => 1, SZ => 32000),
>                AQ$_BND(STR_VAL => QUEUE_STYLE, BMODE => 1, SZ => 30),
>                AQ$_BND(STR_VAL => NETWORK_NAME, BMODE => 1, SZ => M_NETWORK_LEN));
>   
>      WRITE_TRACE('get_remote_qtype_info_ttc:executing remote get_type info');
> 
>      CUR := KWQAEXGCUR(' BEGIN ' ||
>               'sys.dbms_aqadm.get_type_info@' ||
>               DBMS_ASSERT.ENQUOTE_NAME(DQT ||
>                 DBMS_ASSERT.QUALIFIED_SQL_NAME(CANON_DEST) || DQT) ||
>               ' (:1, :2, TRUE, :3, :4, :5, :6, :7, ' ||
>               ' :8); '|| ' END;', BNDS, SRC_SCHEMA, FLAGS => 1);
973c1326
<      ROWCOUNT := DBMS_SQL.EXECUTE(SQLCURSOR);
---
>      CLOSE CUR;
977,978c1330
<      DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'rc', RC);
< 
---
>      RC := BNDS(3).NUM_VAL;
982,983c1334,1335
<          DBMS_SQL.VARIABLE_VALUE_RAW(SQLCURSOR, 'toid', DEST_TOID);
<          DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'version', DEST_VERSION);
---
>          DEST_TOID := BNDS(4).RAW_VAL;
>          DEST_VERSION := BNDS(5).NUM_VAL;
985c1337
<             DBMS_SQL.VARIABLE_VALUE_RAW(SQLCURSOR, 'tds', DEST_TDS);
---
>             DEST_TDS := BNDS(6).RAW_VAL;
989,990c1341,1342
<      DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'qs', QUEUE_STYLE);
<      DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'ntw', NETWORK_NAME);
---
>      QUEUE_STYLE := BNDS(7).STR_VAL;
>      NETWORK_NAME := BNDS(8).STR_VAL;
995d1346
<      DBMS_SQL.CLOSE_CURSOR(SQLCURSOR);
997,998c1348,1349
<       IF DBMS_SQL.IS_OPEN(SQLCURSOR) THEN
<          DBMS_SQL.CLOSE_CURSOR(SQLCURSOR);
---
>       IF (CUR%ISOPEN) THEN
>          CLOSE CUR;
1080c1431,1432
<   SQLCURSOR   NUMBER;   
---
>   BNDS        AQ$_BND_ARRAY;
>   CUR         SYS_REFCURSOR; 
1085d1436
<      SQLCURSOR := DBMS_SQL.OPEN_CURSOR;
1087d1437
<      SELECT DBMS_STATS_INTERNAL.GET_USER_NUM(SRC_SCHEMA) INTO USERID FROM DUAL ;
1090,1095c1440
<      DBMS_SYS_SQL.PARSE_AS_USER( SQLCURSOR, ' BEGIN ' ||
<                 'sys.dbms_aqadm.get_type_info@' || 
<                 DBMS_ASSERT.ENQUOTE_NAME(DQT ||
<                   DBMS_ASSERT.QUALIFIED_SQL_NAME(CANON_DEST) || DQT) ||
<                 ' (:schema, :qname, TRUE, :rc, :toid, :version, :tds);' ||
<                 ' END;', DBMS_SQL.V7, USERID);
---
> 
1099,1104c1444,1459
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'rc', RC);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'schema', DEST_SCHEMA);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'qname', DEST_QNAME);
<      DBMS_SQL.BIND_VARIABLE_RAW(SQLCURSOR, 'toid', DEST_TOID, 16);
<      DBMS_SQL.BIND_VARIABLE(SQLCURSOR, 'version', DEST_VERSION);
<      DBMS_SQL.BIND_VARIABLE_RAW(SQLCURSOR, 'tds', DEST_TDS, 32000);
---
>      
>      BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => DEST_SCHEMA),
>                AQ$_BND(STR_VAL => DEST_QNAME),
>                AQ$_BND(NUM_VAL => RC, BMODE => 1),
>                AQ$_BND(RAW_VAL => DEST_TOID, BMODE => 1, SZ => 16),
>                AQ$_BND(NUM_VAL => DEST_VERSION, BMODE => 1),
>                AQ$_BND(RAW_VAL => DEST_TDS, BMODE => 1, SZ => 32000));
>   
>      WRITE_TRACE('get_remote_qtype_info_ttc:executing remote get_type info');
> 
>      CUR := KWQAEXGCUR(' BEGIN ' ||
>               'sys.dbms_aqadm.get_type_info@' ||
>               DBMS_ASSERT.ENQUOTE_NAME(DQT ||
>                 DBMS_ASSERT.QUALIFIED_SQL_NAME(CANON_DEST) || DQT) ||
>               ' (:1, :2, TRUE, :3, :4, :5, :6); ' ||
>               ' END;', BNDS, SRC_SCHEMA, FLAGS => 1);
1106c1461
<      WRITE_TRACE('get_remote_qtype_info_ttc:executing remote get_type info') ;
---
>      CLOSE CUR;
1108,1109d1462
<      ROWCOUNT := DBMS_SQL.EXECUTE(SQLCURSOR);
<     
1112,1113c1465
<      DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'rc', RC);
< 
---
>      RC := BNDS(3).NUM_VAL;
1117,1118c1469,1470
<           DBMS_SQL.VARIABLE_VALUE_RAW(SQLCURSOR, 'toid', DEST_TOID);
<           DBMS_SQL.VARIABLE_VALUE(SQLCURSOR, 'version', DEST_VERSION);
---
>           DEST_TOID := BNDS(4).RAW_VAL;
>           DEST_VERSION := BNDS(5).NUM_VAL;
1120c1472
<             DBMS_SQL.VARIABLE_VALUE_RAW(SQLCURSOR, 'tds', DEST_TDS);
---
>             DEST_TDS := BNDS(6).RAW_VAL;
1124d1475
<      DBMS_SQL.CLOSE_CURSOR(SQLCURSOR);
1127,1128c1478,1479
<       IF DBMS_SQL.IS_OPEN(SQLCURSOR) THEN
<          DBMS_SQL.CLOSE_CURSOR(SQLCURSOR);
---
>       IF (CUR%ISOPEN) THEN
>          CLOSE CUR;
1547c1898
<     DBMS_AQADM_INV.EXECUTE_STMT('CREATE OR REPLACE' || EDITIONABLESTR
---
>     EXECUTE_STMT3('CREATE OR REPLACE' || EDITIONABLESTR
1660c2011
<     DBMS_AQADM_INV.EXECUTE_STMT('CREATE OR REPLACE VIEW '                   || 
---
>     EXECUTE_STMT3('CREATE OR REPLACE VIEW '                   || 
1996c2347
<     DBMS_AQADM_INV.EXECUTE_STMT(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
---
>     EXECUTE_STMT3(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
2225c2576
<     DBMS_AQADM_INV.EXECUTE_STMT(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
---
>     EXECUTE_STMT3(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
2365c2716,2717
<     EXECUTE IMMEDIATE DELSPTXT USING QUEUE;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(DELSPTXT, 
>                                   IN_STR_ARRAY => STR_ARRAY_TYPE(QUEUE)); 
2371,2432d2722
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
2545c2835
<         KWQA_3GL_EXECUTESTMTBNDDFN(DELETE_SQL, Q_NAME, NULL, 1, 0, OUTVAR);
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(DELETE_SQL, IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME));
2602c2892
<       EXECUTE IMMEDIATE SQL_STMT;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SQL_STMT);
2784c3074
<     DBMS_AQADM_INV.EXECUTE_STMTCUSR(TABIND_STMT, CURRENT_USER);
---
>     EXECUTE_STMTCUSR(TABIND_STMT, CURRENT_USER);
2795c3085
<     EXECUTESTMT(SQLSTMT);
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(SQLSTMT);
3090c3380
<     SYS.DBMS_AQADM_INV.EXECUTE_STMT('DROP VIEW SYS.qt' || OBJNO ||
---
>     EXECUTE_STMT3('DROP VIEW SYS.qt' || OBJNO ||
3606c3896
<       DBMS_AQADM_INV.EXECUTE_STMT2('CREATE INDEX ' ||
---
>       EXECUTE_STMT3('CREATE INDEX ' ||
3613c3903
<                    DBMS_ASSERT.ENQUOTE_NAME(TSPACE_NAME, FALSE), FALSE, TRUE);
---
>                    DBMS_ASSERT.ENQUOTE_NAME(TSPACE_NAME, FALSE), FALSE);
3646c3936
<       DBMS_AQADM_INV.EXECUTE_STMT2('CREATE INDEX ' || 
---
>       EXECUTE_STMT3('CREATE INDEX ' || 
3654c3944
<                  || DBMS_ASSERT.ENQUOTE_NAME(TSPACE_NAME, FALSE), FALSE, TRUE); 
---
>                  || DBMS_ASSERT.ENQUOTE_NAME(TSPACE_NAME, FALSE), FALSE); 
4388c4678
<       DBMS_AQADM_INV.EXECUTE_STMTCUSR(CR_Q_TAB_STMT, CURRENT_USER);
---
>       EXECUTE_STMTCUSR(CR_Q_TAB_STMT, CURRENT_USER);
4410c4700
<       EXECUTE IMMEDIATE CR_Q_TABIDX_STMT;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(CR_Q_TABIDX_STMT);
4423c4713
<       EXECUTE IMMEDIATE CR_Q_TABIDX_STMT;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(CR_Q_TABIDX_STMT);
4447c4737
<       DBMS_AQADM_INV.EXECUTE_STMT('CREATE SEQUENCE '                  ||
---
>       EXECUTE_STMT3('CREATE SEQUENCE '                  ||
4537c4827
<  EXECUTE IMMEDIATE ' CREATE TABLE ' ||
---
>  EXECUTE_STMT_IN_KERNEL_CURSOR(' CREATE TABLE ' ||
4553c4843
<                    '  (PARTITION P1 VALUES LESS THAN (1)) ' || STORAGE_CLAUSE;
---
>                    '  (PARTITION P1 VALUES LESS THAN (1)) ' || STORAGE_CLAUSE);
4602c4892
<     SYS.DBMS_AQADM_SYSCALLS.EXECUTE_STMT_IN_KERNEL_CURSOR('DROP TABLE ' ||
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR('DROP TABLE ' ||
4685c4975
<     DBMS_AQADM_INV.EXECUTE_STMTCUSR(CR_DEQLOG_STMT, CURRENT_USER);
---
>     EXECUTE_STMTCUSR(CR_DEQLOG_STMT, CURRENT_USER);
4706c4996,4997
<    EXECUTE IMMEDIATE CR_DEQLOG_IDX_STMT;
---
>    EXECUTE_STMT_IN_KERNEL_CURSOR(CR_DEQLOG_IDX_STMT);
> 
4779c5070
<     DBMS_AQADM_INV.EXECUTE_STMTCUSR(CR_DEQLOG_STMT, CURRENT_USER);
---
>     EXECUTE_STMTCUSR(CR_DEQLOG_STMT, CURRENT_USER);
4799c5090
<    EXECUTE IMMEDIATE CR_DEQLOG_IDX_STMT;
---
>    EXECUTE_STMT_IN_KERNEL_CURSOR(CR_DEQLOG_IDX_STMT);
5020c5311
<     DBMS_AQADM_INV.EXECUTE_STMT(CR_SHIDSEQ_STMT);
---
>     EXECUTE_STMT3(CR_SHIDSEQ_STMT);
5632c5923
<     DBMS_AQADM_INV.EXECUTE_STMT(CR_EX_STMT);
---
>     EXECUTE_STMT3(CR_EX_STMT);
5642c5933
<     DBMS_AQADM_INV.EXECUTE_STMT(CR_EX_STMT);
---
>     EXECUTE_STMT3(CR_EX_STMT);
6530c6821
<         EXECUTE IMMEDIATE DEL_STMT;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(DEL_STMT);
7192c7483
<       DBMS_AQADM_INV.EXECUTE_STMT( 'DROP VIEW ' || 
---
>       EXECUTE_STMT3( 'DROP VIEW ' || 
7289c7580
<         EXECUTE IMMEDIATE 'DROP SEQUENCE ' || 
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR('DROP SEQUENCE ' || 
7291c7582
<                           QT_NAME || '_SEQ';
---
>                           QT_NAME || '_SEQ');
7313c7604
<          SYS.DBMS_AQADM_SYSCALLS.EXECUTE_STMT_IN_KERNEL_CURSOR(DROP_STMT, TRUE);
---
>          EXECUTE_STMT_IN_KERNEL_CURSOR(DROP_STMT, TRUE);
7347c7638
<        SYS.DBMS_AQADM_SYSCALLS.EXECUTE_STMT_IN_KERNEL_CURSOR(DROP_STMT, TRUE);
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(DROP_STMT, TRUE);
7360c7651
<       DBMS_AQADM_INV.EXECUTE_STMT( 'DROP VIEW ' || 
---
>       EXECUTE_STMT3( 'DROP VIEW ' || 
7492c7783
<       DBMS_AQADM_INV.EXECUTE_STMT( 'CREATE TABLE '                   || 
---
>       EXECUTE_STMT3( 'CREATE TABLE '                   || 
7533c7824
<       SYS.DBMS_AQADM_SYSCALLS.EXECUTE_STMT_IN_KERNEL_CURSOR('DROP TABLE ' ||
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR('DROP TABLE ' ||
8060a8352,8353
>     FINDSUB_BNDS    AQ$_BND_ARRAY;
>     FINDSUB_CUR     SYS_REFCURSOR;
8105,8106c8398,8404
< 
<     EXECUTE IMMEDIATE FINDSUB INTO BUFSUBCNT;
---
>  
>     FINDSUB_BNDS := AQ$_BND_ARRAY();
>     FINDSUB_CUR := KWQAEXGCUR(FINDSUB, FINDSUB_BNDS);
>     FETCH FINDSUB_CUR INTO BUFSUBCNT;
>     IF (FINDSUB_CUR%NOTFOUND) THEN
>       RAISE NO_DATA_FOUND;
>     END IF;
8135c8433,8434
<     EXECUTE IMMEDIATE UPDATE_SQL USING Q_NAME;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(UPDATE_SQL,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME));
8144,8145c8443,8444
< 
<     EXECUTE IMMEDIATE DELSPTXT USING Q_NAME;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(DELSPTXT,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME));
8150c8449,8450
<     EXECUTE IMMEDIATE STMT_TXT USING QID;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_TXT,
>       IN_NUM_ARRAY => NUM_ARRAY_TYPE(QID));
10572,10575c10872,10877
<   IOT_CURSOR    INTEGER;                         
<   UPDATE_CURSOR INTEGER;            
<   DELETE_CURSOR INTEGER;                      
<   INSERT_CURSOR INTEGER;           
---
>   IOT_CURSOR    SYS_REFCURSOR;                   
>   IOT_BNDS      AQ$_BND_ARRAY;             
>   UPDATE_CURSOR SYS_REFCURSOR;      
>   UPDATE_BNDS   AQ$_BND_ARRAY;          
>   DELETE_CURSOR SYS_REFCURSOR;                
>   DELETE_BNDS   AQ$_BND_ARRAY;          
10580c10882
<   MSGROWID      ROWID;                      
---
>   MSGROWID      UROWID;                     
10590c10892
<   RID           ROWID;
---
>   RID           UROWID;
10601,10606d10902
<     IOT_CURSOR := DBMS_SQL.OPEN_CURSOR;
< 
<     
<     DELETE_CURSOR := DBMS_SQL.OPEN_CURSOR;
< 
<     
10616,10617c10912,10913
<                 ' WHERE qt.rowid =  msg_rowid and ' || ' msg_qname = :qname' ||
<                 ' and ' || ' appname = :subname' || ' FOR UPDATE ';
---
>                 ' WHERE qt.rowid =  msg_rowid and ' || ' msg_qname = :1' ||
>                 ' and ' || ' appname = :2' || ' FOR UPDATE ';
10621,10630d10916
<     DBMS_SQL.PARSE(IOT_CURSOR, JOIN_TXT, DBMS_SQL.V7);
<     DBMS_SQL.BIND_VARIABLE(IOT_CURSOR, 'qname', Q_NAME);
<     DBMS_SQL.BIND_VARIABLE(IOT_CURSOR, 'subname', SUBNAME);
<     DBMS_SQL.DEFINE_COLUMN_ROWID(IOT_CURSOR, 1, MSGROWID);
<     DBMS_SQL.DEFINE_COLUMN(IOT_CURSOR, 2, MSGREFCNT);
<     DBMS_SQL.DEFINE_COLUMN(IOT_CURSOR, 3, MSGSTATE);
<     
<     
<     DBMS_SQL.DEFINE_COLUMN(IOT_CURSOR, 4, ENQUEUE_TIME);
<     DBMS_SQL.DEFINE_COLUMN(IOT_CURSOR, 5, DELAY);
10633d10918
<     UPDATE_CURSOR := DBMS_SQL.OPEN_CURSOR;
10639c10924
<                  ' WHERE ROWID = :msgrowid ' ;
---
>                  ' WHERE ROWID = :1 ' ;
10642d10926
<     DBMS_SQL.PARSE(UPDATE_CURSOR, UPDATE_TXT, DBMS_SQL.V7);
10648c10932
<                   ' WHERE ROWID = :msgrowid ' ;
---
>                   ' WHERE ROWID = :1 ' ;
10651d10934
<     DBMS_SQL.PARSE(DELETE_CURSOR, DELETE_TXT, DBMS_SQL.V7);
10653d10935
<     IGNORE := DBMS_SQL.EXECUTE(IOT_CURSOR);
10655,10671c10937,10940
<     LOOP                                 
<       IF DBMS_SQL.FETCH_ROWS(IOT_CURSOR) > 0 THEN
<          DBMS_SQL.COLUMN_VALUE(IOT_CURSOR, 1, MSGROWID);              
<          DBMS_SQL.COLUMN_VALUE(IOT_CURSOR, 2, MSGREFCNT);    
<          DBMS_SQL.COLUMN_VALUE(IOT_CURSOR, 3, MSGSTATE);       
<          DBMS_SQL.COLUMN_VALUE(IOT_CURSOR, 4, ENQUEUE_TIME);    
<          DBMS_SQL.COLUMN_VALUE(IOT_CURSOR, 5, DELAY);          
<          WRITE_TRACE('MESSAGE ROWID: ' || MSGROWID, TRACE_EV, TRACE_ONLINESUBOP);
<          WRITE_TRACE('MESSAGE REFERENCE COUNT: ' || MSGREFCNT, TRACE_EV, 
<                       TRACE_ONLINESUBOP);
<          WRITE_TRACE('MESSAGE STATE: ' || MSGSTATE, TRACE_EV, TRACE_ONLINESUBOP);
<          IF MSGREFCNT < 1 OR MSGSTATE > DBMS_AQ.READY THEN  
<             DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(-24020,
<                  'Internal Inconsistency at ROWID: ' || ROWIDTOCHAR(MSGROWID));
<          END IF;
< 
<          MSGREFCNT := MSGREFCNT - 1;          
---
>     
>     IOT_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>                                  AQ$_BND(STR_VAL => SUBNAME));
>     IOT_CURSOR := KWQAEXGCUR(JOIN_TXT, IOT_BNDS);
10673,10696c10942,10951
<          IF (MSGREFCNT = 0) AND (RETENTION = FALSE) THEN
<              DBMS_SQL.BIND_VARIABLE(DELETE_CURSOR, 'msgrowid', MSGROWID);
<              IGNORE := DBMS_SQL.EXECUTE(DELETE_CURSOR);
<          ELSE
<              IF (MSGREFCNT = 0) THEN                  
<                  MSGSTATE := DBMS_AQ.PROCESSED;         
<                 IF (RETENTIONTIME = -1) THEN             
<                     MSGTIMEINFO := NULL;                
<                 ELSE
<                    MSGTIMEINFO := CUR_QT_TIME + NUMTODSINTERVAL(RETENTIONTIME,
<                    'SECOND'); 
<                 END IF;
<              END IF;
<              DBMS_SQL.BIND_VARIABLE(UPDATE_CURSOR, 'msgrefcnt', MSGREFCNT);
<              DBMS_SQL.BIND_VARIABLE(UPDATE_CURSOR, 'msgstate', MSGSTATE);
<              DBMS_SQL.BIND_VARIABLE(UPDATE_CURSOR, 'msgtimeinfo', MSGTIMEINFO);
<              DBMS_SQL.BIND_VARIABLE(UPDATE_CURSOR, 'msgrowid', MSGROWID);
<              IGNORE := DBMS_SQL.EXECUTE(UPDATE_CURSOR);
<              WRITE_TRACE('Update IOT done ', TRACE_EV, TRACE_ONLINESUBOP) ;
<          END IF;                       
< 
<       ELSE                                     
<           DBMS_SQL.CLOSE_CURSOR(UPDATE_CURSOR); 
<           EXIT;                                        
---
>     LOOP                                 
>       FETCH IOT_CURSOR INTO  MSGROWID, MSGREFCNT, MSGSTATE, ENQUEUE_TIME, DELAY;
>       EXIT WHEN IOT_CURSOR%NOTFOUND;
>       WRITE_TRACE('MESSAGE ROWID: ' || MSGROWID, TRACE_EV, TRACE_ONLINESUBOP);
>       WRITE_TRACE('MESSAGE REFERENCE COUNT: ' || MSGREFCNT, TRACE_EV, 
>                    TRACE_ONLINESUBOP);
>       WRITE_TRACE('MESSAGE STATE: ' || MSGSTATE, TRACE_EV, TRACE_ONLINESUBOP);
>       IF MSGREFCNT < 1 OR MSGSTATE > DBMS_AQ.READY THEN  
>          DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(-24020,
>              'Internal Inconsistency at ROWID: ' || MSGROWID);
10697a10953,10977
> 
>       MSGREFCNT := MSGREFCNT - 1;          
> 
>       IF (MSGREFCNT = 0) AND (RETENTION = FALSE) THEN
>         DELETE_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => MSGROWID));
>         DELETE_CURSOR := KWQAEXGCUR(DELETE_TXT, DELETE_BNDS);
>         CLOSE DELETE_CURSOR;
>       ELSE
>         IF (MSGREFCNT = 0) THEN                  
>           MSGSTATE := DBMS_AQ.PROCESSED;         
>           IF (RETENTIONTIME = -1) THEN             
>             MSGTIMEINFO := NULL;                
>           ELSE
>             MSGTIMEINFO := CUR_QT_TIME + NUMTODSINTERVAL(RETENTIONTIME,
>               'SECOND'); 
>           END IF;
>         END IF;
>         UPDATE_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => MSGREFCNT),
>                                        AQ$_BND(NUM_VAL => MSGSTATE),
>                                        AQ$_BND(TM_VAL => MSGTIMEINFO),
>                                        AQ$_BND(UROWID_VAL => MSGROWID));
>         UPDATE_CURSOR := KWQAEXGCUR(UPDATE_TXT, UPDATE_BNDS);
>         WRITE_TRACE('Update IOT done ', TRACE_EV, TRACE_ONLINESUBOP);
>         CLOSE UPDATE_CURSOR;
>       END IF;                       
10704,10705c10984,10985
<                   ' WHERE msg_qname = :qname' || ' and ' ||
<                   ' appname = :subname';
---
>                   ' WHERE msg_qname = :1' || ' and ' ||
>                   ' appname = :2';
10707,10713c10987,10991
<     DBMS_SQL.PARSE(DELETE_CURSOR, DELETE_TXT, DBMS_SQL.V7);
<     DBMS_SQL.BIND_VARIABLE(DELETE_CURSOR, 'qname', Q_NAME);
<     DBMS_SQL.BIND_VARIABLE(DELETE_CURSOR, 'subname', SUBNAME);
<     IGNORE := DBMS_SQL.EXECUTE(DELETE_CURSOR);
<     WRITE_TRACE('Delete IOT done', TRACE_EV, TRACE_ONLINESUBOP) ;
<     DBMS_SQL.CLOSE_CURSOR(IOT_CURSOR);
<     DBMS_SQL.CLOSE_CURSOR(DELETE_CURSOR);
---
>     DELETE_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME), AQ$_BND(STR_VAL => SUBNAME));
>     DELETE_CURSOR := KWQAEXGCUR(DELETE_TXT, DELETE_BNDS);
>     CLOSE DELETE_CURSOR;
>     WRITE_TRACE('Delete IOT done', TRACE_EV, TRACE_ONLINESUBOP);
>     CLOSE IOT_CURSOR;
10781,10782c11059,11060
<         IF DBMS_SQL.IS_OPEN(UPDATE_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(UPDATE_CURSOR);
---
>         IF (UPDATE_CURSOR%ISOPEN) THEN
>           CLOSE UPDATE_CURSOR;
10784,10788c11062,11063
<         IF DBMS_SQL.IS_OPEN(DELETE_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(DELETE_CURSOR);
<         END IF;
<         IF DBMS_SQL.IS_OPEN(INSERT_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(INSERT_CURSOR);
---
>         IF (DELETE_CURSOR%ISOPEN) THEN
>           CLOSE DELETE_CURSOR;
11288c11563,11564
<            END IF; 
---
>            END IF;
> 
11503a11780,11781
>   DEQ_DEL_BNDS        AQ$_BND_ARRAY;
>   DEQ_DEL_CUR         SYS_REFCURSOR;
11508,11510c11786,11796
<          FORALL CT IN 1..SUB_ID.COUNT
<              EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID(CT), ENQUEUE_TIME(CT),
<                      STEP_NO(CT), CHAIN_NO(CT), LOCALORDER_NO(CT), MSGID(CT);
---
>          FOR CT IN 1..SUB_ID.COUNT LOOP
>            DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID(CT)),
>              AQ$_BND(TM_VAL => ENQUEUE_TIME(CT)),
>              AQ$_BND(NUM_VAL => STEP_NO(CT)),
>              AQ$_BND(NUM_VAL => CHAIN_NO(CT)),
>              AQ$_BND(NUM_VAL => LOCALORDER_NO(CT)),
>              AQ$_BND(RAW_VAL =>  MSGID(CT)));
> 
>            DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>            CLOSE DEQ_DEL_CUR;
>           END LOOP;
11514,11516c11800,11809
<          FORALL CT IN 1..SUB_ID.COUNT
<              EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID(CT), MSG_PRTY(CT), 
<                      CHAIN_NO(CT), LOCALORDER_NO(CT), MSGID(CT) ;
---
>          FOR CT IN 1..SUB_ID.COUNT LOOP
>            DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID(CT)),
>              AQ$_BND(NUM_VAL =>  MSG_PRTY(CT)),
>              AQ$_BND(NUM_VAL => CHAIN_NO(CT)),
>              AQ$_BND(NUM_VAL => LOCALORDER_NO(CT)),
>              AQ$_BND(RAW_VAL =>  MSGID(CT)));
> 
>            DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>            CLOSE DEQ_DEL_CUR;
>          END LOOP;
11520,11523c11813,11824
<          FORALL CT IN 1..SUB_ID.COUNT
<              EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID(CT), MSG_PRTY(CT), 
<                      ENQUEUE_TIME(CT), STEP_NO(CT), CHAIN_NO(CT),  
<                      LOCALORDER_NO(CT), MSGID(CT);
---
>          FOR CT IN 1..SUB_ID.COUNT LOOP
>            DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID(CT)),
>              AQ$_BND(NUM_VAL =>  MSG_PRTY(CT)),
>              AQ$_BND(TM_VAL => ENQUEUE_TIME(CT)),
>              AQ$_BND(NUM_VAL => STEP_NO(CT)),
>              AQ$_BND(NUM_VAL => CHAIN_NO(CT)),
>              AQ$_BND(NUM_VAL => LOCALORDER_NO(CT)),
>              AQ$_BND(RAW_VAL =>  MSGID(CT)));
> 
>            DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>            CLOSE DEQ_DEL_CUR;
>          END LOOP;
11527,11530c11828,11839
<          FORALL CT IN 1..SUB_ID.COUNT         
<               EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID(CT), ENQUEUE_TIME(CT),
<                       STEP_NO(CT), MSG_PRTY(CT), CHAIN_NO(CT), LOCALORDER_NO(CT),
<                       MSGID(CT) ;
---
>          FOR CT IN 1..SUB_ID.COUNT  LOOP
>            DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID(CT)),
>              AQ$_BND(TM_VAL => ENQUEUE_TIME(CT)),
>              AQ$_BND(NUM_VAL => STEP_NO(CT)),
>              AQ$_BND(NUM_VAL =>  MSG_PRTY(CT)),
>              AQ$_BND(NUM_VAL => CHAIN_NO(CT)),
>              AQ$_BND(NUM_VAL => LOCALORDER_NO(CT)),
>              AQ$_BND(RAW_VAL =>  MSGID(CT)));
> 
>            DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>            CLOSE DEQ_DEL_CUR;
>          END LOOP;
11534,11536c11843,11852
<          FORALL CT IN 1..SUB_ID.COUNT
<              EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID(CT), STEP_NO(CT), 
<                      CHAIN_NO(CT), LOCALORDER_NO(CT), MSGID(CT);
---
>          FOR CT IN 1..SUB_ID.COUNT LOOP
>            DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID(CT)),
>              AQ$_BND(NUM_VAL => STEP_NO(CT)),
>              AQ$_BND(NUM_VAL => CHAIN_NO(CT)),
>              AQ$_BND(NUM_VAL => LOCALORDER_NO(CT)),
>              AQ$_BND(RAW_VAL =>  MSGID(CT)));
> 
>            DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>            CLOSE DEQ_DEL_CUR;
>          END LOOP;
11572,11574d11887
<   UPDATE_CURSOR INTEGER;            
<   DELETE_CURSOR INTEGER;                      
<   INSERT_CURSOR INTEGER;           
11579a11893,11894
>   UPDATE_BNDS   AQ$_BND_ARRAY;
>   UPDATE_CUR    SYS_REFCURSOR;
11581a11897,11898
>   INSERT_BNDS   AQ$_BND_ARRAY;       
>   INSERT_CUR    SYS_REFCURSOR;      
11582a11900,11901
>   JOIN2_BNDS    AQ$_BND_ARRAY; 
>   JOIN2_CUR     SYS_REFCURSOR; 
11612,11613c11931,11933
<   TYPE RT IS    REF CURSOR;
<   QT_RC         RT;                             
---
> 
>   QT_BNDS       AQ$_BND_ARRAY;
>   QT_CUR        SYS_REFCURSOR;
11768c12088,12089
<             OPEN QT_RC FOR JOIN_TXT USING PROXYID;
---
>             QT_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => PROXYID));
>             QT_CUR := KWQAEXGCUR(JOIN_TXT, QT_BNDS);
11770c12091,12092
<             OPEN QT_RC FOR JOIN_TXT USING SUBID;
---
>             QT_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUBID));
>             QT_CUR := KWQAEXGCUR(JOIN_TXT, QT_BNDS);
11784c12106
<          FETCH QT_RC BULK COLLECT INTO SUB_ID_ARR1, STEP_NO_ARR1, MSG_PRTY_ARR1,
---
>          FETCH QT_CUR BULK COLLECT INTO SUB_ID_ARR1, STEP_NO_ARR1, MSG_PRTY_ARR1,
11786a12109
>          CLOSE QT_CUR;
11798,11800c12121,12130
<             FORALL CNT IN 1..COUNTER
<                 EXECUTE IMMEDIATE UPDATE_TXT 
<                         USING CUR_QT_TIME, MSG_ID_ARR1(CNT), SUBID, '0', ADDRID;
---
>             FOR CNT IN 1..COUNTER
>             LOOP
>               UPDATE_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>                 AQ$_BND(RAW_VAL => MSG_ID_ARR1(CNT)),
>                 AQ$_BND(NUM_VAL => SUBID), AQ$_BND(STR_VAL => '0'),
>                 AQ$_BND(NUM_VAL => ADDRID));
> 
>               UPDATE_CUR := KWQAEXGCUR(UPDATE_TXT, UPDATE_BNDS);
>               CLOSE UPDATE_CUR;
>             END LOOP;
11807,11809c12137,12146
<             FORALL CNT IN 1..COUNTER
<                 EXECUTE IMMEDIATE UPDATE_TXT 
<                         USING CUR_QT_TIME, MSG_ID_ARR1(CNT), SUBID, SUB.NAME, ADDRID;
---
>             FOR CNT IN 1..COUNTER
>             LOOP
>               UPDATE_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>                 AQ$_BND(RAW_VAL => MSG_ID_ARR1(CNT)),
>                 AQ$_BND(NUM_VAL => SUBID), AQ$_BND(STR_VAL => SUB.NAME),
>                 AQ$_BND(NUM_VAL => ADDRID));
> 
>               UPDATE_CUR := KWQAEXGCUR(UPDATE_TXT, UPDATE_BNDS);
>               CLOSE UPDATE_CUR;
>             END LOOP;
11818,11819c12155,12160
<             FORALL CNT IN 1..COUNTER
<                 EXECUTE IMMEDIATE INSERT_TXT USING CUR_QT_TIME, XID, MSG_ID_ARR1(CNT) ;       
---
>             FOR CNT IN 1..COUNTER LOOP
>               INSERT_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>                 AQ$_BND(STR_VAL => XID), AQ$_BND(RAW_VAL =>  MSG_ID_ARR1(CNT)));
>               INSERT_CUR := KWQAEXGCUR(INSERT_TXT, INSERT_BNDS);
>               CLOSE INSERT_CUR;
>             END LOOP;
11828c12169,12174
<                 EXECUTE IMMEDIATE JOIN_TXT2 INTO  SUBCOUNT USING Q_NAME, MSG_ID_ARR1(CNT);
---
>                 JOIN2_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>                   AQ$_BND(RAW_VAL => MSG_ID_ARR1(CNT)));
>                 JOIN2_CUR := KWQAEXGCUR(JOIN_TXT2, JOIN2_BNDS);
>                 FETCH JOIN2_CUR INTO SUBCOUNT;
>                 CLOSE JOIN2_CUR;
>  
11853,11854c12199,12204
<             FORALL CNT IN 1..COUNTED
<                    EXECUTE IMMEDIATE INSERT_TXT USING CUR_QT_TIME, XID, MSG_ID_ARR2(CNT);
---
>             FOR CNT IN 1..COUNTED LOOP
>               INSERT_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>                 AQ$_BND(STR_VAL => XID), AQ$_BND(RAW_VAL =>  MSG_ID_ARR2(CNT)));
>               INSERT_CUR := KWQAEXGCUR(INSERT_TXT, INSERT_BNDS);
>               CLOSE INSERT_CUR; 
>             END LOOP;
11888,11892c12238,12239
<         IF DBMS_SQL.IS_OPEN(UPDATE_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(UPDATE_CURSOR);
<         END IF;
<         IF DBMS_SQL.IS_OPEN(DELETE_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(DELETE_CURSOR);
---
>         IF (UPDATE_CUR%ISOPEN) THEN
>           CLOSE UPDATE_CUR;
11894,11895c12241,12242
<         IF DBMS_SQL.IS_OPEN(INSERT_CURSOR) THEN
<           DBMS_SQL.CLOSE_CURSOR(INSERT_CURSOR);
---
>         IF (INSERT_CUR%ISOPEN) THEN
>           CLOSE INSERT_CUR;
11997a12345,12346
>     STMT_BNDS    AQ$_BND_ARRAY;
>     STMT_CUR     SYS_REFCURSOR;
12035c12384
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
12044c12393,12394
<         EXECUTE IMMEDIATE STMT_BUF;
---
>         STMT_BNDS := AQ$_BND_ARRAY();
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12050c12400,12410
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL =>  MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>       END IF;
>      
>       IF (STMT_CUR%ROWCOUNT = 0) THEN
>         CLOSE STMT_CUR;
>         EXIT;
>       ELSE
>         CLOSE STMT_CUR;
>         COMMIT;
12052,12053d12411
<       EXIT WHEN SQL%ROWCOUNT = 0;
<       COMMIT;
12057c12415,12424
<       EXECUTE IMMEDIATE STMT_BUF INTO MSGIDS(I);
---
> 
>       STMT_BNDS := AQ$_BND_ARRAY();
>       STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>       FETCH STMT_CUR INTO  MSGIDS(I);
>       IF (STMT_CUR%NOTFOUND) THEN
>         CLOSE STMT_CUR;
>         RAISE NO_DATA_FOUND;
>       ELSE
>         CLOSE STMT_CUR;
>       END IF;
12062c12429,12431
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I);
---
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         CLOSE STMT_CUR;
12067c12436,12440
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I-1), MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I-1)),
>           AQ$_BND(RAW_VAL =>  MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         CLOSE STMT_CUR;
12074c12447
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
12085c12458,12461
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         CLOSE STMT_CUR;
12092c12468,12470
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12100c12478,12482
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I-1), MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I-1)),
>           AQ$_BND(RAW_VAL =>  MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         CLOSE STMT_CUR;
12107c12489,12492
<         EXECUTE IMMEDIATE STMT_BUF USING MSGIDS(I-1), MSGIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGIDS(I-1)),
>           AQ$_BND(RAW_VAL =>  MSGIDS(I)));
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12110,12111c12495,12501
<       EXIT WHEN SQL%ROWCOUNT = 0 OR I >= MSGIDS.COUNT;
<       COMMIT;
---
>       IF (STMT_CUR%ROWCOUNT = 0 OR I >= MSGIDS.COUNT) THEN
>         CLOSE STMT_CUR;
>         EXIT;
>       ELSE
>         CLOSE STMT_CUR;
>         COMMIT;
>       END IF;
12116c12506
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
12141c12531
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
12151c12541,12542
<           EXECUTE IMMEDIATE STMT_BUF;
---
>           STMT_BNDS := AQ$_BND_ARRAY();
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12158c12549,12558
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         END IF;
>         IF (STMT_CUR%ROWCOUNT = 0) THEN
>           CLOSE STMT_CUR;
>           EXIT;
>         ELSE
>           CLOSE STMT_CUR;
>           COMMIT;
12160,12161d12559
<         EXIT WHEN SQL%ROWCOUNT = 0;
<         COMMIT;
12165c12563,12567
<         EXECUTE IMMEDIATE STMT_BUF INTO ROWIDS(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY();
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         FETCH STMT_CUR INTO  ROWIDS(I);
>         CLOSE STMT_CUR;
12170c12572,12575
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>           CLOSE STMT_CUR;
12174c12579,12583
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS(I-1), ROWIDS(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS(I-1)),
>             AQ$_BND(UROWID_VAL => ROWIDS(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>           CLOSE STMT_CUR;
12176c12585
<        COMMIT;
---
>         COMMIT;
12181c12590
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
12190c12599,12601
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12197c12608,12618
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS(I-1), ROWIDS(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS(I-1)),
>             AQ$_BND(UROWID_VAL => ROWIDS(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         END IF;
>         IF (STMT_CUR%ROWCOUNT  = 0 OR I >= MSGIDS.COUNT) THEN
>           CLOSE STMT_CUR;
>           EXIT;
>         ELSE
>           CLOSE STMT_CUR;
>           COMMIT;
12199,12200d12619
<         EXIT WHEN SQL%ROWCOUNT = 0 OR I >= MSGIDS.COUNT;
<         COMMIT;
12205c12624
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
12218c12637
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
12228c12647,12648
<           EXECUTE IMMEDIATE STMT_BUF;
---
>           STMT_BNDS := AQ$_BND_ARRAY();
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12235c12655,12664
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS2(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS2(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         END IF;
>         IF (STMT_CUR%ROWCOUNT = 0) THEN
>           CLOSE STMT_CUR;
>           EXIT;
>         ELSE
>           CLOSE STMT_CUR;
>           COMMIT;
12237,12238d12665
<         EXIT WHEN SQL%ROWCOUNT = 0;
<         COMMIT;
12242c12669,12673
<         EXECUTE IMMEDIATE STMT_BUF INTO ROWIDS2(I);
---
> 
>         STMT_BNDS := AQ$_BND_ARRAY();
>         STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         FETCH STMT_CUR INTO  ROWIDS2(I);
>         CLOSE STMT_CUR;
12247c12678,12681
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS2(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS2(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>           CLOSE STMT_CUR;
12251c12685,12689
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS2(I-1), ROWIDS2(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS2(I-1)),
>             AQ$_BND(UROWID_VAL => ROWIDS2(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>           CLOSE STMT_CUR;
12258c12696
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
12267c12705,12707
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS2(I);
---
>           
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS2(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
12274c12714,12724
<           EXECUTE IMMEDIATE STMT_BUF USING ROWIDS2(I-1), ROWIDS2(I);
---
> 
>           STMT_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROWIDS2(I-1)),
>             AQ$_BND(UROWID_VAL => ROWIDS2(I)));
>           STMT_CUR := KWQAEXGCUR(STMT_BUF, STMT_BNDS);
>         END IF;
>         IF (STMT_CUR%ROWCOUNT = 0 OR I >= MSGIDS.COUNT) THEN
>           CLOSE STMT_CUR;
>           EXIT;
>         ELSE
>           CLOSE STMT_CUR;
>           COMMIT;
12276,12277d12725
<         EXIT WHEN SQL%ROWCOUNT = 0 OR I >= MSGIDS.COUNT;
<         COMMIT;
12282c12730
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
13630a14079,14080
>   SEQ_BNDS      AQ$_BND_ARRAY;
>   SEQ_CUR       SYS_REFCURSOR;
13638c14088,14091
<     EXECUTE IMMEDIATE SEQQUERY INTO AGENTNO;
---
>     SEQ_BNDS := AQ$_BND_ARRAY();
>     SEQ_CUR := KWQAEXGCUR(SEQQUERY, SEQ_BNDS);
>     FETCH SEQ_CUR INTO AGENTNO;
>     CLOSE SEQ_CUR;
14921c15374
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  ||
---
>       EXECUTE_STMT3('ALTER TABLE '  ||
14927c15380
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  || 
---
>       EXECUTE_STMT3('ALTER TABLE '  || 
14933c15386
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  || 
---
>       EXECUTE_STMT3('ALTER TABLE '  || 
14939c15392
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  || 
---
>       EXECUTE_STMT3('ALTER TABLE '  || 
14945c15398
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  || 
---
>       EXECUTE_STMT3('ALTER TABLE '  || 
14951c15404
<       DBMS_AQADM_INV.EXECUTE_STMT('ALTER TABLE '  || 
---
>       EXECUTE_STMT3('ALTER TABLE '  || 
15007c15460
<     DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>     EXECUTE_STMT3('truncate table ' ||
15012c15465
<       DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>       EXECUTE_STMT3('truncate table ' ||
15015c15468
<       DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' || 
---
>       EXECUTE_STMT3('truncate table ' || 
15018c15471
<       DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' || 
---
>       EXECUTE_STMT3('truncate table ' || 
15021c15474
<       DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' || 
---
>       EXECUTE_STMT3('truncate table ' || 
15026c15479
<         DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' || 
---
>         EXECUTE_STMT3('truncate table ' || 
15060c15513
<         DBMS_AQADM_INV.EXECUTE_STMT( SQL_STMT );
---
>         EXECUTE_STMT3( SQL_STMT );
15126c15579
<         DBMS_AQADM_INV.EXECUTE_STMT('delete from '||DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)||'.'||DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$_'||QT_NAME||'_L'||DQT)||' partition ('||DBMS_ASSERT.ENQUOTE_NAME(DQT||DQLOG_RC.PARTNAME||DQT)||') where seq_num >= (select q.memory_threshold from system.aq$_queues q, system.aq$_queue_tables t where q.table_objno = t.objno and q.table_objno = '|| TOBJNO ||' )');
---
>         EXECUTE_STMT3('delete from '||DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)||'.'||DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$_'||QT_NAME||'_L'||DQT)||' partition ('||DBMS_ASSERT.ENQUOTE_NAME(DQT||DQLOG_RC.PARTNAME||DQT)||') where seq_num >= (select q.memory_threshold from system.aq$_queues q, system.aq$_queue_tables t where q.table_objno = t.objno and q.table_objno = '|| TOBJNO ||' )');
15134c15587
<   DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>   EXECUTE_STMT3('truncate table ' ||
15144c15597
<   DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>   EXECUTE_STMT3('truncate table ' ||
15219c15672
<     DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>     EXECUTE_STMT3('truncate table ' ||
15225c15678
<       DBMS_AQADM_INV.EXECUTE_STMT('truncate table ' ||
---
>       EXECUTE_STMT3('truncate table ' ||
15324c15777
<    EXECUTE IMMEDIATE SQL_STMT;
---
>    EXECUTE_STMT_IN_KERNEL_CURSOR(SQL_STMT);
15657c16110
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
15667c16120
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
15679c16132
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
15691c16144
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
15704c16157
<       DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>       EXECUTE_STMT3(STMT_BUF);
15743c16196
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
15767c16220
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
15782c16235
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
15797c16250
<     DBMS_AQADM_INV.EXECUTE_STMT(STMT_BUF);
---
>     EXECUTE_STMT3(STMT_BUF);
16016c16469
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
16036c16489
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
16123c16576
<   EXECUTE IMMEDIATE UPDATE_TEXT;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(UPDATE_TEXT);
16152a16606,16607
>   SEL_BNDS     AQ$_BND_ARRAY;
>   SEL_CUR      SYS_REFCURSOR;
16175c16630,16638
<       EXECUTE IMMEDIATE SEL_STMT INTO MSG_CNT ;
---
>       SEL_BNDS := AQ$_BND_ARRAY();
>       SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
>       FETCH SEL_CUR INTO MSG_CNT;
>       IF (SEL_CUR%NOTFOUND) THEN
>         CLOSE SEL_CUR;
>         RAISE NO_DATA_FOUND;
>       ELSE
>         CLOSE SEL_CUR;
>       END IF;
16193c16656,16657
<       EXECUTE IMMEDIATE SEL_STMT;
---
>       SEL_BNDS := AQ$_BND_ARRAY();
>       SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
16207c16671
<     EXECUTE IMMEDIATE COPY_STMT;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(COPY_STMT);
16213c16677
<     EXECUTE IMMEDIATE UPDATE_STMT;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(UPDATE_STMT);
16217c16681
<     EXECUTE IMMEDIATE DEL_STMT;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(DEL_STMT);
16898c17362
<    DBMS_AQADM_INV.EXECUTE_STMT2(
---
>    EXECUTE_STMT3(
SYS.DBMS_AQADM_VAR - PACKAGE BODY (RU):
3c3
< TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
> TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
SYS.DBMS_AQ_INV - PACKAGE BODY (RU):
7a8,20
>   
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
> 
14,17c27,28
<                         IFJMS           IN BOOLEAN DEFAULT FALSE) IS
<   TYPE RT IS    REF CURSOR;
<   QT_RC1              RT;
<   QT_RC2              RT;
---
>                         IFJMS           IN BOOLEAN DEFAULT FALSE,
>                         INVOKER         IN VARCHAR2 DEFAULT NULL) IS
18a30,31
>   SEL1_BNDS           AQ$_BND_ARRAY;
>   SEL1_CUR            SYS_REFCURSOR;
19a33,34
>   SEL2_BNDS           AQ$_BND_ARRAY;
>   SEL2_CUR            SYS_REFCURSOR;
99c114,115
<     OPEN QT_RC1 FOR SEL_STMT1;
---
>     SEL1_BNDS := AQ$_BND_ARRAY();
>     SEL1_CUR := KWQAEXGCUR(SEL_STMT1, SEL1_BNDS, INVOKER);
103c119
<         FETCH QT_RC1  BULK COLLECT INTO
---
>         FETCH SEL1_CUR  BULK COLLECT INTO
136,137c152,153
<           CLOSE QT_RC1;
<           OPEN QT_RC1 FOR SEL_STMT1;
---
>           CLOSE SEL1_CUR;
>           SEL1_CUR := KWQAEXGCUR(SEL_STMT1, SEL1_BNDS);
154c170
<     CLOSE QT_RC1;
---
>     CLOSE SEL1_CUR;
184c200,201
<     OPEN QT_RC2 FOR SEL_STMT2;
---
>     SEL2_BNDS := AQ$_BND_ARRAY();
>     SEL2_CUR := KWQAEXGCUR(SEL_STMT2, SEL2_BNDS, INVOKER);
188c205
<         FETCH QT_RC2  BULK COLLECT INTO
---
>         FETCH SEL2_CUR  BULK COLLECT INTO
229,230c246,247
<           CLOSE QT_RC2;
<           OPEN QT_RC2 FOR SEL_STMT2;
---
>           CLOSE SEL2_CUR;
>           SEL2_CUR := KWQAEXGCUR(SEL_STMT2, SEL2_BNDS);
247c264
<     CLOSE QT_RC2;
---
>     CLOSE SEL2_CUR;
253,254c270,275
<       CLOSE QT_RC1;
<       CLOSE QT_RC2;
---
>       IF (SEL1_CUR%ISOPEN) THEN
>         CLOSE SEL1_CUR;
>       END IF;
>       IF (SEL2_CUR%ISOPEN) THEN
>         CLOSE SEL2_CUR;
>       END IF;
267,268d287
<   TYPE RT IS    REF CURSOR;
<   QT_RC         RT;
269a289,290
>   SEL_BNDS      AQ$_BND_ARRAY;
>   SEL_CUR       SYS_REFCURSOR;
342c363,364
<      OPEN QT_RC FOR SEL_STMT;
---
>      SEL_BNDS := AQ$_BND_ARRAY();
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS, INVOKER);
349c371
<         FETCH QT_RC BULK COLLECT INTO
---
>         FETCH SEL_CUR BULK COLLECT INTO
373a396
>      CLOSE SEL_CUR;
389,390d411
<   TYPE RT IS    REF CURSOR;
<   QT_RC         RT;
391a413,414
>   SEL_BNDS      AQ$_BND_ARRAY;
>   SEL_CUR       SYS_REFCURSOR;
447c470,471
<      OPEN QT_RC FOR SEL_STMT;
---
>      SEL_BNDS := AQ$_BND_ARRAY();
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS, INVOKER);
453c477
<         FETCH QT_RC BULK COLLECT INTO
---
>         FETCH SEL_CUR BULK COLLECT INTO
469a494
>      CLOSE SEL_CUR;
642a668,669
>     DEQ_DEL_BNDS        AQ$_BND_ARRAY;
>     DEQ_DEL_CUR         SYS_REFCURSOR;
643a671,672
>     DEQ_DEL_EXP_BNDS    AQ$_BND_ARRAY;
>     DEQ_DEL_EXP_CUR     SYS_REFCURSOR;
644a674,675
>     QT_DEL_BNDS         AQ$_BND_ARRAY;
>     QT_DEL_CUR          SYS_REFCURSOR;
645a677,678
>     HIS_DEL_BNDS        AQ$_BND_ARRAY;
>     HIS_DEL_CUR         SYS_REFCURSOR;
648a682,683
>     CT_DEL_BNDS         AQ$_BND_ARRAY;
>     CT_DEL_CUR          SYS_REFCURSOR;
685,688c720,730
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID_ARR(I),
<          ENQ_TIME_ARR(I), STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID_ARR(I)),
>            AQ$_BND(TM_VAL => ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
703,706c745,754
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID_ARR(I),
<          MSG_PRTY_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID_ARR(I)),
>            AQ$_BND(NUM_VAL =>  MSG_PRTY_ARR(I)),
>            AQ$_BND(NUM_VAL =>  CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
722,725c770,781
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID_ARR(I),
<          MSG_PRTY_ARR(I), ENQ_TIME_ARR(I), STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID_ARR(I)),
>            AQ$_BND(NUM_VAL => MSG_PRTY_ARR(I)),
>            AQ$_BND(TM_VAL => ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
741,744c797,808
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID_ARR(I),
<          ENQ_TIME_ARR(I), STEP_NO_ARR(I), MSG_PRTY_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID_ARR(I)),
>            AQ$_BND(TM_VAL =>  ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL =>  MSG_PRTY_ARR(I)),
>            AQ$_BND(NUM_VAL =>  CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
759,762c823,832
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING SUB_ID_ARR(I),
<          STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUB_ID_ARR(I)),
>            AQ$_BND(NUM_VAL =>  STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL =>  CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
793,794c863,868
<      FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<        EXECUTE IMMEDIATE HIS_DEL_STMT USING MSG_ID_ARR(I), SUB_ID_ARR(I);
---
>      FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>        HIS_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)),
>          AQ$_BND(NUM_VAL => SUB_ID_ARR(I)));
>        HIS_DEL_CUR := KWQAEXGCUR(HIS_DEL_STMT, HIS_DEL_BNDS);
>        CLOSE HIS_DEL_CUR;
>      END LOOP;
825c899,901
<            EXECUTE IMMEDIATE DEQ_DEL_EXP ;
---
>          DEQ_DEL_EXP_BNDS := AQ$_BND_ARRAY();
>          DEQ_DEL_EXP_CUR := KWQAEXGCUR(DEQ_DEL_EXP, DEQ_DEL_EXP_BNDS);
>          CLOSE DEQ_DEL_EXP_CUR;
827,828c903,908
<          FORALL I IN EXP_ARR.FIRST .. EXP_ARR.LAST
<            EXECUTE IMMEDIATE DEQ_DEL_EXP USING EXP_ARR(I), EXP_ARR(I) ;
---
>          FOR I IN EXP_ARR.FIRST .. EXP_ARR.LAST LOOP
>            DEQ_DEL_EXP_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL =>  EXP_ARR(I)),
>              AQ$_BND(RAW_VAL =>  EXP_ARR(I)));
>             DEQ_DEL_EXP_CUR := KWQAEXGCUR(DEQ_DEL_EXP, DEQ_DEL_EXP_BNDS);
>            CLOSE DEQ_DEL_EXP_CUR;
>          END LOOP;
902c982,985
<              EXECUTE IMMEDIATE CT_DEL_STMT USING IN CT_UPD_ROW_IDS(I);
---
>              CT_DEL_BNDS :=
>                AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL =>  CT_UPD_ROW_IDS(I)));
>              CT_DEL_CUR := KWQAEXGCUR(CT_DEL_STMT, CT_DEL_BNDS);
>              CLOSE CT_DEL_CUR;
924,926c1007,1011
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE QT_DEL_STMT USING
<          MSG_ID_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          QT_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSG_ID_ARR(I)), AQ$_BND(RAW_VAL =>  MSG_ID_ARR(I)));
>          QT_DEL_CUR := KWQAEXGCUR(QT_DEL_STMT, QT_DEL_BNDS);
>          CLOSE QT_DEL_CUR;
>        END LOOP;
949a1035,1036
>     DEQ_DEL_BNDS        AQ$_BND_ARRAY;
>     DEQ_DEL_CUR         SYS_REFCURSOR;
951a1039,1040
>     DEQ_DEL_EXP_BNDS    AQ$_BND_ARRAY;
>     DEQ_DEL_EXP_CUR     SYS_REFCURSOR;
952a1042,1043
>     QT_DEL_BNDS         AQ$_BND_ARRAY;
>     QT_DEL_CUR          SYS_REFCURSOR;
953a1045,1046
>     HIS_DEL_BNDS        AQ$_BND_ARRAY;
>     HIS_DEL_CUR         SYS_REFCURSOR;
956a1050,1051
>     CT_DEL_BNDS         AQ$_BND_ARRAY;
>     CT_DEL_CUR          SYS_REFCURSOR;
993,996c1088,1099
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING NAME_ARR(I), QUE_NUM_ARR(I),
<          ENQ_TIME_ARR(I), STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NAME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  QUE_NUM_ARR(I)),
>            AQ$_BND(TM_VAL => ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
1011,1014c1114,1124
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING NAME_ARR(I), QUE_NUM_ARR(I),
<          MSG_PRTY_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NAME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  QUE_NUM_ARR(I)),
>            AQ$_BND(NUM_VAL => MSG_PRTY_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
1030,1034c1140,1152
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING NAME_ARR(I), QUE_NUM_ARR(I),
<          MSG_PRTY_ARR(I), ENQ_TIME_ARR(I), STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
< 
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NAME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  QUE_NUM_ARR(I)),
>            AQ$_BND(NUM_VAL => MSG_PRTY_ARR(I)),
>            AQ$_BND(TM_VAL => ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
1049,1052c1167,1179
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING NAME_ARR(I), QUE_NUM_ARR(I),
<          ENQ_TIME_ARR(I), STEP_NO_ARR(I), MSG_PRTY_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NAME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  QUE_NUM_ARR(I)),
>            AQ$_BND(TM_VAL => ENQ_TIME_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL =>  MSG_PRTY_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
1067,1070c1194,1204
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE DEQ_DEL_STMT USING NAME_ARR(I), QUE_NUM_ARR(I),
<          STEP_NO_ARR(I), CHAIN_NO_ARR(I),
<          LOCAL_ORDER_NO_ARR(I), MSG_ID_ARR(I);
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          DEQ_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NAME_ARR(I)),
>            AQ$_BND(NUM_VAL =>  QUE_NUM_ARR(I)),
>            AQ$_BND(NUM_VAL => STEP_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => CHAIN_NO_ARR(I)),
>            AQ$_BND(NUM_VAL => LOCAL_ORDER_NO_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
> 
>          DEQ_DEL_CUR := KWQAEXGCUR(DEQ_DEL_STMT, DEQ_DEL_BNDS);
>          CLOSE DEQ_DEL_CUR;
>        END LOOP;
1101,1102c1235,1240
<      FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<        EXECUTE IMMEDIATE HIS_DEL_STMT USING MSG_ID_ARR(I), NAME_ARR(I);
---
>      FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>        HIS_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSG_ID_ARR(I)),
>          AQ$_BND(STR_VAL =>  NAME_ARR(I)));
>        HIS_DEL_CUR := KWQAEXGCUR(HIS_DEL_STMT, HIS_DEL_BNDS);
>        CLOSE HIS_DEL_CUR;
>      END LOOP;
1133c1271,1273
<            EXECUTE IMMEDIATE DEQ_DEL_EXP ;
---
>            DEQ_DEL_EXP_BNDS := AQ$_BND_ARRAY();
>            DEQ_DEL_EXP_CUR := KWQAEXGCUR(DEQ_DEL_EXP, DEQ_DEL_EXP_BNDS);
>            CLOSE DEQ_DEL_EXP_CUR;
1135,1136c1275,1280
<          FORALL I IN EXP_ARR.FIRST .. EXP_ARR.LAST
<            EXECUTE IMMEDIATE DEQ_DEL_EXP USING EXP_ARR(I), EXP_ARR(I);
---
>          FOR I IN EXP_ARR.FIRST .. EXP_ARR.LAST LOOP
>            DEQ_DEL_EXP_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => EXP_ARR(I)),
>              AQ$_BND(RAW_VAL => EXP_ARR(I)));
>            DEQ_DEL_EXP_CUR := KWQAEXGCUR(DEQ_DEL_EXP, DEQ_DEL_EXP_BNDS);
>            CLOSE DEQ_DEL_EXP_CUR;
>          END LOOP;
1210c1354,1357
<              EXECUTE IMMEDIATE CT_DEL_STMT USING IN CT_UPD_ROW_IDS(I);
---
>              CT_DEL_BNDS :=
>                AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL =>  CT_UPD_ROW_IDS(I)));
>              CT_DEL_CUR := KWQAEXGCUR(CT_DEL_STMT, CT_DEL_BNDS);
>              CLOSE CT_DEL_CUR;
1232,1235c1379,1384
<        FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<          EXECUTE IMMEDIATE QT_DEL_STMT USING
<          MSG_ID_ARR(I), MSG_ID_ARR(I);
< 
---
>        FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>          QT_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSG_ID_ARR(I)),
>            AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
>          QT_DEL_CUR := KWQAEXGCUR(QT_DEL_STMT, QT_DEL_BNDS);
>          CLOSE QT_DEL_CUR;
>        END LOOP;
1244c1393,1394
<                                        PURGE_CONDITION IN VARCHAR2) IS
---
>                                        PURGE_CONDITION IN VARCHAR2,
>                                        INVOKER         IN VARCHAR2 DEFAULT NULL) IS
1246,1247d1395
<   TYPE RT IS    REF CURSOR;
<   QT_RC         RT;
1248a1397,1398
>   SEL_BNDS      AQ$_BND_ARRAY;
>   SEL_CUR       SYS_REFCURSOR;
1249a1400,1404
>   QT_DEL_BNDS   AQ$_BND_ARRAY;
>   QT_DEL_CUR    SYS_REFCURSOR;
>   HIST_DEL_STMT VARCHAR2(512);
>   HIST_DEL_BNDS AQ$_BND_ARRAY;
>   HIST_DEL_CUR  SYS_REFCURSOR;
1263c1418,1419
<      OPEN QT_RC FOR SEL_STMT;
---
>      SEL_BNDS := AQ$_BND_ARRAY();
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS, INVOKER);
1268c1424
<         FETCH QT_RC BULK COLLECT INTO
---
>         FETCH SEL_CUR BULK COLLECT INTO
1280,1281c1436,1442
<         FORALL I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST
<           EXECUTE IMMEDIATE QT_DEL_STMT USING MSG_ID_ARR(I);
---
>         FOR I IN MSG_ID_ARR.FIRST .. MSG_ID_ARR.LAST LOOP
>           QT_DEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSG_ID_ARR(I)));
>           QT_DEL_CUR := KWQAEXGCUR(QT_DEL_STMT, QT_DEL_BNDS, INVOKER);
>           CLOSE  QT_DEL_CUR;
>         END LOOP;
> 
>         DBMS_AQADM_SYS.WRITE_TRACE('Deleted Rows from QT: ' || SQL%ROWCOUNT);
1283d1443
<         DBMS_AQADM_SYS.WRITE_TRACE('Deleted Rows: ' || SQL%ROWCOUNT);
1305a1466,1467
>   SEL_BNDS              AQ$_BND_ARRAY;
>   SEL_CUR               SYS_REFCURSOR;
1307a1470,1471
>   TMP_BNDS              AQ$_BND_ARRAY;
>   TMP_CUR               SYS_REFCURSOR;
1309a1474,1476
> 
>      TMP_BNDS := AQ$_BND_ARRAY();
> 
1328c1495,1496
<        EXECUTE IMMEDIATE TMP_STMT;
---
>        TMP_CUR := KWQAEXGCUR(TMP_STMT,  TMP_BNDS, INVOKER);
>        CLOSE TMP_CUR;
1335c1503,1504
<        EXECUTE IMMEDIATE TMP_STMT;
---
>        TMP_CUR := KWQAEXGCUR(TMP_STMT,  TMP_BNDS, INVOKER);
>        CLOSE TMP_CUR;
1342c1511,1512
<        EXECUTE IMMEDIATE TMP_STMT;
---
>        TMP_CUR := KWQAEXGCUR(TMP_STMT,  TMP_BNDS, INVOKER);
>        CLOSE TMP_CUR;
1349c1519,1520
<        EXECUTE IMMEDIATE TMP_STMT;
---
>        TMP_CUR := KWQAEXGCUR(TMP_STMT,  TMP_BNDS, INVOKER);
>        CLOSE TMP_CUR;
1353c1524,1527
<      END IF; 
---
>      END IF;
> 
>      SEL_BNDS := AQ$_BND_ARRAY();
> 
1361c1535,1537
<      EXECUTE IMMEDIATE SEL_STMT INTO TMP_NUM;
---
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS, INVOKER);
>      FETCH SEL_CUR INTO TMP_NUM;
>      CLOSE SEL_CUR;
1375c1551,1552
<         PURGE_PERSISTENT_SCQ_TABLE(QT_SCHEMA, QT_NAME, PURGE_CONDITION);
---
>         PURGE_PERSISTENT_SCQ_TABLE(QT_SCHEMA, QT_NAME, 
>                                    PURGE_CONDITION, INVOKER);
1389c1566
<                                     QT_FLAGS, QT_SORT_COLS, IFJMS);
---
>                                     QT_FLAGS, QT_SORT_COLS, IFJMS, INVOKER);
1440a1618,1619
>     SEL_BNDS      AQ$_BND_ARRAY;
>     SEL_CUR       SYS_REFCURSOR;
1472c1651,1653
<      EXECUTE IMMEDIATE SEL_STMT;
---
>      SEL_BNDS := AQ$_BND_ARRAY();
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
>      CLOSE SEL_CUR;
1483c1664,1665
< 
---
>     SEL_BNDS      AQ$_BND_ARRAY;
>     SEL_CUR       SYS_REFCURSOR;
1514c1696,1698
<      EXECUTE IMMEDIATE SEL_STMT;
---
>      SEL_BNDS := AQ$_BND_ARRAY();
>      SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
>      CLOSE SEL_CUR;
SYS.DBMS_AQ_SUB - PACKAGE BODY (RU):
0a1,57
> PACKAGE BODY dbms_aq_sub AS
> 
>   /*
>    * ICD to execute any aritrary SQL statement inside kernel by bypassing
>    * database vault/audit check. It returns cursor to the executed sql
>    * statement. (Refer to prvtaqds.sql for parameter description)
>    */
>   FUNCTION kwqaexgcur(stmt          IN     VARCHAR2,
>                       bnd_array     IN OUT AQ$_BND_ARRAY,
>                       user          IN     VARCHAR2    DEFAULT NULL,
>                       flags         IN     PLS_INTEGER DEFAULT NULL,
>                       opcode        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   pragma interface(C, kwqaexgcur);
> 
>   FUNCTION get_sub_cursor(schema    IN VARCHAR2,
>                           dquser    IN VARCHAR2,
>                           qtname    IN VARCHAR2,
>                           qname     IN VARCHAR2,
>                           qtflags  IN BINARY_INTEGER)
>                                 RETURN SYS_REFCURSOR IS
>     sel_txt        VARCHAR2(1000);
>     cur            SYS_REFCURSOR;
>     bnd_arr        aq$_bnd_array;
>   BEGIN
>     IF bitand(qtflags, 8) = 0 and bitand(qtflags, 67108864) = 0 THEN
>       RETURN NULL;
>     ELSIF bitand(qtflags, 4096) = 4096 and dquser IS NOT NULL THEN
> 
>       sel_txt := 'select qs.name, qs.address, qs.protocol, qs.trans_name, '
>                  || ' qs.subscriber_type,  qs.rule_name from '
>                  || 'dba_aq_agent_privs dp, '
>                  || dbms_assert.enquote_name('"'|| schema ||'"') || '.'
>                  || dbms_assert.enquote_name('"AQ$_' || qtname  || '_S"')
>                  || ' qs where dp.db_username = :1 and '
>                  || 'dp.agent_name = qs.name and bitand(qs.subscriber_type, 1)=1'
>                  || ' and qs.queue_name = :2';
>       bnd_arr := aq$_bnd_array(aq$_bnd(str_val => dquser), aq$_bnd(str_val => qname));
>       cur := kwqaexgcur(sel_txt, bnd_arr);
>       RETURN cur;
>     ELSIF bitand(qtflags, 67108864) = 67108864 THEN
>       RETURN NULL;
>     ELSE
>       -- 8.1 style normal queue, return all subscribers
>       sel_txt := 'select name, address, protocol, trans_name, ' ||
>                  'subscriber_type, rule_name from ' ||
>                  dbms_assert.enquote_name('"'|| schema ||'"') || '.' ||
>                  dbms_assert.enquote_name('"AQ$_' || qtname || '_S"') ||
>                  ' where ' ||
>                  'bitand(subscriber_type, 1)=1 and queue_name = :1';
>       bnd_arr := aq$_bnd_array(aq$_bnd(str_val => qname));
>       cur := kwqaexgcur(sel_txt, bnd_arr);
>       RETURN cur;
>     END IF;
>   END;
> END;
> 
SYS.DBMS_AQ_SYS_EXP_ACTIONS - PACKAGE BODY (RU):
15c15
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
28a29,30
>   TABLE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
43a46,57
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
> 
46a61,124
>   
> 
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL 
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
47a126,189
>   
>   
>   
>   PROCEDURE EXECUTE_STMT_IN_KERNEL_CURSOR(
>               SQL_STMT        IN VARCHAR2,
>               IGNORE_DDL      IN BOOLEAN DEFAULT TRUE,
>               OPCODE          IN NUMBER  DEFAULT NULL,
>               BYPASS_DV       IN BOOLEAN DEFAULT TRUE,
>               BYPASS_AUDIT    IN BOOLEAN DEFAULT TRUE,
>               IN_STR_ARRAY    IN STR_ARRAY_TYPE DEFAULT NULL,
>               IN_STRPOS_ARRAY IN NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY    IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_NUMPOS_ARRAY IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_RAW_PARAM1   IN RAW DEFAULT NULL,
>               IN_RAW_PARAM2   IN RAW DEFAULT NULL,
>               IN_TIME_PARAM1  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL) IS
> 
>   OUT_STR_ARR    STR_ARRAY_TYPE;
>   OUT_NUM_ARR    NUM_ARRAY_TYPE;
>   OUT_RAW_PRM1   RAW(32737);
>   OUT_RAW_PRM2   RAW(32737);
>   OUT_BINT_PRM1  BINARY_INTEGER;
>   OUT_BINT_PRM2  BINARY_INTEGER;
>   OUT_INT_PRM1   PLS_INTEGER;
>   OUT_INT_PRM2   PLS_INTEGER;
>   OUT_TIME_PRM1  TIMESTAMP WITH TIME ZONE;
>   OUT_TIME_PRM2  TIMESTAMP WITH TIME ZONE;
>   BEGIN
>     AQ_INTERNAL_EXESTMT(
>                 SQL_STMT       =>      SQL_STMT,
>                 OPCODE         =>      OPCODE,
>                 BYPASS_DV      =>      BYPASS_DV,
>                 BYPASS_AUDIT   =>      BYPASS_AUDIT,
>                 IN_STR_ARRAY   =>      IN_STR_ARRAY,
>                 IN_STRPOS_ARRAY=>      IN_STRPOS_ARRAY,
>                 IN_NUM_ARRAY   =>      IN_NUM_ARRAY,
>                 IN_NUMPOS_ARRAY=>      IN_NUMPOS_ARRAY,
>                 IN_RAW_PARAM1  =>      IN_RAW_PARAM1,
>                 IN_RAW_PARAM2  =>      IN_RAW_PARAM2,
>                 IN_TIME_PARAM1 =>      IN_TIME_PARAM1,
>                 IN_TIME_PARAM2 =>      IN_TIME_PARAM2,
>                 OUT_STR_ARRAY  =>      OUT_STR_ARR,
>                 OUT_STRPOS_ARRAY=>     NULL,
>                 OUT_NUM_ARRAY  =>      OUT_NUM_ARR,
>                 OUT_NUMPOS_ARRAY=>     NULL,
>                 IN_BINT_PARAM1 =>      NULL,
>                 IN_BINT_PARAM2 =>      NULL,
>                 IN_INT_PARAM1  =>      NULL,
>                 IN_INT_PARAM2  =>      NULL,
>                 OUT_RAW_PARAM1 =>      OUT_RAW_PRM1,
>                 OUT_RAW_PARAM2 =>      OUT_RAW_PRM2,
>                 OUT_BINT_PARAM1=>      OUT_BINT_PRM1,
>                 OUT_BINT_PARAM2=>      OUT_BINT_PRM2,
>                 OUT_INT_PARAM1 =>      OUT_INT_PRM1,
>                 OUT_INT_PARAM2 =>      OUT_INT_PRM2,
>                 OUT_TIME_PARAM1=>      OUT_TIME_PRM1,
>                 OUT_TIME_PARAM2=>      OUT_TIME_PRM1);
>   EXCEPTION  
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (IGNORE_DDL = FALSE) THEN
>         RAISE;
>       END IF;
>   END;
304a447,448
>   SEQC_BNDS             AQ$_BND_ARRAY;
>   SEQC_CUR              SYS_REFCURSOR;
331c475,478
<     EXECUTE IMMEDIATE SEQCSTMT INTO SEQCURVAL;
---
>     SEQC_BNDS := AQ$_BND_ARRAY();
>     SEQC_CUR := KWQAEXGCUR(SEQCSTMT, SEQC_BNDS);
>     FETCH SEQC_CUR INTO SEQCURVAL;
>     CLOSE SEQC_CUR;
345c492,495
<      EXECUTE IMMEDIATE SEQCSTMT INTO SEQCURVAL;
---
>     SEQC_BNDS := AQ$_BND_ARRAY();
>     SEQC_CUR := KWQAEXGCUR(SEQCSTMT, SEQC_BNDS);
>     FETCH SEQC_CUR INTO SEQCURVAL;
>     CLOSE SEQC_CUR;
355c505,508
<      EXECUTE IMMEDIATE SEQCSTMT INTO SEQCURVAL;
---
>     SEQC_BNDS := AQ$_BND_ARRAY();
>     SEQC_CUR := KWQAEXGCUR(SEQCSTMT, SEQC_BNDS);
>     FETCH SEQC_CUR INTO SEQCURVAL;
>     CLOSE SEQC_CUR;
365c518,521
<      EXECUTE IMMEDIATE SEQCSTMT INTO SEQCURVAL;
---
>     SEQC_BNDS := AQ$_BND_ARRAY();
>     SEQC_CUR := KWQAEXGCUR(SEQCSTMT, SEQC_BNDS);
>     FETCH SEQC_CUR INTO SEQCURVAL;
>     CLOSE SEQC_CUR;
383,445d538
< 
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
SYS.DBMS_AQ_SYS_EXP_INTERNAL - PACKAGE BODY (RU):
42c42
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
SYS.DBMS_AQ_SYS_IMP_INTERNAL - PACKAGE BODY (RU):
3c3
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
5a6,34
>   
>   
>   UNIQUENESS_CONSTRAINT_VIOLATED EXCEPTION;
>   PRAGMA EXCEPTION_INIT(UNIQUENESS_CONSTRAINT_VIOLATED, -1);
> 
>   TABLE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
> 
>   INDEX_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INDEX_DOES_NOT_EXIST, -1418);
> 
>   NAME_IN_USE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(NAME_IN_USE, -955);
> 
>   COLUMN_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COLUMN_EXISTS, -1430);
> 
>   PRIMARY_KEY_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(PRIMARY_KEY_EXISTS, -2260);
> 
>   COMPILE_ERROR  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COMPILE_ERROR, -24344);
> 
>   SEQUENCE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(SEQUENCE_DOES_NOT_EXIST, -2289);
> 
>   OBJECT_ALREADY_EXISTS  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(OBJECT_ALREADY_EXISTS, -955);
> 
8a38,183
>   
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
> 
> 
> 
> 
> 
> 
> 
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL 
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
> 
>   
>   
>   
>   PROCEDURE EXECUTE_STMT_IN_KERNEL_CURSOR(
>               SQL_STMT        IN VARCHAR2,
>               IGNORE_DDL      IN BOOLEAN DEFAULT TRUE,
>               OPCODE          IN NUMBER  DEFAULT NULL,
>               BYPASS_DV       IN BOOLEAN DEFAULT TRUE,
>               BYPASS_AUDIT    IN BOOLEAN DEFAULT TRUE,
>               IN_STR_ARRAY    IN STR_ARRAY_TYPE DEFAULT NULL,
>               IN_STRPOS_ARRAY IN NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY    IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_NUMPOS_ARRAY IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_RAW_PARAM1   IN RAW DEFAULT NULL,
>               IN_RAW_PARAM2   IN RAW DEFAULT NULL,
>               IN_TIME_PARAM1  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL) IS
> 
>   OUT_STR_ARR    STR_ARRAY_TYPE;
>   OUT_NUM_ARR    NUM_ARRAY_TYPE;
>   OUT_RAW_PRM1   RAW(32737);
>   OUT_RAW_PRM2   RAW(32737);
>   OUT_BINT_PRM1  BINARY_INTEGER;
>   OUT_BINT_PRM2  BINARY_INTEGER;
>   OUT_INT_PRM1   PLS_INTEGER;
>   OUT_INT_PRM2   PLS_INTEGER;
>   OUT_TIME_PRM1  TIMESTAMP WITH TIME ZONE;
>   OUT_TIME_PRM2  TIMESTAMP WITH TIME ZONE;
>   BEGIN
>     AQ_INTERNAL_EXESTMT(
>                 SQL_STMT       =>      SQL_STMT,
>                 OPCODE         =>      OPCODE,
>                 BYPASS_DV      =>      BYPASS_DV,
>                 BYPASS_AUDIT   =>      BYPASS_AUDIT,
>                 IN_STR_ARRAY   =>      IN_STR_ARRAY,
>                 IN_STRPOS_ARRAY=>      IN_STRPOS_ARRAY,
>                 IN_NUM_ARRAY   =>      IN_NUM_ARRAY,
>                 IN_NUMPOS_ARRAY=>      IN_NUMPOS_ARRAY,
>                 IN_RAW_PARAM1  =>      IN_RAW_PARAM1,
>                 IN_RAW_PARAM2  =>      IN_RAW_PARAM2,
>                 IN_TIME_PARAM1 =>      IN_TIME_PARAM1,
>                 IN_TIME_PARAM2 =>      IN_TIME_PARAM2,
>                 OUT_STR_ARRAY  =>      OUT_STR_ARR,
>                 OUT_STRPOS_ARRAY=>     NULL,
>                 OUT_NUM_ARRAY  =>      OUT_NUM_ARR,
>                 OUT_NUMPOS_ARRAY=>     NULL,
>                 IN_BINT_PARAM1 =>      NULL,
>                 IN_BINT_PARAM2 =>      NULL,
>                 IN_INT_PARAM1  =>      NULL,
>                 IN_INT_PARAM2  =>      NULL,
>                 OUT_RAW_PARAM1 =>      OUT_RAW_PRM1,
>                 OUT_RAW_PARAM2 =>      OUT_RAW_PRM2,
>                 OUT_BINT_PARAM1=>      OUT_BINT_PRM1,
>                 OUT_BINT_PARAM2=>      OUT_BINT_PRM2,
>                 OUT_INT_PARAM1 =>      OUT_INT_PRM1,
>                 OUT_INT_PARAM2 =>      OUT_INT_PRM2,
>                 OUT_TIME_PARAM1=>      OUT_TIME_PRM1,
>                 OUT_TIME_PARAM2=>      OUT_TIME_PRM1);
>   EXCEPTION  
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (IGNORE_DDL = FALSE) THEN
>         RAISE;
>       END IF;
>   END;
9a185,190
>   
>   
>   
>   
>   
>   
10a192,194
>   PROCEDURE EXECUTE_STMT3(STMT                   IN  VARCHAR2,
>                           IGNORE_DDL_ERROR       IN  BOOLEAN DEFAULT FALSE,
>                           IGNORE_COMPERR         IN  BOOLEAN DEFAULT FALSE) IS
11a196
>   STREAMS_CAPTURE_OFF BOOLEAN;
12a198,270
>   BEGIN
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmt3: '|| STMT);
>     STREAMS_CAPTURE_OFF := DBMS_AQADM_SYSCALLS.KWQA_3GL_ISSTREAMSCAPTUREOFF;
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(TRUE);
>     END IF;
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>     END IF;
>   EXCEPTION
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INDEX_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN NAME_IN_USE THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INVALID_COLUMN THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN COLUMN_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN PRIMARY_KEY_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN COMPILE_ERROR THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_COMPERR THEN
>         RAISE;
>       END IF;
>     WHEN SEQUENCE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN OTHERS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       RAISE;
>   END;
117c375
<         EXECUTE IMMEDIATE NO_CMPRS_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);
143c401
<          DBMS_AQADM_INV.EXECUTE_STMT2(
---
>          EXECUTE_STMT3(
284,285c542,543
<    EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(SCHEMA, FALSE) 
<                      || '.' || DBMS_ASSERT.ENQUOTE_NAME(TABNAME,FALSE);
---
>    EXECUTE_STMT_IN_KERNEL_CURSOR('TRUNCATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(SCHEMA, FALSE) 
>                      || '.' || DBMS_ASSERT.ENQUOTE_NAME(TABNAME,FALSE));
365c623
<            EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>            EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
383c641
<            EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>            EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
423c681
<         EXECUTE IMMEDIATE ALTER_SEQ_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(ALTER_SEQ_SQL);
442c700
<       EXECUTE IMMEDIATE ALTER_SEQ_SQL;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(ALTER_SEQ_SQL);
448c706
<     EXECUTE IMMEDIATE ALTER_SEQ_SQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(ALTER_SEQ_SQL);
596c854
<         EXECUTE IMMEDIATE NO_CMPRS_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);
603c861
<             EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>             EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
607c865
<       DBMS_AQADM_INV.EXECUTE_STMT2(
---
>       EXECUTE_STMT3(
1164,1165d1421
<    TYPE DQLSCURTYP   IS REF CURSOR;
<    DQLS_CV           DQLSCURTYP;  
1171a1428,1429
>    SEL_BNDS  AQ$_BND_ARRAY;
>    SEL_CUR   SYS_REFCURSOR;
1186c1444,1449
<     EXECUTE IMMEDIATE UPD_STMT USING B_QUEUE, QSSCHEMA,QNAME;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_STMT,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(QSSCHEMA, QNAME),
>       IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3),
>       IN_NUM_ARRAY => NUM_ARRAY_TYPE(B_QUEUE),
>       IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1));
> 
1194d1456
<     OPEN DQLS_CV FOR SEL_STMT USING QSSCHEMA, QNAME;
1195a1458,1460
>     SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QSSCHEMA),
>                               AQ$_BND(STR_VAL => QNAME));
>     SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
1197,1198c1462,1463
<       FETCH DQLS_CV INTO QOBJID,SHARD,EXQNAME;
<       EXIT WHEN DQLS_CV%NOTFOUND;
---
>       FETCH SEL_CUR INTO QOBJID,SHARD,EXQNAME;
>       EXIT WHEN SEL_CUR%NOTFOUND;
1215c1480,1481
<         EXECUTE IMMEDIATE DEL_STMT USING EXQNAME,QSSCHEMA,QNAME;    
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(DEL_STMT,
>           IN_STR_ARRAY => STR_ARRAY_TYPE(EXQNAME, QSSCHEMA, QNAME)); 
1219,1221c1485,1490
<     
<     CLOSE DQLS_CV;  
<     OPEN DQLS_CV FOR SEL_STMT USING QSSCHEMA, QNAME;
---
>     CLOSE SEL_CUR;
> 
>     SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QSSCHEMA),
>                               AQ$_BND(STR_VAL => QNAME));
>     SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
> 
1223,1224c1492,1493
<     FETCH DQLS_CV INTO QOBJID,SHARD,EXQNAME;
<     EXIT WHEN DQLS_CV%NOTFOUND;
---
>     FETCH SEL_CUR INTO QOBJID,SHARD,EXQNAME;
>     EXIT WHEN SEL_CUR%NOTFOUND;
1238c1507,1512
<        EXECUTE IMMEDIATE UPD_STMT USING NEWEXQID,B_QUEUE,QSSCHEMA,EXQNAME,QNAME;
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_STMT,
>          IN_STR_ARRAY => STR_ARRAY_TYPE(QSSCHEMA, EXQNAME, QNAME),
>          IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(3, 4, 5),
>          IN_NUM_ARRAY => NUM_ARRAY_TYPE(NEWEXQID, B_QUEUE),
>          IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 2));
> 
1242,1243c1516,1518
<                 || ' where queue= :2'; 
<        EXECUTE IMMEDIATE UPD_STMT USING NEWEXQID,QOBJID;
---
>                 || ' where queue= :2';
>        EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_STMT,
>          IN_NUM_ARRAY => NUM_ARRAY_TYPE(NEWEXQID, QOBJID));
1247c1522
<     CLOSE DQLS_CV;
---
>     CLOSE SEL_CUR;
1262a1538,1539
>  RC_BNDS   AQ$_BND_ARRAY;
>  RC_CUR    SYS_REFCURSOR;
1302c1579
<     EXECUTE IMMEDIATE STMT;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1354c1631
<     EXECUTE IMMEDIATE STMT;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1387c1664
<       DBMS_AQADM_INV.EXECUTE_STMT(ALT_Q_TAB_STMT);
---
>       EXECUTE_STMT3(ALT_Q_TAB_STMT);
1395c1672
<       DBMS_AQADM_INV.EXECUTE_STMT(ALT_Q_TAB_STMT);
---
>       EXECUTE_STMT3(ALT_Q_TAB_STMT);
1404a1682
>       EXECUTE_STMT_IN_KERNEL_CURSOR(CR_Q_TABIDX_STMT);
1406,1407d1683
< 
<       EXECUTE IMMEDIATE CR_Q_TABIDX_STMT;
1411c1687
<     EXECUTE IMMEDIATE STMT;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1421c1697,1702
<    EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>    RC_BNDS := AQ$_BND_ARRAY();
>    RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>    FETCH RC_CUR INTO ROWCNT;
>    CLOSE RC_CUR;
> 
1432c1713
<    EXECUTE IMMEDIATE ADDCLMN;
---
>    EXECUTE_STMT_IN_KERNEL_CURSOR(ADDCLMN);
1450c1731,1733
<   EXECUTE IMMEDIATE STMT USING QSSCHEMA,QNAME;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(STMT,
>     IN_STR_ARRAY => STR_ARRAY_TYPE(QSSCHEMA, QNAME));
> 
1453c1736,1737
<   EXECUTE IMMEDIATE STMT USING QNAME;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(STMT, IN_STR_ARRAY => STR_ARRAY_TYPE(QNAME));
> 
1458c1742,1746
<    EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>    RC_BNDS := AQ$_BND_ARRAY();
>    RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>    FETCH RC_CUR INTO ROWCNT;
>    CLOSE RC_CUR;
1468c1756
<   EXECUTE IMMEDIATE DSTMT;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT);
1476c1764,1768
<   EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>    RC_BNDS := AQ$_BND_ARRAY();
>    RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>    FETCH RC_CUR INTO ROWCNT;
>    CLOSE RC_CUR;
1491c1783,1784
<   EXECUTE IMMEDIATE STMT USING QSSCHEMA, QNAME;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(STMT,
>     IN_STR_ARRAY => STR_ARRAY_TYPE(QSSCHEMA, QNAME));
1495c1788
<   EXECUTE IMMEDIATE STMT USING QNAME;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(STMT, IN_STR_ARRAY => STR_ARRAY_TYPE(QNAME));
1501c1794,1799
<   EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>   RC_BNDS := AQ$_BND_ARRAY();
>   RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>   FETCH RC_CUR INTO ROWCNT;
>   CLOSE RC_CUR;
> 
1511c1809
<   EXECUTE IMMEDIATE DSTMT;
---
>   EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT);
1542c1840
<        EXECUTE IMMEDIATE STMT_BUF;
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
1553c1851
<        EXECUTE IMMEDIATE STMT_BUF;
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
1564c1862
<        EXECUTE IMMEDIATE STMT_BUF;
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
1576c1874
<        EXECUTE IMMEDIATE STMT_BUF;
---
>        EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
1662a1961,1962
>    RC_BNDS     AQ$_BND_ARRAY;
>    RC_CUR      SYS_REFCURSOR;
1690c1990
<           EXECUTE IMMEDIATE STMT;    
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1711c2011
<           EXECUTE IMMEDIATE STMT;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1727c2027,2028
<         EXECUTE IMMEDIATE STMT USING QT_SCHEMA,QT_NAME;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(STMT,
>           IN_STR_ARRAY => STR_ARRAY_TYPE(QT_SCHEMA, QT_NAME));
1731c2032,2034
<         EXECUTE IMMEDIATE DSTMT USING QT_NAME; 
---
> 
>         EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT,
>           IN_STR_ARRAY => STR_ARRAY_TYPE(QT_NAME));
1737c2040,2044
<         EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>           RC_BNDS := AQ$_BND_ARRAY();
>           RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>           FETCH RC_CUR INTO  ROWCNT;
>           CLOSE RC_CUR;
1746c2053,2054
<           EXECUTE IMMEDIATE DSTMT;
---
> 
>           EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT);
1763c2071
<           EXECUTE IMMEDIATE STMT;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1775c2083
<           EXECUTE IMMEDIATE STMT;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1794c2102
<           EXECUTE IMMEDIATE STMT;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
1810c2118,2120
<         EXECUTE IMMEDIATE STMT USING QT_SCHEMA,QT_NAME;
---
> 
>         EXECUTE_STMT_IN_KERNEL_CURSOR(STMT,
>           IN_STR_ARRAY => STR_ARRAY_TYPE(QT_SCHEMA, QT_NAME));
1815c2125,2126
<         EXECUTE IMMEDIATE DSTMT;
---
> 
>         EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT);
1821c2132,2137
<           EXECUTE IMMEDIATE RCSTMT INTO ROWCNT;
---
> 
>           RC_BNDS := AQ$_BND_ARRAY();
>           RC_CUR := KWQAEXGCUR(RCSTMT, RC_BNDS);
>           FETCH RC_CUR INTO  ROWCNT;
>           CLOSE RC_CUR;
> 
1830c2146
<           EXECUTE IMMEDIATE DSTMT;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(DSTMT);
1848a2165
> 
2016a2334,2335
>    SEL_BNDS AQ$_BND_ARRAY;
>    SEL_CUR  SYS_REFCURSOR;
2028c2347,2350
<        EXECUTE IMMEDIATE  UPDSTMT USING EXQNAME, QOBJID;
---
> 
>        EXECUTE_STMT_IN_KERNEL_CURSOR(UPDSTMT,
>          IN_STR_ARRAY => STR_ARRAY_TYPE(EXQNAME),
>          IN_NUM_ARRAY => NUM_ARRAY_TYPE(QOBJID));
2043c2365,2374
<            EXECUTE IMMEDIATE SELSTMT INTO EXQOBJN USING EXQNAME, BASE_Q;
---
>            SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => EXQNAME),
>              AQ$_BND(STR_VAL => BASE_Q));
>            SEL_CUR := KWQAEXGCUR(SELSTMT, SEL_BNDS);
>            FETCH SEL_CUR INTO EXQOBJN;
>            IF (SEL_CUR%NOTFOUND) THEN
>              CLOSE SEL_CUR;
>              RAISE NO_DATA_FOUND;
>            ELSE
>              CLOSE SEL_CUR;
>            END IF;
2051c2382
<            EXECUTE IMMEDIATE INSSTMT;
---
>            EXECUTE_STMT_IN_KERNEL_CURSOR(INSSTMT);
2070c2401
<   CRTTMPT         BOOLEAN;
---
>   CRTTMPT          BOOLEAN;
2072a2404,2406
>   BNDS             AQ$_BND_ARRAY;
>   CUR              SYS_REFCURSOR;
>  
2085c2419,2421
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(STMT_BUF, BNDS);
>       CLOSE CUR;
2098,2099c2434
< 
<     EXECUTE IMMEDIATE STMT_BUF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2103c2438,2439
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
> 
2108c2444,2447
<     EXECUTE IMMEDIATE STMT_BUF USING TABNAME,SCHEMA,OBJNUM;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(TABNAME, SCHEMA),
>       IN_NUM_ARRAY => NUM_ARRAY_TYPE(OBJNUM));
> 
2124c2463,2465
<       EXECUTE IMMEDIATE STMT_BUF USING OBJNUM;
---
> 
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(OBJNUM));
2134c2475,2477
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(STMT_BUF, BNDS);
>       CLOSE CUR;
2151c2494,2495
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
> 
2155c2499
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2164c2508,2510
<       EXECUTE IMMEDIATE STMT_BUF USING TABNAME,SCHEMA,DOBJNUM;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(TABNAME, SCHEMA),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(DOBJNUM));
2178c2524,2525
<       EXECUTE IMMEDIATE STMT_BUF USING DOBJNUM;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(DOBJNUM));
2187c2534,2536
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(STMT_BUF, BNDS);
>       CLOSE CUR;
2199a2549
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2201d2550
<       EXECUTE IMMEDIATE STMT_BUF;
2211c2560,2561
<       EXECUTE IMMEDIATE STMT_BUF USING SCHEMA,NAME;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(SCHEMA, NAME));
2220c2570,2573
<       EXECUTE IMMEDIATE STMT_BUF;
---
> 
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(STMT_BUF, BNDS);
>       CLOSE CUR;
2235,2236c2588,2589
<      
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
> 
2241c2594,2595
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
> 
2250c2604,2607
<       EXECUTE IMMEDIATE STMT_BUF USING NAME, SCHEMA, QOBJID, QOBJID;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(NAME, SCHEMA),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(QOBJID, QOBJID));
> 
2264,2265c2621,2625
<        EXECUTE IMMEDIATE STMT_BUF USING QOBJID, QOBJID;
<        UPDATE_EXCEPTION_META(QOBJID,SCHEMA,TMPTABNAME);
---
> 
>       EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF,
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(QOBJID, QOBJID));
> 
>       UPDATE_EXCEPTION_META(QOBJID,SCHEMA,TMPTABNAME);
2274c2634,2636
<       EXECUTE IMMEDIATE STMT_BUF;
---
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(STMT_BUF, BNDS);
>       CLOSE CUR;
2284c2646
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2290c2652
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2297c2659
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2304c2666
<     EXECUTE IMMEDIATE STMT_BUF;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT_BUF);
2309,2371d2670
< 
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
SYS.DBMS_ASH - PACKAGE BODY (RU):
1397a1398
>     L_DBID  NUMBER;
1412c1413,1417
<     
---
>     L_DBID := CONTEXT.DBID;
>     IF CONTEXT.IS_LOCAL THEN
>       L_DBID := NVL(CONTEXT.LOCAL_CONDBID, CONTEXT.LOCAL_DBID);
>     END IF;
> 
1466c1471
<       USING   CONTEXT.DBID, 
---
>       USING   L_DBID, 
1471c1476
<               CONTEXT.DBID;
---
>               L_DBID;
1517c1522
<       USING   CONTEXT.DBID, 
---
>       USING   L_DBID, 
1521c1526
<               CONTEXT.DBID,
---
>               L_DBID,
1732c1737
<     IF CONTEXT.DISK_COMP_VER >= VER_12 THEN
---
>     IF CONTEXT.IS_CDB_ROOT THEN
1764,1765c1769,1774
<     FROM   base_os_stat s1 FULL OUTER JOIN base_os_stat s2
<            ON (s1.snap_id = s2.snap_id
---
>     FROM   (SELECT snap_id, instance_number, value FROM base_os_stat 
>             WHERE stat_name = 'NUM_CPUS') s1
>         FULL OUTER JOIN
>            (SELECT snap_id, instance_number, value FROM base_os_stat 
>             WHERE stat_name = 'NUM_CPUS_CORES') s2
>            ON (s1.snap_id = s2.snap_id 
1767d1775
<     WHERE  s1.stat_name = 'NUM_CPUS' and s2.stat_name = 'NUM_CPU_CORES'
1785c1793,1797
<     FROM   base_param s1 FULL OUTER JOIN base_param s2
---
>     FROM   (SELECT snap_id, instance_number, value FROM base_param 
>             WHERE parameter_name = 'cpu_count') s1 
>        FULL OUTER JOIN 
>            (SELECT snap_id, instance_number, value FROM base_param 
>             WHERE parameter_name = 'resource_manager_plan') s2
1788,1789d1799
<     WHERE  s1.parameter_name = 'cpu_count' 
<       AND  s2.parameter_name = 'resource_manager_plan'
1813c1823,1824
<               LEAST(MAX(a.num_cpus), SUM(a.cpu_limit)) as cpu_limit
---
>               LEAST(NVL(MAX(a.num_cpus), SUM(a.cpu_limit)), 
>                     SUM(a.cpu_limit)) as cpu_limit
1855c1866
<        OR  value <> p_value
---
>        OR  NVL(value,-1) <> NVL(p_value,-1)
1872,1874c1883,1885
<     USING CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID, CONTEXT.DBID,
<           CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID,
<           CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID;
---
>     USING CONTEXT.DBID, CONTEXT.BEGINSNAPID-1, CONTEXT.ENDSNAPID, CONTEXT.DBID,
>           CONTEXT.DBID, CONTEXT.BEGINSNAPID-1, CONTEXT.ENDSNAPID,
>           CONTEXT.DBID, CONTEXT.BEGINSNAPID-1, CONTEXT.ENDSNAPID;
3754,3768c3765,3797
<       L_TEXT := L_TEXT || 
<         q'[, user_names as
<           (SELECT id, sys.dbms_ash.fetch_user_name(user_id, %con_dbid%,]'
<                  || L_TIME_LIMIT || q'[) as name
<            FROM   map_user_id 
<            WHERE  id <= ]' || L_TOP_LIMIT || q'[
<              AND  user_id >= 0)
<           , user_name_xml as
<           (SELECT 
<                  XMLELEMENT("user_id", XMLAGG( XMLELEMENT("m",
<                               XMLATTRIBUTES( m.id as "i"
<                                            , m.user_id as "v" %con_dbid_attr%
<                                            , n.name as "name" )))) as xml
<               FROM  map_user_id m, user_names n
<               WHERE m.id = n.id(+)) ]';
---
>       IF CONTEXT.IS_CDB_ROOT OR CONTEXT.LOCAL_COMP_VER < VER_12_2 THEN 
>         L_TEXT := L_TEXT || 
>           q'[, user_names as
>             (SELECT id, sys.dbms_ash.fetch_user_name(user_id, %con_dbid%,]'
>                    || L_TIME_LIMIT || q'[) as name
>              FROM   map_user_id 
>              WHERE  id <= ]' || L_TOP_LIMIT || q'[
>                AND  user_id >= 0)
>             , user_name_xml as
>             (SELECT 
>                    XMLELEMENT("user_id", XMLAGG( XMLELEMENT("m",
>                                 XMLATTRIBUTES( m.id as "i"
>                                              , m.user_id as "v" %con_dbid_attr%
>                                              , n.name as "name" )))) as xml
>                 FROM  map_user_id m, user_names n
>                 WHERE m.id = n.id(+)) ]';
>       ELSE
>         L_TEXT := L_TEXT ||
>           q'[, user_names as
>             (SELECT m.id, u.username as name, 
>                     decode(u.common,'YES', 'y', 'n') as common
>              FROM   map_user_id m, dba_users u 
>              WHERE  m.user_id = u.user_id)
>             , user_name_xml as
>             (SELECT 
>                    XMLELEMENT("user_id", XMLAGG( XMLELEMENT("m",
>                                 XMLATTRIBUTES( m.id as "i"
>                                              , m.user_id as "v" %con_dbid_attr%
>                                              , n.name as "name" 
>                                              , n.common as "c" )))) as xml
>                 FROM  map_user_id m, user_names n
>                 WHERE m.id = n.id(+)) ]';
>       END IF;
SYS.DBMS_ASH_INTERNAL - PACKAGE BODY (RU):
2650c2650
<          FROM sys.gv_$sql v
---
>          FROM sys.v_$sql v
2652d2651
<                %join_inst_id_predicate%
2677c2676
<          FROM sys.gv_$sql v
---
>          FROM sys.v_$sql v
2680d2678
<                %join_inst_id_predicate%
2706c2704
<          FROM sys.gv_$sql v
---
>          FROM sys.v_$sql v
2709d2706
<                %join_inst_id_predicate%
3095c3092
<        FROM sys.gv_$active_services v
---
>        FROM sys.v_$active_services v
3097d3093
<              %join_inst_id_predicate%
4579,4589c4575,4592
<              (SELECT ' || COLUMNLIST ||
<                   ', decode(binds.diskEnable,0,1,binds.filterRatio) 
<                        as sample_count
<                    , inst_id as instance_number
<                 FROM sys.gv_$active_session_history a, binds
<                WHERE binds.memEnable = 1
<                  AND (  binds.diskEnable = 0
<                      OR (  binds.diskEnable = 1 
<                        AND a.is_awr_sample = ''Y''
<                        AND bitand(a.flags, 128) = 0 ) )
<                  AND a.inst_id between 
---
>              (SELECT ' || COLUMNLIST || '
>                 , decode(binds.diskEnable,0,1,binds.filterRatio) as sample_count
>                 , userenv(''instance'') AS instance_number
>                 FROM 
>                 table(gv$(cursor(
>                     SELECT ' || COLUMNLIST ||
>                       ', a.is_awr_sample
>                        , a.TIME_MODEL 
>                        , userenv(''instance'') inst_id 
>                     FROM v$active_session_history a
>                     ))) a
>                 , binds 
>                 WHERE binds.memEnable = 1
>                 AND (  binds.diskEnable = 0
>                        OR (  binds.diskEnable = 1 
>                         AND a.is_awr_sample = ''Y''
>                         AND bitand(a.flags, 128) = 0 ) )
>                 AND a.inst_id between 
4592c4595
<                  AND a.sample_time between 
---
>                 AND a.sample_time between 
4594c4597
<                       and binds.endTime
---
>                     and binds.endTime
4598c4601
<                    , instance_number as instance_number
---
>                    , instance_number   as instance_number
4603,4605c4606,4608
<                  AND a.instance_number between 
<                           binds.instIdLow 
<                       and binds.instIdHigh
---
>                  AND a.instance_number between
>                              binds.instIdLow
>                        and binds.instIdHigh
6672,6718c6675,6724
<             instances as
<             (SELECT host_name,
<                     instance_number
<              FROM sys.gv_$instance
<              WHERE instance_number between :inst_id_low and :inst_id_high)
<            , num_cpus as
<             (SELECT i.host_name,
<                     i.instance_number,
<                     sum(decode(o.stat_name, 'NUM_CPU_CORES', o.value, 0)) 
<                     num_cpu_cores,
<                     sum(decode(o.stat_name, 'NUM_CPUS', o.value, 0)) num_cpus
<              FROM instances i, sys.gv_$osstat o
<              WHERE o.inst_id = i.instance_number
<              GROUP BY i.instance_number, i.host_name)
<            , inst_caging_cpu_count as
<             (SELECT i.host_name,
<                     i.instance_number,
<                     max(nvl(to_number(p.value), 0)) 
<                     cpu_count
<              FROM instances i, sys.gv_$system_parameter p,
<                   sys.gv_$rsrc_plan r
<              WHERE p.name= 'cpu_count'
<                AND i.instance_number = p.inst_id 
<                AND r.inst_id = p.inst_id
<                AND r.is_top_plan = 'TRUE'
<                AND r.cpu_managed = 'ON'
<                AND r.instance_caging = 'ON'
<              GROUP BY host_name, instance_number)
<        SELECT xmlelement("cpu_info",
<                  xmlagg(
<                  xmlelement("host",
<                  xmlattributes(host_name as "name", 
<                                max(num_cpus) as "num_cores",
<                                max(num_cpu_cores) as "num_cpus"),
<                  xmlagg(
<                     xmlelement("instance",
<                        xmlattributes(instance_number as "id",
<                                      cpu_count as "cpu_count"))
<                  order by instance_number))))
<                  as xml
<        FROM (SELECT c.host_name, c.instance_number,
<                     nvl(c.num_cpus,c.num_cpu_cores) as num_cpus,
<                     nvl(c.num_cpu_cores, c.num_cpus) as num_cpu_cores,
<                     p.cpu_count
<              FROM  num_cpus c, inst_caging_cpu_count p
<              WHERE p.instance_number(+) = c.instance_number)
<        GROUP BY host_name#';
---
>           num_cpus as (
>             SELECT host_name, instance_number, num_cpu_cores, num_cpus
>             FROM table(gv$(cursor(
>              SELECT host_name, instance_number, 
>               sum(decode(stat_name, 'NUM_CPU_CORES', value, 0)) num_cpu_cores,
>               sum(decode(stat_name, 'NUM_CPUS', value, 0)) num_cpus
>              FROM v$instance, v$osstat o 
>              WHERE instance_number between :inst_id_low and :inst_id_high
>              GROUP BY host_name , instance_number
>            )))
>           ), 
>           inst_caging_cpu_count as (
>             SELECT instance_number,  cpu_count
>             FROM table(gv$(cursor(
>               SELECT userenv('instance') instance_number,  
>                      MAX(NVL(to_number(p.value), 0)) cpu_count
>               FROM v$system_parameter p, v$rsrc_plan r
>               WHERE 
>                 p.name                = 'cpu_count'
>                 AND r.is_top_plan     = 'TRUE'
>                 AND r.cpu_managed     = 'ON'
>                 AND r.instance_caging = 'ON'
>                 AND p.con_id IN (0, SYS_CONTEXT('USERENV','CON_ID')) 
>                 AND r.con_id IN (0, SYS_CONTEXT('USERENV','CON_ID')) 
>                 AND userenv('instance') between :inst_id_low and :inst_id_high
>               GROUP BY userenv('instance')
>            ))) i 
>           )              
>         SELECT xmlelement("cpu_info",
>             xmlagg(
>               xmlelement("host", 
>                 xmlattributes(host_name as "name",
>                               max(num_cpus) as "num_cores",
>                               max(num_cpu_cores) as "num_cpus"                  
>                               ),
>               xmlagg(
>                 xmlelement("instance",
>                    xmlattributes(instance_number as "id",
>                                  cpu_count as "cpu_count"))
>                                  order by instance_number))
>              )) as xml
>         FROM (
>             SELECT c.host_name, c.instance_number,
>                 nvl(c.num_cpus,c.num_cpu_cores) as num_cpus,
>                 nvl(c.num_cpu_cores, c.num_cpus) as num_cpu_cores,
>                 p.cpu_count 
>             FROM  num_cpus c, inst_caging_cpu_count p
>             WHERE p.instance_number(+) = c.instance_number
>             )
>         GROUP BY host_name#';
6723a6730,6731
>         PRINT_BIND('inst_id_low' , CONTEXT.INSTIDLOW, TRUE);
>         PRINT_BIND('inst_id_high', CONTEXT.INSTIDHIGH, TRUE); 
6730c6738
<       USING INSTIDLOW, INSTIDHIGH;
---
>       USING INSTIDLOW, INSTIDHIGH, INSTIDLOW, INSTIDHIGH;
SYS.DBMS_AUTO_INDEX - PACKAGE BODY (RU):
274a275,286
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
360a373,376
> 
> 
> 
> 
362,363c378,379
<     OWNNAME VARCHAR2 DEFAULT NULL,
<     TABNAME VARCHAR2 DEFAULT NULL) IS
---
>     OWNER      VARCHAR2,
>     TABLE_NAME VARCHAR2) IS
365,367c381,383
<     OWNER   DBMS_ID;
<     TABU    DBMS_ID;
<     STMT    VARCHAR2(32767);
---
>     OWNERU   DBMS_ID;
>     TABU     DBMS_ID;
>     STMT     VARCHAR2(32767);
410,411c426,427
<     DBMS_STATS_INTERNAL.UPCASE(OWNNAME, OWNER);
<     DBMS_STATS_INTERNAL.UPCASE(TABNAME, TABU);
---
>     SYS.DBMS_STATS_INTERNAL.UPCASE(OWNER, OWNERU);
>     SYS.DBMS_STATS_INTERNAL.UPCASE(TABLE_NAME, TABU);
415c431
<       IF (OWNER IS NULL) THEN
---
>       IF (OWNERU IS NULL) THEN
418,419c434,435
<         VALIDATE_SCHEMA(OWNER);
<         VALIDATE_TABLE(OWNER, TABU);
---
>         VALIDATE_SCHEMA(OWNERU);
>         VALIDATE_TABLE(OWNERU, TABU);
421,422c437,438
<     ELSIF (OWNER IS NOT NULL) THEN
<       VALIDATE_SCHEMA(OWNER);
---
>     ELSIF (OWNERU IS NOT NULL) THEN
>       VALIDATE_SCHEMA(OWNERU);
425c441
<     FOR CUR IN SEC_INDEX_CUR(OWNER, TABU) LOOP
---
>     FOR CUR IN SEC_INDEX_CUR(OWNERU, TABU) LOOP
433c449
<           IF (DBMS_STATS_INTERNAL.IS_URGENT_ERROR) THEN
---
>           IF (TABU IS NOT NULL OR SYS.DBMS_STATS_INTERNAL.IS_URGENT_ERROR) THEN
440a457,540
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
>   PROCEDURE DROP_AUTO_INDEXES( 
>     OWNER            VARCHAR2, 
>     INDEX_NAME       VARCHAR2, 
>     ALLOW_RECREATE   BOOLEAN DEFAULT FALSE)
>   IS
>     OWNERU    DBMS_ID;
>     INDU      DBMS_ID;
>     STMT      VARCHAR2(32767);
>     
>     CURSOR AUTO_INDEX_CUR(P_OWNER DBMS_ID, P_INDNAME VARCHAR2) IS 
>     SELECT  /*+dynamic_sampling(11)*/ 
>           OWNER, INDEX_NAME
>     FROM  SYS.ALL_INDEXES I
>     WHERE (P_OWNER IS NULL OR OWNER = P_OWNER)
>       AND (P_INDNAME IS NULL OR INDEX_NAME = P_INDNAME)
>       AND AUTO = 'YES';
> 
>   BEGIN
>     SYS.DBMS_STATS_INTERNAL.UPCASE(OWNER, OWNERU);
>     SYS.DBMS_STATS_INTERNAL.UPCASE(INDEX_NAME, INDU);
> 
>     
>     IF (INDU IS NOT NULL) THEN
>       IF (OWNERU IS NULL) THEN
>         RAISE INVALID_SCHEMA_NAME;
>       ELSE
>         VALIDATE_SCHEMA(OWNERU);
>       END IF;
>     ELSIF (OWNERU IS NOT NULL) THEN
>       VALIDATE_SCHEMA(OWNERU);
>     END IF;
> 
>     FOR CUR IN AUTO_INDEX_CUR(OWNERU, INDU) LOOP
> 
>       BEGIN
>         STMT := 'DROP INDEX ' || SYS.DBMS_STATS_INTERNAL.DQ(CUR.OWNER) || '.'
>                  || SYS.DBMS_STATS_INTERNAL.DQ(CUR.INDEX_NAME);
>         EXECUTE IMMEDIATE STMT;
>       EXCEPTION
>         WHEN OTHERS THEN
>           IF (INDU IS NOT NULL OR SYS.DBMS_STATS_INTERNAL.IS_URGENT_ERROR) THEN
>             RAISE;
>           END IF;
>       END;
> 
>     END LOOP;
> 
>     DBMS_AUTO_INDEX_INTERNAL.SET_DROPPED_INDEX_STATUS(
>       SYS.DBMS_STATS_INTERNAL.DQ(OWNERU), SYS.DBMS_STATS_INTERNAL.DQ(INDU),
>       ALLOW_RECREATE); 
>   END DROP_AUTO_INDEXES;
SYS.DBMS_AUTO_INDEX_INTERNAL - PACKAGE BODY (RU):
8a9,18
>   
>   INVALID_INDEX EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INVALID_INDEX, -953);
> 
>   
>   AI_INVALID_ARGUMENT CONSTANT NUMBER         := -28104;
>   
>   
>   ERR_INVALID_PARAM_NAME         CONSTANT NUMBER := -38133;
>   ERR_INVALID_PARAM_VALUE        CONSTANT NUMBER := -38134;
61a72,73
>   AI_INDF_DISRECREATE           CONSTANT NUMBER     := 512;
> 
64c76,77
<   AI_INDF_RETAINED_FLAGS        CONSTANT NUMBER     := AI_INDF_MISESTIMATED;
---
>   AI_INDF_RETAINED_FLAGS        CONSTANT NUMBER     := 
>     AI_INDF_MISESTIMATED + AI_INDF_DISRECREATE;
261c274,275
<   AI_REPORT_RETENTION_DEFAULT   CONSTANT NUMBER := 31;
---
>   
>   AI_REPORT_RETENTION_DEFAULT   CONSTANT NUMBER := 373;
425a440,444
>   AI_OPTIMIZER_ADHOC            CONSTANT NUMBER     := 0;
>   AI_OPTIMIZER_NORMAL           CONSTANT NUMBER     := 1;
>   AI_OPTIMIZER_CRITICAL         CONSTANT NUMBER     := 2;
> 
>   
1748a1768
>     DISALLOW_RECREATE    NUMBER := 0;
1752a1773,1782
>     
>     SELECT COUNT(*) INTO DISALLOW_RECREATE
>     FROM WRI$_ADV_OBJECTS O
>     WHERE O.ID = OBJ_ID 
>       AND BITAND(O.ATTR10, AI_INDF_DISRECREATE) = AI_INDF_DISRECREATE;
> 
>     IF (DISALLOW_RECREATE > 0) THEN
>       DUMP_TRACE(INDEX_NAME || ' is not allowed to be recreated');
>       RETURN OBJ_ID;
>     END IF;  
3348a3379
>     PART_CLIST   VARCHAR2(32767);
3444a3476
>     
3446c3478,3492
<       PROP := BITOR(PROP, AI_KQLDINP_PTI);
---
> 
>       
>       SELECT LISTAGG(DBMS_STATS_INTERNAL.DQ(C.COLUMN_NAME), ',')
>                      WITHIN GROUP (ORDER BY C.COLUMN_POSITION) PART_CLIST
>       INTO PART_CLIST
>       FROM DBA_PART_KEY_COLUMNS C
>       WHERE C.NAME = TAB
>         AND C.OWNER = OWN
>         AND C.OBJECT_TYPE = 'TABLE';
> 
>       
>       
>       IF (INSTR(COL_LIST, PART_CLIST) = 1) THEN
>         PROP := BITOR(PROP, AI_KQLDINP_PTI);
>       END IF;
3831a3878,3879
>     ELSIF (BIT_TO_SET = AI_INDF_DISRECREATE) THEN
>       COMPLEMENT := 0;  
4015a4064
>       AND BITAND(FLAGS, AI_INDF_DISRECREATE) = 0 
4033c4082
< 
---
>         
4680,4681c4729,4734
<       IF (FIRST_PLAN = TRUE OR CUR.LAST_VERIFIED IS NULL
<           OR CUR.LAST_VERIFIED < EXEC_START_TIME) THEN
---
>       
>       
>       
>       
>       
>       
4682a4736,4737
>         IF (FIRST_PLAN = TRUE OR CUR.LAST_VERIFIED IS NULL
>             OR CUR.LAST_VERIFIED < EXEC_START_TIME) THEN
4684,4695c4739,4759
<         STMT := 
<         q'#declare 
<            accepted_cnt pls_integer;
<          begin
<            accepted_cnt :=  dbms_spm.alter_sql_plan_baseline(null,#' ||
<              FIXQ(DBMS_ASSERT.SIMPLE_SQL_NAME(CUR.PLAN_NAME)) || 
<              q'#, '_ACCEPTED', 'YES'); end;#';
< 
<         RET_CODE := 
<         DDL_EXECUTE(AI_CTX, CUR.SQL_OBJ_ID, AI_KEA_CMD_DISALLOW_AUTO_INDEX, 
<                     STMT);
< 
---
>           STMT := 
>           q'#declare 
>              accepted_cnt pls_integer;
>            begin
>              accepted_cnt :=  dbms_spm.alter_sql_plan_baseline(null,#' ||
>                FIXQ(DBMS_ASSERT.SIMPLE_SQL_NAME(CUR.PLAN_NAME)) || 
>                q'#, '_ACCEPTED', 'YES'); end;#';
> 
>         ELSIF (CUR.LAST_VERIFIED IS NOT NULL) THEN
>           STMT := 
>           q'#declare 
>              accepted_cnt pls_integer;
>            begin
>              accepted_cnt :=  dbms_spm.drop_sql_plan_baseline(plan_name=>q'# ||
>                fixq(DBMS_ASSERT.SIMPLE_SQL_NAME(cur.plan_name)) || q'#) end;#';
>         END IF;
> 
>           RET_CODE := 
>           DDL_EXECUTE(AI_CTX, CUR.SQL_OBJ_ID, AI_KEA_CMD_DISALLOW_AUTO_INDEX, 
>                       STMT);
>      
4697,4702c4761,4766
<         WHEN OTHERS THEN
<           IF (IS_URGENT_ERROR) THEN
<             RAISE;
<           ELSE
<             LOG_STACK_ERROR(AI_CTX, SQLCODE, SQLERRM, CUR.SQL_OBJ_ID);
<           END IF;
---
>       WHEN OTHERS THEN
>         IF (IS_URGENT_ERROR) THEN
>           RAISE;
>         ELSE
>           LOG_STACK_ERROR(AI_CTX, SQLCODE, SQLERRM, CUR.SQL_OBJ_ID);
>         END IF;
4704,4705d4767
<       END IF;
< 
6596a6659,6685
> 
>     CURSOR AI_UNUSABLE_CUR IS
>     SELECT  DISTINCT INDEX_OWNER, INDEX_NAME
>     FROM (
>       SELECT IO.INDEX_OWNER, IO.INDEX_NAME
>       FROM "_auto_index_ind_objects" IO, DBA_INDEXES I
>       WHERE IO.INDEX_NAME = I.INDEX_NAME
>         AND IO.INDEX_OWNER = I.OWNER
>         AND BITAND(IO.PROPERTY, AI_KQLDINP_PTI) = 0
>         AND BITAND(IO.FLAGS, AI_INDF_VALID) != 0
>         AND I.STATUS = 'UNUSABLE'
>       UNION
>       SELECT IO.INDEX_OWNER, IO.INDEX_NAME
>       FROM "_auto_index_ind_objects" IO, DBA_IND_PARTITIONS I
>       WHERE IO.INDEX_NAME = I.INDEX_NAME
>         AND IO.INDEX_OWNER = I.INDEX_OWNER
>         AND BITAND(IO.PROPERTY, AI_KQLDINP_PTI) != 0
>         AND BITAND(IO.FLAGS, AI_INDF_VALID) != 0
>         AND I.STATUS = 'UNUSABLE'
>       UNION
>       SELECT IO.INDEX_OWNER, IO.INDEX_NAME
>       FROM "_auto_index_ind_objects" IO, DBA_IND_SUBPARTITIONS I
>       WHERE IO.INDEX_NAME = I.INDEX_NAME
>         AND IO.INDEX_OWNER = I.INDEX_OWNER
>         AND BITAND(IO.PROPERTY, AI_KQLDINP_PTI) != 0
>         AND BITAND(IO.FLAGS, AI_INDF_VALID) != 0
>         AND I.STATUS = 'UNUSABLE');
6610a6700,6716
> 
>     
>     
>     BEGIN
>       
>       FOR CUR IN AI_UNUSABLE_CUR LOOP
>         RET_CODE := INDEX_DDL(AI_CTX, AI_KEA_CMD_REBUILD_INDEX, 
>                               CUR.INDEX_OWNER, CUR.INDEX_NAME);
>       END LOOP;
>       COMMIT;
> 
>     EXCEPTION
>       WHEN OTHERS THEN
>         IF (IS_URGENT_ERROR) THEN
>           RAISE;
>         END IF;
>     END;
6753a6860,6862
> 
> 
> 
7043c7152
<            CE
---
>            DBMS_AUTO_INDEX_INTERNAL.AUTO_INDEX_ALLOW(CE) SESSION_TYPE
7103c7212,7213
<     ORDER BY ELAPSED_TIME DESC;
---
>     ORDER BY DBMS_AUTO_INDEX_INTERNAL.AUTO_INDEX_ALLOW(CE) DESC,
>              ELAPSED_TIME DESC;
7185c7295,7296
<         IF (AUTO_INDEX_ALLOW(CUR.CE) = 0) THEN
---
>         
>         IF (CUR.SESSION_TYPE = AI_OPTIMIZER_ADHOC) THEN
8748a8860,8872
>         
>         
>         
>         
>         
>         IF (BITAND(P_VALUE, AI_CTRL_SPM_EVOLVE) != 0 AND
>             GET_AI_PARAM_VALUE_CLOB(AI_PARAM_MODE) <> AI_MODE_OFF) THEN
> 
>           DUMP_TRACE('Enable Auto Regression Fixing when setting ai_control');
>           DBMS_ADVISOR.SET_TASK_PARAMETER(
>             DBMS_SPM_INTERNAL.AUTO_INDEX_EVOLVE_TASK_NAME, 
>             'ALTERNATE_PLAN_BASELINE', 'AUTO');
>         END IF;
8855a8980
>         
8861c8986,8988
<           WHERE TABLESPACE_NAME = P_VALUE;
---
>           WHERE TABLESPACE_NAME = P_VALUE
>             AND CONTENTS = 'PERMANENT' 
>             AND TABLESPACE_NAME NOT IN ('SYSTEM', 'SYSAUX', 'SYSEXT');
8883a9011,9022
>           
>           
>           
>           
>           
>           IF (BITAND(GET_AI_PARAM_VALUE_NUM(AI_PARAM_CONTROL), 
>                      AI_CTRL_SPM_EVOLVE) != 0) THEN
>             DUMP_TRACE('Enable Auto Regression Fixing when setting ai_mode');
>             DBMS_ADVISOR.SET_TASK_PARAMETER(
>               DBMS_SPM_INTERNAL.AUTO_INDEX_EVOLVE_TASK_NAME, 
>               'ALTERNATE_PLAN_BASELINE', 'AUTO');
>           END IF;
9233a9373,9402
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   FUNCTION EXIST_SMB_PARAMETER(PARAMETER_NAME VARCHAR2)
>   RETURN BOOLEAN
>   IS
>     EXIST_CNT NUMBER;
>   BEGIN
> 
>     SELECT COUNT(*) INTO EXIST_CNT
>       FROM SMB$CONFIG T
>     WHERE EXIST_SMB_PARAMETER.PARAMETER_NAME = T.PARAMETER_NAME;
>     
>     IF (EXIST_CNT > 0) THEN
>       RETURN TRUE;
>     ELSE 
>       RETURN FALSE;
>     END IF;
> 
>   END EXIST_SMB_PARAMETER;
> 
9239,9246c9408,9417
< 
<       IF CUR.DATA_TYPE = AI_PARAM_TYPE_NUM THEN
<         INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE)
<           VALUES (CUR.PNAME, TO_NUMBER(CUR.DEFAULT_VALUE));
<       ELSIF CUR.DATA_TYPE = AI_PARAM_TYPE_CHAR OR
<             CUR.DATA_TYPE = AI_PARAM_TYPE_XML THEN
<         INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
<           VALUES (CUR.PNAME, 0, CUR.DEFAULT_VALUE);
---
>       IF (EXIST_SMB_PARAMETER(CUR.PNAME) = FALSE) THEN
>         IF CUR.DATA_TYPE = AI_PARAM_TYPE_NUM THEN
>           INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE)
>             VALUES (CUR.PNAME, TO_NUMBER(CUR.DEFAULT_VALUE));
>         ELSIF CUR.DATA_TYPE = AI_PARAM_TYPE_CHAR OR
>               CUR.DATA_TYPE = AI_PARAM_TYPE_XML THEN
>           INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE,
>             PARAMETER_DATA)
>             VALUES (CUR.PNAME, 0, CUR.DEFAULT_VALUE);
>         END IF;
10321c10492,10561
<                               
---
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   PROCEDURE SET_DROPPED_INDEX_STATUS(
>     OWNER             IN DBMS_ID, 
>     INDEX_NAME        IN DBMS_ID, 
>     ALLOW_RECREATE    IN BOOLEAN)
>   IS
>     FLAG                 NUMBER := NULL;
>     AI_CTX               AI_CTX_TYPE;
>     OWNERU               DBMS_ID;
>     INDU                 DBMS_ID;
>     SET_CNT              NUMBER := 0;
>     CURSOR CAND_DROP_INDEX_CUR(P_OWNER DBMS_ID, P_INDNAME DBMS_ID) IS 
>     SELECT  
>            FLAGS, INDEX_OWNER OWNER, INDEX_NAME IND_NAME, OBJECT_ID
>     FROM "_auto_index_ind_objects" I
>     WHERE (P_OWNER IS NULL OR INDEX_OWNER = P_OWNER)
>       AND (P_INDNAME IS NULL OR INDEX_NAME = P_INDNAME)
>       AND NOT EXISTS (SELECT 1
>                        FROM SYS.IND$ IND
>                       WHERE IND.OBJ# = I.INDEX_OBJ#)
>     ORDER BY INDEX_OWNER, INDEX_NAME;
> 
>   BEGIN
> 
>     IF (ALLOW_RECREATE IS NULL) THEN
>       DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(AI_INVALID_ARGUMENT,
>         'ALLOW_RECREATE'); 
>     END IF;
> 
>     SYS.DBMS_STATS_INTERNAL.UPCASE(OWNER, OWNERU);
>     SYS.DBMS_STATS_INTERNAL.UPCASE(INDEX_NAME, INDU);
> 
>     INIT_AI_CTX(AI_CTX, NULL,NULL,NULL);
>   
>     FOR CUR IN CAND_DROP_INDEX_CUR(OWNERU, INDU) LOOP
>       SET_CNT := SET_CNT + 1;
>       FLAG := CUR.FLAGS;
>       FLAG := GET_INDEX_DDL_FLAG_TO_SET(FLAG, AI_INDF_DROPPED);
>       DUMP_TRACE('set index: ' || INDU || ' dropped.');
>       IF (NOT ALLOW_RECREATE) THEN
>         FLAG := GET_INDEX_DDL_FLAG_TO_SET(FLAG, AI_INDF_DISRECREATE);
>         DUMP_TRACE('disallow ' || INDU || ' to be recreated');
>       ELSIF(BITAND(FLAG, AI_INDF_DISRECREATE) = AI_INDF_DISRECREATE) THEN
>         DUMP_TRACE('allow ' || INDU || ' to be recreated');
>         FLAG := FLAG - AI_INDF_DISRECREATE;
>       END IF;
> 
>       UPDATE_INDEX_OBJECT(AI_CTX, CUR.OBJECT_ID, NULL, FLAG, NULL, NULL);
> 
>     END LOOP;
>     
>     IF (INDU IS NOT NULL AND SET_CNT = 0) THEN
>       RAISE INVALID_INDEX;  
>     END IF;
>       
>   END SET_DROPPED_INDEX_STATUS;                              
SYS.DBMS_JSON0 - PACKAGE BODY (RU):
189a190,210
> 
> 
> 
> 
> FUNCTION  GETMAXVCSIZE RETURN NUMBER
> IS
>   MAXVC VARCHAR2(30);
>   RET   NUMBER := 4000;
> BEGIN
>   
>   SELECT VALUE INTO MAXVC
>   FROM V$PARAMETER
>   WHERE LOWER(NAME) = 'max_string_size';
> 
>   IF (MAXVC = 'EXTENDED') THEN
>     RET := 32767;
>   END IF;
> 
>   RETURN RET;
> END;
> 
SYS.DBMS_PRVTAQIM - PACKAGE BODY (RU):
35c35
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
67a68,82
>   OBJECT_ALREADY_EXISTS  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(OBJECT_ALREADY_EXISTS, -955);
> 
>   
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
127a143,351
> 
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL 
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
> 
>   
>   
>   
>   PROCEDURE EXECUTE_STMT_IN_KERNEL_CURSOR(
>               SQL_STMT        IN VARCHAR2,
>               IGNORE_DDL      IN BOOLEAN DEFAULT TRUE,
>               OPCODE          IN NUMBER  DEFAULT NULL,
>               BYPASS_DV       IN BOOLEAN DEFAULT TRUE,
>               BYPASS_AUDIT    IN BOOLEAN DEFAULT TRUE,
>               IN_STR_ARRAY    IN STR_ARRAY_TYPE DEFAULT NULL,
>               IN_STRPOS_ARRAY IN NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY    IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_NUMPOS_ARRAY IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_RAW_PARAM1   IN RAW DEFAULT NULL,
>               IN_RAW_PARAM2   IN RAW DEFAULT NULL,
>               IN_TIME_PARAM1  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL) IS
> 
>   OUT_STR_ARR    STR_ARRAY_TYPE;
>   OUT_NUM_ARR    NUM_ARRAY_TYPE;
>   OUT_RAW_PRM1   RAW(32737);
>   OUT_RAW_PRM2   RAW(32737);
>   OUT_BINT_PRM1  BINARY_INTEGER;
>   OUT_BINT_PRM2  BINARY_INTEGER;
>   OUT_INT_PRM1   PLS_INTEGER;
>   OUT_INT_PRM2   PLS_INTEGER;
>   OUT_TIME_PRM1  TIMESTAMP WITH TIME ZONE;
>   OUT_TIME_PRM2  TIMESTAMP WITH TIME ZONE;
>   BEGIN
>     AQ_INTERNAL_EXESTMT(
>                 SQL_STMT       =>      SQL_STMT,
>                 OPCODE         =>      OPCODE,
>                 BYPASS_DV      =>      BYPASS_DV,
>                 BYPASS_AUDIT   =>      BYPASS_AUDIT,
>                 IN_STR_ARRAY   =>      IN_STR_ARRAY,
>                 IN_STRPOS_ARRAY=>      IN_STRPOS_ARRAY,
>                 IN_NUM_ARRAY   =>      IN_NUM_ARRAY,
>                 IN_NUMPOS_ARRAY=>      IN_NUMPOS_ARRAY,
>                 IN_RAW_PARAM1  =>      IN_RAW_PARAM1,
>                 IN_RAW_PARAM2  =>      IN_RAW_PARAM2,
>                 IN_TIME_PARAM1 =>      IN_TIME_PARAM1,
>                 IN_TIME_PARAM2 =>      IN_TIME_PARAM2,
>                 OUT_STR_ARRAY  =>      OUT_STR_ARR,
>                 OUT_STRPOS_ARRAY=>     NULL,
>                 OUT_NUM_ARRAY  =>      OUT_NUM_ARR,
>                 OUT_NUMPOS_ARRAY=>     NULL,
>                 IN_BINT_PARAM1 =>      NULL,
>                 IN_BINT_PARAM2 =>      NULL,
>                 IN_INT_PARAM1  =>      NULL,
>                 IN_INT_PARAM2  =>      NULL,
>                 OUT_RAW_PARAM1 =>      OUT_RAW_PRM1,
>                 OUT_RAW_PARAM2 =>      OUT_RAW_PRM2,
>                 OUT_BINT_PARAM1=>      OUT_BINT_PRM1,
>                 OUT_BINT_PARAM2=>      OUT_BINT_PRM2,
>                 OUT_INT_PARAM1 =>      OUT_INT_PRM1,
>                 OUT_INT_PARAM2 =>      OUT_INT_PRM2,
>                 OUT_TIME_PARAM1=>      OUT_TIME_PRM1,
>                 OUT_TIME_PARAM2=>      OUT_TIME_PRM1);
>   EXCEPTION  
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (IGNORE_DDL = FALSE) THEN
>         RAISE;
>       END IF;
>   END;
> 
>   
>   
>   
>   
>   PROCEDURE EXECUTE_STMTCUSR(
>     STMT                 IN     VARCHAR2,
>     CURRENT_USER         IN     VARCHAR2 DEFAULT NULL,
>     IGNORE_DDL_DML_ERROR IN     BOOLEAN  DEFAULT FALSE,
>     BYPASS_DV            IN     BOOLEAN  DEFAULT TRUE)
>   IS
>     DUMMY          VARCHAR2(32767); 
>     OUT_STR_ARR  STR_ARRAY_TYPE;
>     OUT_NUM_ARR  NUM_ARRAY_TYPE;
>     OUT_RAW1     RAW(32737);
>     OUT_RAW2     RAW(32737);
>     OUT_BINT1    BINARY_INTEGER;
>     OUT_BINT2    BINARY_INTEGER;
>     OUT_INT1     PLS_INTEGER;
>     OUT_INT2     PLS_INTEGER;
>     TM1          TIMESTAMP WITH TIME ZONE;
>     TM2          TIMESTAMP WITH TIME ZONE;
>     STREAMS_CAPTURE_OFF BOOLEAN;
>   BEGIN
>     DUMMY := DBMS_ASSERT.SCHEMA_NAME(CURRENT_USER);
>     STREAMS_CAPTURE_OFF := DBMS_AQADM_SYSCALLS.KWQA_3GL_ISSTREAMSCAPTUREOFF;
>     
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(TRUE);
>     END IF;
> 
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmtCusr: '|| STMT,
>                 EVENT_LEVEL => DBMS_AQADM_SYS.TRACE_FLAG_AQ_DEBUG);
> 
>     AQ_INTERNAL_EXESTMT(SQL_STMT => STMT, OPCODE => 256, BYPASS_DV => BYPASS_DV,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(CURRENT_USER), OUT_STR_ARRAY => OUT_STR_ARR,
>       OUT_NUM_ARRAY => OUT_NUM_ARR, OUT_RAW_PARAM1 => OUT_RAW1,
>       OUT_RAW_PARAM2 => OUT_RAW2, OUT_BINT_PARAM1 => OUT_BINT1,
>       OUT_BINT_PARAM2 => OUT_BINT2, OUT_INT_PARAM1 => OUT_INT1,
>       OUT_INT_PARAM2 => OUT_INT2, OUT_TIME_PARAM1 => TM1,
>       OUT_TIME_PARAM2 => TM2);
>     
> 
>     
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>     END IF;
>   EXCEPTION
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>         RAISE;
>       ELSE
>         DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       END IF;
>     WHEN NO_DATA_FOUND THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>        RAISE;
>       ELSE
>       DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       END IF;
>    WHEN OBJECT_ALREADY_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       DBMS_SYSTEM.KSDWRT(1, 'Encountered error when executing : '|| STMT);
>       IF (IGNORE_DDL_DML_ERROR = FALSE) THEN
>         RAISE;
>       END IF;
>    WHEN OTHERS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       RAISE;
>   END;
> 
143c367
<     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmt2: '|| STMT);
---
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmt3: '|| STMT);
148c372
<     KWQA_3GL_EXECUTESTMT(STMT, TRUE);
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
195c419
< WHEN COMPILE_ERROR THEN
---
>     WHEN COMPILE_ERROR THEN
605c829
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE'                 || 
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE'                 || 
624c848
<                ' WITH READ ONLY', FALSE, TRUE, TRUE);
---
>                ' WITH READ ONLY', FALSE, TRUE);
767c991
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '               ||
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '               ||
785c1009
<                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                ' WITH READ ONLY', FALSE, TRUE);
917c1141
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '               || 
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           || 
936c1160
<                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                ' WITH READ ONLY', FALSE, TRUE);
1609c1833
<     DBMS_AQADM_INV.EXECUTE_STMT2(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
---
>     EXECUTE_STMT3(VIEW_TXT || BV_TXT || ' WITH READ ONLY');
1835c2059
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '               || 
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           || 
1851c2075
<                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                ' WITH READ ONLY', FALSE, TRUE);
2074,2076c2298,2300
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE ' 
<                                  || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
<                                  || '.' || DBMS_ASSERT.ENQUOTE_NAME(DQT||IOT_NAME||DQT)
---
>     EXECUTE_STMT3('CREATE TABLE ' 
>                  || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
>                  || '.' || DBMS_ASSERT.ENQUOTE_NAME(DQT||IOT_NAME||DQT)
2143c2367
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2146c2370
<                  IGNORE_DDL_ERROR, TRUE);
---
>                  IGNORE_DDL_ERROR);
2202c2426
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE ' 
---
>     EXECUTE_STMT3('CREATE TABLE ' 
2231c2455
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE UNIQUE INDEX '
---
>     EXECUTE_STMT3('CREATE UNIQUE INDEX '
2263c2487
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2266c2490
<                  IGNORE_DDL_ERROR, TRUE);
---
>                  IGNORE_DDL_ERROR);
2351c2575
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE '
---
>    EXECUTE_STMT3('CREATE TABLE '
2457c2681
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE ' 
---
>     EXECUTE_STMT3('CREATE TABLE ' 
2558c2782
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
---
>     EXECUTE_STMT3('CREATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
2623c2847
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2626c2850
< 		 IGNORE_DDL_ERROR, TRUE);
---
> 		 IGNORE_DDL_ERROR);
2650c2874
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2653c2877
< 		 IGNORE_DDL_ERROR, TRUE);
---
> 		 IGNORE_DDL_ERROR);
2675c2899
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2678c2902
< 		 IGNORE_DDL_ERROR, TRUE);
---
> 		 IGNORE_DDL_ERROR);
2743c2967
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
---
>     EXECUTE_STMT3('CREATE TABLE ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT)
2809c3033
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '||
---
>     EXECUTE_STMT3('DROP TABLE '||
2812c3036
< 		 IGNORE_DDL_ERROR, TRUE);
---
> 		 IGNORE_DDL_ERROR);
2834c3058
<     EXECUTE IMMEDIATE MOVESQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(MOVESQL);
2842c3066
<     EXECUTE IMMEDIATE MOVESQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(MOVESQL);
2859c3083
<     EXECUTE IMMEDIATE MOVESQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(MOVESQL);
2867c3091
<     EXECUTE IMMEDIATE MOVESQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(MOVESQL);
2895a3120,3121
>   DELTAB_CUR        SYS_REFCURSOR;         
>   DELTAB_BNDS	    AQ$_BND_ARRAY;       
2896a3123
>   HISSCAN_BNDS      AQ$_BND_ARRAY;         
2897a3125,3126
>   UPDATECT_CUR      SYS_REFCURSOR;          
>   UPDATECT_BNDS     AQ$_BND_ARRAY;        
2898a3128,3129
>   DELCT_CUR         SYS_REFCURSOR;     
>   DELCT_BNDS        AQ$_BND_ARRAY;   
2904,2905c3135
<   TYPE RT IS	    REF CURSOR;
<   SQLRC		    RT;		  	 	
---
>   SQLRC		    SYS_REFCURSOR;       	
2915a3146,3156
>   
>   OUT_STR_ARR       STR_ARRAY_TYPE;
>   OUT_NUM_ARR       NUM_ARRAY_TYPE;
>   OUT_RAW1          RAW(32737);
>   OUT_RAW2          RAW(32737);
>   OUT_BINT1         BINARY_INTEGER;
>   OUT_BINT2         BINARY_INTEGER;
>   OUT_INT1          PLS_INTEGER;
>   OUT_INT2          PLS_INTEGER;
>   TM1               TIMESTAMP WITH TIME ZONE;
>   TM2               TIMESTAMP WITH TIME ZONE;
2924,2925c3165,3166
<     
<       EXECUTE IMMEDIATE DELETEIOT USING Q_NAME;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(DELETEIOT, 
>                                     IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME)); 
2932c3173,3174
<       EXECUTE IMMEDIATE DELETETAB USING Q_NAME;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(DELETETAB, 
>                                     IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME)); 
2969c3211,3213
<       EXECUTE IMMEDIATE DELETEIOT USING Q_NAME, QUEUENO;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(DELETEIOT,
>                                     IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME),
>                                     IN_NUM_ARRAY => NUM_ARRAY_TYPE(QUEUENO)); 
3003c3247,3248
<       OPEN SQLRC FOR HISSCAN_SQL USING Q_NAME;
---
>       HISSCAN_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME));
>       SQLRC := KWQAEXGCUR(HISSCAN_SQL, HISSCAN_BNDS);
3008c3253,3260
<         EXECUTE IMMEDIATE DELETEIOT USING MSGID;     
---
>         AQ_INTERNAL_EXESTMT(SQL_STMT => DELETEIOT, OPCODE => 2,
>           OUT_STR_ARRAY => OUT_STR_ARR, OUT_NUM_ARRAY => OUT_NUM_ARR,
>           IN_RAW_PARAM1 => MSGID, OUT_RAW_PARAM1 => OUT_RAW1,
>           OUT_RAW_PARAM2 => OUT_RAW2, OUT_BINT_PARAM1 => OUT_BINT1,
>           OUT_BINT_PARAM2 => OUT_BINT2, OUT_INT_PARAM1 => OUT_INT1,
>           OUT_INT_PARAM2 => OUT_INT2, OUT_TIME_PARAM1 => TM1,
>           OUT_TIME_PARAM2 => TM2);
>         
3010c3262,3268
<         EXECUTE IMMEDIATE DELETETAB USING MSGID, OUT ENQ_TID, OUT CSCN;
---
>         DELTAB_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>                                      AQ$_BND(STR_VAL => NULL, BMODE => 1),
>                                      AQ$_BND(NUM_VAL => NULL, BMODE => 1));
>         DELTAB_CUR := KWQAEXGCUR(DELETETAB, DELTAB_BNDS);
>         ENQ_TID := DELTAB_BNDS(2).STR_VAL;
>         CSCN := DELTAB_BNDS(3).NUM_VAL;
>         CLOSE DELTAB_CUR;
3014c3272,3278
<           EXECUTE IMMEDIATE UPDATECTIOT USING ENQ_TID, OUT ROW_ID, OUT MSG_CNT;
---
>           UPDATECT_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => ENQ_TID),
>                                          AQ$_BND(UROWID_VAL => NULL, BMODE => 1),
>                                          AQ$_BND(NUM_VAL => NULL, BMODE => 1));
>           UPDATECT_CUR := KWQAEXGCUR(UPDATECTIOT, UPDATECT_BNDS);
>           ROW_ID := UPDATECT_BNDS(2).STR_VAL;                                   
>           MSG_CNT := UPDATECT_BNDS(3).NUM_VAL;
>           CLOSE UPDATECT_CUR;            
3016c3280,3282
<             EXECUTE IMMEDIATE DELETECTIOT USING ROW_ID;
---
>             DELCT_BNDS :=  AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => ROW_ID));
>             DELCT_CUR := KWQAEXGCUR(DELETECTIOT, DELCT_BNDS);
>             CLOSE DELCT_CUR;
3019a3286
>       CLOSE SQLRC;
3032a3300,3301
>   IOT_QRY_BNDS        AQ$_BND_ARRAY;
>   IOT_QRY_CUR         SYS_REFCURSOR;
3033a3303,3304
>   IOT_UPD_BNDS        AQ$_BND_ARRAY;
>   IOT_UPD_CUR         SYS_REFCURSOR;
3035,3037c3306,3307
<   IOT_QUERY_CURSOR    INTEGER;                             
<   IOT_UPDATE_CURSOR   INTEGER;
<   QTABLE_QUERY_CURSOR INTEGER;
---
>   QTABLE_QRY_BNDS     AQ$_BND_ARRAY;
>   QTABLE_QRY_CUR      SYS_REFCURSOR;
3050d3319
<     IOT_QUERY_CURSOR := DBMS_SQL.OPEN_CURSOR;
3056,3063d3324
<     DBMS_SQL.PARSE(IOT_QUERY_CURSOR, IOT_QUERY, DBMS_SQL.V7);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 1, MSG_QNAME, M_IDEN_LEN);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 2, APPNAME, M_SUB_PRXY_LEN);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 3, MSG_PRIORITY);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 4, MSG_ENQ_TIME);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 5, MSG_ENQ_TID, M_TID_LEN);
<     DBMS_SQL.DEFINE_COLUMN(IOT_QUERY_CURSOR, 6, MSG_STEP_NO);
<     IGNORE := DBMS_SQL.EXECUTE(IOT_QUERY_CURSOR);
3065,3066d3325
<     
<     QTABLE_QUERY_CURSOR := DBMS_SQL.OPEN_CURSOR;
3070,3075c3329,3331
<       || ' WHERE enq_tid = :enq_tid'
<       ||   ' AND step_no = :step_no';
<     
<     DBMS_SQL.PARSE(QTABLE_QUERY_CURSOR, QTABLE_QUERY, DBMS_SQL.V7);
<     DBMS_SQL.DEFINE_COLUMN_ROWID(QTABLE_QUERY_CURSOR, 1, NEW_ROWID);
<   
---
>       || ' WHERE enq_tid = :1'
>       ||   ' AND step_no = :2';
>  
3077d3332
<     IOT_UPDATE_CURSOR := DBMS_SQL.OPEN_CURSOR;
3081,3088c3336,3340
< 		  ' set msg_rowid = :new_rowid ' ||
<       		  ' WHERE msg_qname = :msg_qname AND appname = :appname ' ||
< 		  ' AND msg_priority = :msg_priority AND ' ||
< 		  ' msg_enq_time = :msg_enq_time AND ' ||
< 		  ' msg_enq_tid = :enq_tid AND msg_step_no = :step_no';
<     
<     DBMS_SQL.PARSE(IOT_UPDATE_CURSOR, IOT_UPDATE, DBMS_SQL.V7);
<   
---
> 		  ' set msg_rowid = :1 ' ||
>       		  ' WHERE msg_qname = :2 AND appname = :3  ' ||
> 		  ' AND msg_priority = :4 AND ' ||
> 		  ' msg_enq_time = :5 AND ' ||
> 		  ' msg_enq_tid = :6 AND msg_step_no = :7';
3089a3342,3343
>     IOT_QRY_BNDS := AQ$_BND_ARRAY();
>     IOT_QRY_CUR := KWQAEXGCUR(IOT_QUERY, IOT_QRY_BNDS);
3091,3101c3345,3362
<       IF DBMS_SQL.FETCH_ROWS(IOT_QUERY_CURSOR) > 0 THEN
<     	DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 1, MSG_QNAME);
<     	DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 2, APPNAME);
<     	DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 3, MSG_PRIORITY);
<         DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 4, MSG_ENQ_TIME);
<     	DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 5, MSG_ENQ_TID);
<     	DBMS_SQL.COLUMN_VALUE(IOT_QUERY_CURSOR, 6, MSG_STEP_NO);
< 
< 	
< 	
< 
---
>       FETCH IOT_QRY_CUR INTO  MSG_QNAME, APPNAME, MSG_PRIORITY, MSG_ENQ_TIME,
>                               MSG_ENQ_TID, MSG_STEP_NO;
>       EXIT WHEN IOT_QRY_CUR%NOTFOUND;
> 
>       
>       QTABLE_QRY_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => MSG_ENQ_TID),
>                                        AQ$_BND(NUM_VAL =>  MSG_STEP_NO));
> 
>       QTABLE_QRY_CUR := KWQAEXGCUR(QTABLE_QUERY, QTABLE_QRY_BNDS);
>       FETCH QTABLE_QRY_CUR INTO NEW_ROWID;
>       IF (QTABLE_QRY_CUR%FOUND) THEN
>         IOT_UPD_BNDS := AQ$_BND_ARRAY(AQ$_BND(UROWID_VAL => NEW_ROWID),
>                                       AQ$_BND(STR_VAL => MSG_QNAME),
>                                       AQ$_BND(STR_VAL => APPNAME), 
>                                       AQ$_BND(NUM_VAL => MSG_PRIORITY), 
>                                       AQ$_BND(TM_VAL => MSG_ENQ_TIME), 
>                                       AQ$_BND(STR_VAL => MSG_ENQ_TID),
>                                       AQ$_BND(NUM_VAL => MSG_STEP_NO));
3103,3125c3364,3371
<         DBMS_SQL.BIND_VARIABLE(QTABLE_QUERY_CURSOR, 'enq_tid', MSG_ENQ_TID);
<         DBMS_SQL.BIND_VARIABLE(QTABLE_QUERY_CURSOR, 'step_no', MSG_STEP_NO);
< 
<         IGNORE := DBMS_SQL.EXECUTE(QTABLE_QUERY_CURSOR);
<         IF DBMS_SQL.FETCH_ROWS(QTABLE_QUERY_CURSOR) > 0 THEN
<           DBMS_SQL.COLUMN_VALUE(QTABLE_QUERY_CURSOR, 1, NEW_ROWID);
< 	  
< 	 
<           
<           DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'new_rowid', NEW_ROWID);
<           DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'enq_tid', MSG_ENQ_TID);
<           DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'step_no', MSG_STEP_NO);
< 	  DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'msg_qname', MSG_QNAME);
<           DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'appname', APPNAME);
< 	  DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'msg_priority', 
< 				 MSG_PRIORITY);
<           DBMS_SQL.BIND_VARIABLE(IOT_UPDATE_CURSOR, 'msg_enq_time', 
<                                  MSG_ENQ_TIME);
<   	  IGNORE := DBMS_SQL.EXECUTE(IOT_UPDATE_CURSOR);
<   	  
<         ELSE
<           
<           DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(-24020,'aq_patch_iot ' ||
---
>   	IOT_UPD_CUR := KWQAEXGCUR(IOT_UPDATE, IOT_UPD_BNDS);
>         CLOSE IOT_UPD_CUR;
>         CLOSE QTABLE_QRY_CUR;
>   	
>       ELSE
>         CLOSE QTABLE_QRY_CUR;
>         
>         DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR(-24020,'aq_patch_iot ' ||
3128,3131c3374
<         END IF;
<       ELSE 					       
<         EXIT;                                                  
<       END IF;                                                     
---
>       END IF;
3141c3384
< 
---
>     CLOSE IOT_QRY_CUR;
3144,3145c3387,3388
<       IF (DBMS_SQL.IS_OPEN(IOT_QUERY_CURSOR)) THEN
<           DBMS_SQL.CLOSE_CURSOR(IOT_QUERY_CURSOR);
---
>       IF (IOT_QRY_CUR%ISOPEN) THEN
>         CLOSE IOT_QRY_CUR;
3147,3148c3390,3391
<       IF (DBMS_SQL.IS_OPEN(IOT_UPDATE_CURSOR)) THEN
<           DBMS_SQL.CLOSE_CURSOR(IOT_UPDATE_CURSOR);
---
>       IF (IOT_UPD_CUR%ISOPEN) THEN
>         CLOSE IOT_UPD_CUR;
3150,3151c3393,3394
<       IF (DBMS_SQL.IS_OPEN(QTABLE_QUERY_CURSOR)) THEN
<          DBMS_SQL.CLOSE_CURSOR(QTABLE_QUERY_CURSOR);
---
>       IF (QTABLE_QRY_CUR%ISOPEN) THEN
>         CLOSE QTABLE_QRY_CUR;
3474a3718,3719
>   HIGH_SCN_BNDS AQ$_BND_ARRAY;
>   HIGH_SCN_CUR  SYS_REFCURSOR;
3505c3750,3754
<       EXECUTE IMMEDIATE HIGH_SCN_SQL INTO HIGH_SCN;
---
> 
>       HIGH_SCN_BNDS := AQ$_BND_ARRAY();
>       HIGH_SCN_CUR := KWQAEXGCUR(HIGH_SCN_SQL, HIGH_SCN_BNDS);
>       FETCH HIGH_SCN_CUR INTO  HIGH_SCN;
>       CLOSE HIGH_SCN_CUR;
3647a3897,3898
>   BNDS    AQ$_BND_ARRAY;
>   CUR     SYS_REFCURSOR;
3655a3907,3908
>     BNDS := AQ$_BND_ARRAY();
> 
3662c3915,3917
<       EXECUTE IMMEDIATE SQLTEXT INTO IGNORE;
---
>       CUR := KWQAEXGCUR(SQLTEXT, BNDS);
>       FETCH CUR INTO IGNORE;
>       CLOSE CUR;
3681,3682c3936,3944
<       EXECUTE IMMEDIATE SQLTEXT INTO IGNORE;
<       RETURN 3;				      	     
---
>       CUR := KWQAEXGCUR(SQLTEXT, BNDS);
>       FETCH CUR INTO IGNORE;
>       IF (CUR%FOUND) THEN
>         CLOSE CUR;
>         RETURN 3;			      	     
>       ELSE
>         CLOSE CUR;
>         RETURN 2;
>       END IF;
3715a3978,3979
>   SQL_QRY_BNDS  AQ$_BND_ARRAY;
>   SQLRC         SYS_REFCURSOR;
3716a3981,3982
>   SQL_INS_BNDS  AQ$_BND_ARRAY;
>   SQL_INS_CUR   SYS_REFCURSOR;
3726,3727d3991
<   TYPE RT IS	REF CURSOR;
<   SQLRC		RT;		  	 	
3818c4082,4083
<     OPEN SQLRC FOR SQLQUERY;
---
>     SQL_QRY_BNDS := AQ$_BND_ARRAY();
>     SQLRC := KWQAEXGCUR(SQLQUERY, SQL_QRY_BNDS);
3865,3867c4130,4136
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, ENQTID, STEPNO, PRIORITY,
< 		CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO), 
>             AQ$_BND(STR_VAL => ENQTID), AQ$_BND(NUM_VAL => STEPNO), 
>             AQ$_BND(NUM_VAL => PRIORITY), AQ$_BND(NUM_VAL => CHAINNO), 
>             AQ$_BND(NUM_VAL => LOCALNO), AQ$_BND(RAW_VAL => MSGID)); 
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3870,3872c4139,4144
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, PRIORITY,
< 		CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO),
>             AQ$_BND(NUM_VAL => PRIORITY), AQ$_BND(NUM_VAL => CHAINNO),
>             AQ$_BND(NUM_VAL => LOCALNO), AQ$_BND(RAW_VAL => MSGID));
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3877,3879c4149,4156
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, ENQTID, STEPNO, ENQTIME, STEPNO,
< 		CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO), 
>             AQ$_BND(STR_VAL => ENQTID), AQ$_BND(NUM_VAL => STEPNO), 
>             AQ$_BND(TM_VAL => ENQTIME), AQ$_BND(NUM_VAL => STEPNO), 
>             AQ$_BND(NUM_VAL => CHAINNO), AQ$_BND(NUM_VAL => LOCALNO),
>             AQ$_BND(RAW_VAL => MSGID));
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3882,3884c4159,4165
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, ENQTIME, STEPNO,
< 		CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO), 
>             AQ$_BND(TM_VAL => ENQTIME), AQ$_BND(NUM_VAL => STEPNO), 
>             AQ$_BND(NUM_VAL => CHAINNO), AQ$_BND(NUM_VAL => LOCALNO),
>             AQ$_BND(RAW_VAL => MSGID));
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3889,3891c4170,4177
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, ENQTID, STEPNO, PRIORITY, 
< 		ENQTIME, STEPNO, CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO), 
>             AQ$_BND(STR_VAL => ENQTID), AQ$_BND(NUM_VAL => STEPNO), 
>             AQ$_BND(NUM_VAL => PRIORITY), AQ$_BND(TM_VAL => ENQTIME),
>             AQ$_BND(NUM_VAL => STEPNO), AQ$_BND(NUM_VAL => CHAINNO),
>             AQ$_BND(NUM_VAL => LOCALNO), AQ$_BND(RAW_VAL => MSGID));
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3894,3896c4180,4186
< 	  EXECUTE IMMEDIATE SQLINSERT 
< 	  USING CONSUMERNO, CONSUMER, QUEUENO, PRIORITY, ENQTIME, STEPNO,
< 		CHAINNO, LOCALNO, MSGID;
---
>           SQL_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => CONSUMERNO),
>             AQ$_BND(STR_VAL => CONSUMER), AQ$_BND(NUM_VAL => QUEUENO), 
>             AQ$_BND(NUM_VAL => PRIORITY), AQ$_BND(TM_VAL => ENQTIME),
>             AQ$_BND(NUM_VAL => STEPNO), AQ$_BND(NUM_VAL => CHAINNO),
>             AQ$_BND(NUM_VAL => LOCALNO), AQ$_BND(RAW_VAL => MSGID));
>           SQL_INS_CUR := KWQAEXGCUR(SQLINSERT, SQL_INS_BNDS);
>           CLOSE SQL_INS_CUR;
3899a4190
>     CLOSE SQLRC;
3948a4240,4241
>   QT_QRY_BNDS      AQ$_BND_ARRAY;
>   QT_QRY_CUR       SYS_REFCURSOR;
3949a4243,4244
>   TM_INS_BNDS      AQ$_BND_ARRAY;
>   TM_INS_CUR       SYS_REFCURSOR;
3950a4246,4247
>   HIS_INS_BNDS     AQ$_BND_ARRAY;
>   HIS_INS_CUR      SYS_REFCURSOR;
3994a4292,4293
>   SESSION_USER     VARCHAR(128);
> 
4033,4034c4332,4333
<    DBMS_AQADM_INV.EXECUTE_STMT2(' drop index ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||SCHEMA||DQT) ||
<                 '.' ||
---
>    EXECUTE_STMT3(' drop index ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||SCHEMA||DQT) ||
>             '.' ||
4065c4364,4365
<    OPEN SQLRC FOR QT_QUERY;
---
>    QT_QRY_BNDS := AQ$_BND_ARRAY();
>    QT_QRY_CUR := KWQAEXGCUR(QT_QUERY, QT_QRY_BNDS);
4067,4068c4367,4368
<      FETCH SQLRC INTO Q_NAME, MSGID, RID, TIMEMGR_INFO, STATE, HISTORY;
<      EXIT WHEN SQLRC%NOTFOUND;
---
>      FETCH QT_QRY_CUR INTO Q_NAME, MSGID, RID, TIMEMGR_INFO, STATE, HISTORY;
>      EXIT WHEN QT_QRY_CUR%NOTFOUND;
4081,4082c4381,4385
< 	 EXECUTE IMMEDIATE TM_INSERT 
< 	 USING TIMEMGR_INFO, TXN_ID, MSGID, ACTION;
---
>          TM_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => TIMEMGR_INFO),
>            AQ$_BND(STR_VAL => TXN_ID), AQ$_BND(RAW_VAL => MSGID),
>            AQ$_BND(NUM_VAL => ACTION));
>          TM_INS_CUR := KWQAEXGCUR(TM_INSERT, TM_INS_BNDS);
>          CLOSE TM_INS_CUR;
4099,4101c4402,4408
< 	 EXECUTE IMMEDIATE HIS_INSERT 
< 	 USING MSGID, AGENTNO, CONSUMER, 0, DEQHIS.DEQ_TIME, 
< 	       DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, DEQHIS.PROPAGATED_MSGID;
---
>          HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>            AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(STR_VAL =>  CONSUMER),
>            AQ$_BND(NUM_VAL => 0), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>            AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID), AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>            AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>          HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>          CLOSE HIS_INS_CUR;
4131,4134c4438,4445
< 	       EXECUTE IMMEDIATE HIS_INSERT
< 	       USING MSGID, AGENTNO, '0', 0, DEQHIS.DEQ_TIME, 
< 	       	     DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		     DEQHIS.PROPAGATED_MSGID;
---
>                HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>                  AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(STR_VAL =>  '0'),
>                  AQ$_BND(NUM_VAL => 0), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>                  AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>                  AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>                  AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>                HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>                CLOSE HIS_INS_CUR;
4138,4141c4449,4456
< 	       EXECUTE IMMEDIATE HIS_INSERT
< 	       USING MSGID, 0, AGENTS_TAB(J), AGENTNO, DEQHIS.DEQ_TIME, 
< 	       	     DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		     DEQHIS.PROPAGATED_MSGID;
---
>                HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>                  AQ$_BND(NUM_VAL => 0), AQ$_BND(STR_VAL =>  AGENTS_TAB(J)),
>                  AQ$_BND(NUM_VAL =>  AGENTNO), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>                  AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>                  AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>                  AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>                HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>                CLOSE HIS_INS_CUR;
4159,4162c4474,4481
< 	     EXECUTE IMMEDIATE HIS_INSERT
< 	     USING MSGID, AGENTNO, '0', 0, DEQHIS.DEQ_TIME, 
< 	       	   DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		   DEQHIS.PROPAGATED_MSGID;
---
>              HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>                AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(STR_VAL => '0'),
>                AQ$_BND(NUM_VAL =>  0), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>                AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>                AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>                AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>              HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>              CLOSE HIS_INS_CUR;
4166,4169c4485,4492
< 	     EXECUTE IMMEDIATE HIS_INSERT
< 	     USING MSGID, 0, '0', AGENTNO, DEQHIS.DEQ_TIME, 
< 		   DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		   DEQHIS.PROPAGATED_MSGID;
---
>              HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>                AQ$_BND(NUM_VAL => 0), AQ$_BND(STR_VAL => '0'),
>                AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>                AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>                AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>                AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>              HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>              CLOSE HIS_INS_CUR;
4192,4195c4515,4522
< 	   EXECUTE IMMEDIATE HIS_INSERT
< 	   USING MSGID, AGENTNO, '0', 0, DEQHIS.DEQ_TIME, 
< 		 DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		 DEQHIS.PROPAGATED_MSGID;
---
>            HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>              AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(STR_VAL => '0'),
>              AQ$_BND(NUM_VAL => 0), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>              AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>              AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>              AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>            HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>            CLOSE HIS_INS_CUR;
4202,4205c4529,4536
< 	   EXECUTE IMMEDIATE HIS_INSERT
< 	   USING MSGID, 0, AGENTS, AGENTNO, DEQHIS.DEQ_TIME, 
< 		   DEQHIS.TRANSACTION_ID, DEQHIS.DEQ_USER, 
< 		   DEQHIS.PROPAGATED_MSGID;
---
>            HIS_INS_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID),
>              AQ$_BND(NUM_VAL => 0), AQ$_BND(STR_VAL => AGENTS),
>              AQ$_BND(NUM_VAL => AGENTNO), AQ$_BND(TM_VAL => DEQHIS.DEQ_TIME),
>              AQ$_BND(STR_VAL =>  DEQHIS.TRANSACTION_ID),
>              AQ$_BND(NUM_VAL => DEQHIS.DEQ_USER),
>              AQ$_BND(RAW_VAL => DEQHIS.PROPAGATED_MSGID));
>            HIS_INS_CUR := KWQAEXGCUR(HIS_INSERT, HIS_INS_BNDS);
>            CLOSE HIS_INS_CUR;
4209a4541
>    CLOSE QT_QRY_CUR;
4221c4553
<    STMT_CURSOR := DBMS_SQL.OPEN_CURSOR;
---
> 
4223c4555,4557
<    DBMS_SYS_SQL.PARSE_AS_USER(STMT_CURSOR, 'RENAME ' ||
---
>    SELECT USERNAME INTO SESSION_USER FROM ALL_USERS WHERE USER_ID = SESSION_USERID ;
> 
>    EXECUTE_STMTCUSR('RENAME ' ||
4225,4228c4559
<      DBMS_ASSERT.ENQUOTE_NAME(DQT|| 'AQ$_' ||QT_NAME|| '_I' ||DQT),
<      DBMS_SQL.V7, SESSION_USERID);
<    IGNORE := DBMS_SQL.EXECUTE(STMT_CURSOR);
<    DBMS_SQL.CLOSE_CURSOR(STMT_CURSOR);
---
>      DBMS_ASSERT.ENQUOTE_NAME(DQT|| 'AQ$_' ||QT_NAME|| '_I' ||DQT), SESSION_USER);
4231c4562
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' || 
---
>    EXECUTE_STMT3(' alter table ' || 
4239c4570
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4243c4574
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4249c4580
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4253c4584
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4257c4588
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4261c4592
<    DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>    EXECUTE_STMT3(' alter table ' ||
4312a4644,4645
>   TM_QRY_BNDS   AQ$_BND_ARRAY;
>   TM_QRY_CUR    SYS_REFCURSOR;
4313a4647,4648
>   UPDHIS_BNDS   AQ$_BND_ARRAY;
>   UPDHIS_CUR    SYS_REFCURSOR;
4314a4650,4651
>   UPDSTATE_BNDS AQ$_BND_ARRAY;
>   UPDSTATE_CUR  SYS_REFCURSOR;
4326a4664,4665
>    
>    
4337c4676,4682
<        EXECUTE IMMEDIATE TM_QUERY INTO TMINFO USING MSGID;
---
>        TM_QRY_BNDS := AQ$_BND_ARRAY(AQ$_BND(RAW_VAL => MSGID));
>        TM_QRY_CUR := KWQAEXGCUR(TM_QUERY, TM_QRY_BNDS);
>        FETCH TM_QRY_CUR INTO TMINFO;
>        IF (TM_QRY_CUR%NOTFOUND) THEN
>          TMINFO := NULL;
>        END IF;
>        CLOSE TM_QRY_CUR;
4352c4697,4700
<      EXECUTE IMMEDIATE QTUPDSTATE USING TMINFO, RID;
---
>      UPDSTATE_BNDS :=  AQ$_BND_ARRAY(AQ$_BND(TM_VAL => TMINFO),
>                                      AQ$_BND(UROWID_VAL => RID));
>      UPDSTATE_CUR := KWQAEXGCUR(QTUPDSTATE, UPDSTATE_BNDS);
>      CLOSE UPDSTATE_CUR;
4447a4796,4797
>   HIS_QRY_BNDS  AQ$_BND_ARRAY;          
>   HIS_QRY_CUR   SYS_REFCURSOR;              
4476,4477d4825
<   TYPE RT IS    REF CURSOR;		  	
<   HIS_RC	RT;
4484a4833,4834
>   DEQINS_BNDS   AQ$_BND_ARRAY;         
>   DEQINS_CUR    SYS_REFCURSOR;             
4485a4836,4837
>   DEQUPD_BNDS   AQ$_BND_ARRAY;         
>   DEQUPD_CUR    SYS_REFCURSOR;             
4508a4861
>   SESSION_USER     VARCHAR2(128);
4581c4934,4935
<       EXECUTE IMMEDIATE NO_CMPRS_SQL;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);
>       
4588c4942,4943
<           EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
>           
4593c4948
<     DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>     EXECUTE_STMT3(' alter table ' ||
4597c4952
<     DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>     EXECUTE_STMT3(' alter table ' ||
4636c4991,4993
<     OPEN HIS_RC FOR HIS_QUERY;			    
---
>     
>     HIS_QRY_BNDS := AQ$_BND_ARRAY();
>     HIS_QRY_CUR := KWQAEXGCUR(HIS_QUERY, HIS_QRY_BNDS);
4638,4641c4995,4998
<       FETCH HIS_RC INTO MSGID, ADDRESS, PROTOCOL, CONSUMER_NAME, DEQ_TIME, 
<  		        DEQ_TXN_ID, DEQ_USER, PMID, QNAME, RID, STATE, 
< 			PRIORITY, ENQTIME, ENQTID, STEPNO, CHAINNO, LOCALNO;
<       EXIT WHEN HIS_RC%NOTFOUND;
---
>       FETCH HIS_QRY_CUR INTO MSGID, ADDRESS, PROTOCOL, CONSUMER_NAME, DEQ_TIME, 
>  		             DEQ_TXN_ID, DEQ_USER, PMID, QNAME, RID, STATE, 
> 			     PRIORITY, ENQTIME, ENQTID, STEPNO, CHAINNO, LOCALNO;
>       EXIT WHEN HIS_QRY_CUR%NOTFOUND;
4677,4679c5034,5042
< 	    EXECUTE IMMEDIATE DEQINSERT 	      	      
< 	    USING QNAME, CONSUMER_NAME, PRIORITY, ENQTIME, ENQTID, STEPNO, 
< 		  CHAINNO, LOCALNO, RID, REMOTE_APPS;
---
>             
>             DEQINS_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QNAME),
>               AQ$_BND(STR_VAL => CONSUMER_NAME), AQ$_BND(NUM_VAL => PRIORITY),
>               AQ$_BND(TM_VAL => ENQTIME), AQ$_BND(STR_VAL => ENQTID),
>               AQ$_BND(NUM_VAL => STEPNO), AQ$_BND(NUM_VAL => CHAINNO),
>               AQ$_BND(NUM_VAL => LOCALNO),AQ$_BND(UROWID_VAL => RID),
>               AQ$_BND(STR_VAL => REMOTE_APPS));
>             DEQINS_CUR := KWQAEXGCUR(DEQINSERT, DEQINS_BNDS);
>             CLOSE DEQINS_CUR;     
4695,4697c5058,5066
< 	      EXECUTE IMMEDIATE DEQINSERT 		      
< 	      USING QNAME, PROXY, PRIORITY, ENQTIME, ENQTID, STEPNO, CHAINNO,
< 		    LOCALNO, RID, REMOTE_APPS;
---
>               
>               DEQINS_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QNAME),
>                 AQ$_BND(STR_VAL => PROXY), AQ$_BND(NUM_VAL => PRIORITY),
>                 AQ$_BND(TM_VAL => ENQTIME), AQ$_BND(STR_VAL => ENQTID),
>                 AQ$_BND(NUM_VAL => STEPNO), AQ$_BND(NUM_VAL => CHAINNO),
>                 AQ$_BND(NUM_VAL => LOCALNO),AQ$_BND(UROWID_VAL => RID),
>                 AQ$_BND(STR_VAL => REMOTE_APPS));
>               DEQINS_CUR := KWQAEXGCUR(DEQINSERT, DEQINS_BNDS);
>               CLOSE DEQINS_CUR;     
4705,4706c5074,5080
< 	  EXECUTE IMMEDIATE DEQUPDATE	     
< 	  USING HISTORY(BUCKETNO).REMOTE_APPS, QNAME, PROXY, RID;
---
>           
>           DEQUPD_BNDS := AQ$_BND_ARRAY(
>             AQ$_BND(STR_VAL => HISTORY(BUCKETNO).REMOTE_APPS),
>              AQ$_BND(STR_VAL => QNAME), AQ$_BND(STR_VAL => PROXY),
>              AQ$_BND(UROWID_VAL => RID)); 
>           DEQUPD_CUR := KWQAEXGCUR(DEQUPDATE, DEQUPD_BNDS);
>           CLOSE DEQUPD_CUR; 
4712,4713c5086,5091
< 	EXECUTE IMMEDIATE DEQUPDATE 	     
< 	USING DEQHIS.REMOTE_APPS, QNAME, DEQHIS.CONSUMER, RID;
---
>         
>         DEQUPD_BNDS := AQ$_BND_ARRAY(
>           AQ$_BND(STR_VAL => DEQHIS.REMOTE_APPS), AQ$_BND(STR_VAL => QNAME),
>           AQ$_BND(STR_VAL => DEQHIS.CONSUMER), AQ$_BND(UROWID_VAL => RID)); 
>         DEQUPD_CUR := KWQAEXGCUR(DEQUPDATE, DEQUPD_BNDS);
>         CLOSE DEQUPD_CUR; 
4740,4742c5118,5126
< 	      EXECUTE IMMEDIATE DEQINSERT 		      
< 	      USING QNAME, PROXY, PRIORITY, ENQTIME, ENQTID, STEPNO, CHAINNO,
< 		    LOCALNO, RID, REMOTE_APPS;
---
>               
>               DEQINS_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QNAME),
>                 AQ$_BND(STR_VAL => PROXY), AQ$_BND(NUM_VAL => PRIORITY),
>                 AQ$_BND(TM_VAL => ENQTIME), AQ$_BND(STR_VAL => ENQTID),
>                 AQ$_BND(NUM_VAL => STEPNO), AQ$_BND(NUM_VAL => CHAINNO),
>                 AQ$_BND(NUM_VAL => LOCALNO),AQ$_BND(UROWID_VAL => RID),
>                 AQ$_BND(STR_VAL => REMOTE_APPS));
>               DEQINS_CUR := KWQAEXGCUR(DEQINSERT, DEQINS_BNDS);
>               CLOSE DEQINS_CUR;     
4748,4749c5132,5137
< 	    EXECUTE IMMEDIATE DEQUPDATE      
< 	    USING RCPT_LIST, QNAME, DEQHIS.CONSUMER, RID;
---
>             
>             DEQUPD_BNDS := AQ$_BND_ARRAY(
>               AQ$_BND(STR_VAL => RCPT_LIST), AQ$_BND(STR_VAL => QNAME),
>               AQ$_BND(STR_VAL => DEQHIS.CONSUMER), AQ$_BND(UROWID_VAL => RID)); 
>             DEQUPD_CUR := KWQAEXGCUR(DEQUPDATE, DEQUPD_BNDS);
>             CLOSE DEQUPD_CUR; 
4766a5155
>     CLOSE HIS_QRY_CUR;
4779c5168
<    STMT_CURSOR := DBMS_SQL.OPEN_CURSOR;
---
> 
4781,4785c5170,5174
<    DBMS_SYS_SQL.PARSE_AS_USER(STMT_CURSOR, 
<      'RENAME ' || 'AQ$_' || DBMS_ASSERT.SIMPLE_SQL_NAME(QT_NAME) || '_J TO ' ||
<      'AQ$_' || DBMS_ASSERT.SIMPLE_SQL_NAME(QT_NAME) || '_I', DBMS_SQL.V7, SESSION_USERID);
<    IGNORE := DBMS_SQL.EXECUTE(STMT_CURSOR);
<    DBMS_SQL.CLOSE_CURSOR(STMT_CURSOR);
---
>    SELECT USERNAME INTO SESSION_USER FROM ALL_USERS WHERE USER_ID = SESSION_USERID ;
> 
>    EXECUTE_STMTCUSR('RENAME ' || 'AQ$_' ||
>      DBMS_ASSERT.SIMPLE_SQL_NAME(QT_NAME) || '_J TO ' || 'AQ$_' ||
>      DBMS_ASSERT.SIMPLE_SQL_NAME(QT_NAME) || '_I', SESSION_USER);
4796c5185
<     DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' || 
---
>     EXECUTE_STMT3(' alter table ' || 
4800c5189
<     DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' ||
---
>     EXECUTE_STMT3(' alter table ' ||
4804c5193
<     DBMS_AQADM_INV.EXECUTE_STMT2(' alter table ' || 
---
>     EXECUTE_STMT3(' alter table ' || 
4815c5204
<     DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE INDEX ' || 
---
>     EXECUTE_STMT3(' CREATE INDEX ' || 
5412c5801
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '            ||
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           ||
5419c5808
<                                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                                ' WITH READ ONLY', FALSE, TRUE);
5692c6081
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '            ||
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           ||
5699c6088
<                                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                                ' WITH READ ONLY', FALSE, TRUE);
5856c6245
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '            ||
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           ||
5863c6252
<                                ' WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                                ' WITH READ ONLY', FALSE, TRUE);
5987c6376
<   DBMS_AQADM_INV.EXECUTE_STMT2(' CREATE OR REPLACE FORCE VIEW '            ||
---
>   EXECUTE_STMT3(' CREATE OR REPLACE FORCE VIEW '                           ||
5994c6383
<                                ') WITH READ ONLY', FALSE, FALSE, TRUE);
---
>                                ') WITH READ ONLY', FALSE, TRUE);
5996,6058d6384
< 
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
SYS.DBMS_PRVTAQIS - PACKAGE BODY (RU):
24c24
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
28a29,60
>   UNIQUENESS_CONSTRAINT_VIOLATED EXCEPTION;
>   PRAGMA EXCEPTION_INIT(UNIQUENESS_CONSTRAINT_VIOLATED, -1);
> 
>   TABLE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
> 
>   INDEX_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INDEX_DOES_NOT_EXIST, -1418);
> 
>   NAME_IN_USE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(NAME_IN_USE, -955);
> 
>   INVALID_COLUMN EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INVALID_COLUMN, -904);
> 
>   COLUMN_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COLUMN_EXISTS, -1430);
> 
>   PRIMARY_KEY_EXISTS EXCEPTION;
>   PRAGMA EXCEPTION_INIT(PRIMARY_KEY_EXISTS, -2260);
> 
>   COMPILE_ERROR  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(COMPILE_ERROR, -24344);
> 
>   SEQUENCE_DOES_NOT_EXIST EXCEPTION;
>   PRAGMA EXCEPTION_INIT(SEQUENCE_DOES_NOT_EXIST, -2289);
> 
>   OBJECT_ALREADY_EXISTS  EXCEPTION;
>   PRAGMA EXCEPTION_INIT(OBJECT_ALREADY_EXISTS, -955);
> 
>   
>   
32a65,292
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
> 
>   PROCEDURE AQ_INTERNAL_EXESTMT(
>               SQL_STMT         IN      VARCHAR2,
>               OPCODE           IN      NUMBER          DEFAULT NULL,
>               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
>               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
>               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
>               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
>               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
>               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
>               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
>               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
>               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
>               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               OUT_RAW_PARAM1   OUT     RAW,
>               OUT_RAW_PARAM2   OUT     RAW,
>               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
>               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
>               OUT_INT_PARAM1   OUT     PLS_INTEGER,
>               OUT_INT_PARAM2   OUT     PLS_INTEGER,
>               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
>               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
>   IS EXTERNAL 
>      NAME "aq_internal_exeStmt"
>      WITH CONTEXT
>      PARAMETERS(CONTEXT,
>                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
>                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
>                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
>                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
>                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
>                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
>                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
>                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
>                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
>                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
>                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
>                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
>                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
>                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
>                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
>                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
>                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
>                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
>                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
>                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
>                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
>                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
>                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
>                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
>                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
>                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
>                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
>                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
>      LIBRARY DBMS_AQINT_LIB;
> 
>   
>   
>   
>   PROCEDURE EXECUTE_STMT_IN_KERNEL_CURSOR(
>               SQL_STMT        IN VARCHAR2,
>               IGNORE_DDL      IN BOOLEAN DEFAULT TRUE,
>               OPCODE          IN NUMBER  DEFAULT NULL,
>               BYPASS_DV       IN BOOLEAN DEFAULT TRUE,
>               BYPASS_AUDIT    IN BOOLEAN DEFAULT TRUE,
>               IN_STR_ARRAY    IN STR_ARRAY_TYPE DEFAULT NULL,
>               IN_STRPOS_ARRAY IN NUM_ARRAY_TYPE  DEFAULT NULL,
>               IN_NUM_ARRAY    IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_NUMPOS_ARRAY IN NUM_ARRAY_TYPE DEFAULT NULL,
>               IN_RAW_PARAM1   IN RAW DEFAULT NULL,
>               IN_RAW_PARAM2   IN RAW DEFAULT NULL,
>               IN_TIME_PARAM1  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
>               IN_TIME_PARAM2  IN TIMESTAMP WITH TIME ZONE DEFAULT NULL) IS
> 
>   OUT_STR_ARR    STR_ARRAY_TYPE;
>   OUT_NUM_ARR    NUM_ARRAY_TYPE;
>   OUT_RAW_PRM1   RAW(32737);
>   OUT_RAW_PRM2   RAW(32737);
>   OUT_BINT_PRM1  BINARY_INTEGER;
>   OUT_BINT_PRM2  BINARY_INTEGER;
>   OUT_INT_PRM1   PLS_INTEGER;
>   OUT_INT_PRM2   PLS_INTEGER;
>   OUT_TIME_PRM1  TIMESTAMP WITH TIME ZONE;
>   OUT_TIME_PRM2  TIMESTAMP WITH TIME ZONE;
>   BEGIN
>     AQ_INTERNAL_EXESTMT(
>                 SQL_STMT       =>      SQL_STMT,
>                 OPCODE         =>      OPCODE,
>                 BYPASS_DV      =>      BYPASS_DV,
>                 BYPASS_AUDIT   =>      BYPASS_AUDIT,
>                 IN_STR_ARRAY   =>      IN_STR_ARRAY,
>                 IN_STRPOS_ARRAY=>      IN_STRPOS_ARRAY,
>                 IN_NUM_ARRAY   =>      IN_NUM_ARRAY,
>                 IN_NUMPOS_ARRAY=>      IN_NUMPOS_ARRAY,
>                 IN_RAW_PARAM1  =>      IN_RAW_PARAM1,
>                 IN_RAW_PARAM2  =>      IN_RAW_PARAM2,
>                 IN_TIME_PARAM1 =>      IN_TIME_PARAM1,
>                 IN_TIME_PARAM2 =>      IN_TIME_PARAM2,
>                 OUT_STR_ARRAY  =>      OUT_STR_ARR,
>                 OUT_STRPOS_ARRAY=>     NULL,
>                 OUT_NUM_ARRAY  =>      OUT_NUM_ARR,
>                 OUT_NUMPOS_ARRAY=>     NULL,
>                 IN_BINT_PARAM1 =>      NULL,
>                 IN_BINT_PARAM2 =>      NULL,
>                 IN_INT_PARAM1  =>      NULL,
>                 IN_INT_PARAM2  =>      NULL,
>                 OUT_RAW_PARAM1 =>      OUT_RAW_PRM1,
>                 OUT_RAW_PARAM2 =>      OUT_RAW_PRM2,
>                 OUT_BINT_PARAM1=>      OUT_BINT_PRM1,
>                 OUT_BINT_PARAM2=>      OUT_BINT_PRM2,
>                 OUT_INT_PARAM1 =>      OUT_INT_PRM1,
>                 OUT_INT_PARAM2 =>      OUT_INT_PRM2,
>                 OUT_TIME_PARAM1=>      OUT_TIME_PRM1,
>                 OUT_TIME_PARAM2=>      OUT_TIME_PRM1);
>   EXCEPTION  
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (IGNORE_DDL = FALSE) THEN
>         RAISE;
>       END IF;
>   END;
> 
>   
>   
>   
>   
>   
>   
> 
>   PROCEDURE EXECUTE_STMT3(STMT                   IN  VARCHAR2,
>                           IGNORE_DDL_ERROR       IN  BOOLEAN DEFAULT FALSE,
>                           IGNORE_COMPERR         IN  BOOLEAN DEFAULT FALSE) IS
> 
>   STREAMS_CAPTURE_OFF BOOLEAN;
> 
>   BEGIN
>     DBMS_AQADM_SYS.WRITE_TRACE(MESSAGE => 'execute_stmt3: '|| STMT);
>     STREAMS_CAPTURE_OFF := DBMS_AQADM_SYSCALLS.KWQA_3GL_ISSTREAMSCAPTUREOFF;
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(TRUE);
>     END IF;
>     EXECUTE_STMT_IN_KERNEL_CURSOR(STMT);
>     IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>       DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>     END IF;
>   EXCEPTION
>     WHEN TABLE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INDEX_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN NAME_IN_USE THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN INVALID_COLUMN THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN COLUMN_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN PRIMARY_KEY_EXISTS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN COMPILE_ERROR THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_COMPERR THEN
>         RAISE;
>       END IF;
>     WHEN SEQUENCE_DOES_NOT_EXIST THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       IF NOT IGNORE_DDL_ERROR THEN
>         RAISE;
>       END IF;
>     WHEN OTHERS THEN
>       IF (STREAMS_CAPTURE_OFF = FALSE) THEN
>         DBMS_AQADM_SYSCALLS.KWQA_3GL_SETSTREAMSCAPTUREOFF(FALSE);
>       END IF;
>       RAISE;
>   END;
> 
>   
173a434,435
>   BNDS          AQ$_BND_ARRAY;
>   CUR           SYS_REFCURSOR;
182c444,446
<     EXECUTE IMMEDIATE SEQQUERY INTO AGENTNO;
---
>     BNDS := AQ$_BND_ARRAY();
>     CUR := KWQAEXGCUR(SEQQUERY, BNDS);
>     FETCH CUR INTO AGENTNO;
186a451
>     CLOSE CUR;
212a478,479
>     BNDS              AQ$_BND_ARRAY;
>     CUR               SYS_REFCURSOR;
250,254c517,519
<     BEGIN    
<       EXECUTE IMMEDIATE SUB_QUERY INTO SUB_NAME
<  	USING Q_NAME, SUB.ADDRESS, SUB.PROTOCOL;
< 
<       
---
>     BEGIN
>       BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>         AQ$_BND(STR_VAL => SUB.ADDRESS), AQ$_BND(NUM_VAL => SUB.PROTOCOL));
256,258c521,528
<       
<       SUB_NAME_COND := FALSE;
<  
---
>       CUR := KWQAEXGCUR(SUB_QUERY, BNDS);
>       FETCH CUR INTO SUB_NAME;
>       IF (CUR%FOUND) THEN
>         SUB_NAME_COND := FALSE;
>       ELSE
>         SUB_NAME_COND := TRUE;
>       END IF;
>       CLOSE CUR;
260,261d529
<       WHEN NO_DATA_FOUND THEN
<            SUB_NAME_COND := TRUE;
453a722,723
>     BNDS              AQ$_BND_ARRAY;
>     CUR               SYS_REFCURSOR;
467c737,746
<       EXECUTE IMMEDIATE SUB_QUERY INTO TMP;
---
>       BNDS := AQ$_BND_ARRAY();
>       CUR := KWQAEXGCUR(SUB_QUERY, BNDS);
>       FETCH CUR INTO TMP;
>       IF (CUR%NOTFOUND) THEN
>         CLOSE CUR;
>         RETURN FALSE;
>       ELSE
>         CLOSE CUR;
>         RETURN TRUE;
>       END IF;
470,471d748
<        WHEN NO_DATA_FOUND THEN
<          RETURN FALSE;
572c849,850
<   SUB_CURSOR    INTEGER;
---
>   SUB_BNDS      AQ$_BND_ARRAY;
>   SUB_CURSOR    SYS_REFCURSOR;
601,607c879,880
<       SUB_CURSOR := DBMS_SQL.OPEN_CURSOR;
<       DBMS_SQL.PARSE(SUB_CURSOR, SUB_QUERY, DBMS_SQL.V7); 
<       DBMS_SQL.BIND_VARIABLE(SUB_CURSOR, ':1', Q_NAME);
<       DBMS_SQL.DEFINE_COLUMN(SUB_CURSOR, 1, NAME, M_IDEN_LEN);
<       DBMS_SQL.DEFINE_COLUMN(SUB_CURSOR, 2, ADDRESS, ADDR_LEN);
<       DBMS_SQL.DEFINE_COLUMN(SUB_CURSOR, 3, PROTOCOL);
<       IGNORE := DBMS_SQL.EXECUTE(SUB_CURSOR);
---
>       SUB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME));
>       SUB_CURSOR := KWQAEXGCUR(SUB_QUERY, SUB_BNDS);
611,621c884,889
<         IF DBMS_SQL.FETCH_ROWS(SUB_CURSOR) > 0 THEN
<           DBMS_SQL.COLUMN_VALUE(SUB_CURSOR, 1, NAME);
<           DBMS_SQL.COLUMN_VALUE(SUB_CURSOR, 2, ADDRESS);
<           DBMS_SQL.COLUMN_VALUE(SUB_CURSOR, 3, PROTOCOL);
<           WRITE_TRACE('queue_subscribers: aq$_agent(' || NAME || ',' || ADDRESS || ', 0)');
<           SUB := SYS.AQ$_AGENT(NAME, ADDRESS, PROTOCOL);  
<           SUBSTAB(K) := SUB;                            
<           K := K + 1;   
<         ELSE                                            
<           EXIT;
<         END IF;
---
>         FETCH SUB_CURSOR INTO NAME, ADDRESS, PROTOCOL;
>         EXIT WHEN SUB_CURSOR%NOTFOUND;
>         WRITE_TRACE('queue_subscribers: aq$_agent(' || NAME || ',' || ADDRESS || ', 0)');
>         SUB := SYS.AQ$_AGENT(NAME, ADDRESS, PROTOCOL);  
>         SUBSTAB(K) := SUB;                            
>         K := K + 1;   
623,624c891
< 
<       DBMS_SQL.CLOSE_CURSOR(SUB_CURSOR);
---
>       CLOSE SUB_CURSOR;
650,651c917,918
<         IF DBMS_SQL.IS_OPEN(SUB_CURSOR) THEN
< 	  DBMS_SQL.CLOSE_CURSOR(SUB_CURSOR);
---
>         IF (SUB_CURSOR%ISOPEN) THEN
> 	  CLOSE SUB_CURSOR;
695a963,964
>   SUBTAB_BNDS  AQ$_BND_ARRAY;
>   SUBTAB_CUR   SYS_REFCURSOR;
772,778c1041,1052
< 
<       EXECUTE IMMEDIATE SUBTABQUERY INTO PROXYNO
<       USING   Q_NAME, PROXY_ADDR, PROXY_PROT;
< 
<       PEXIST := TRUE;
<       RETURN; 				         
< 
---
>       SUBTAB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>                                    AQ$_BND(STR_VAL => PROXY_ADDR),
>                                    AQ$_BND(NUM_VAL => PROXY_PROT));
>       SUBTAB_CUR := KWQAEXGCUR(SUBTABQUERY, SUBTAB_BNDS);
>       FETCH SUBTAB_CUR INTO  PROXYNO;
>       IF (SUBTAB_CUR%FOUND) THEN
>         CLOSE SUBTAB_CUR;   
>         PEXIST := TRUE;
>         RETURN; 	         
>       ELSE
>         CLOSE SUBTAB_CUR;
>       END IF;
780,781d1053
<       WHEN NO_DATA_FOUND THEN
<         NULL;
787,790c1059,1062
<     DBMS_AQADM_INV.EXECUTE_STMT2(' LOCK TABLE ' ||
<                  DBMS_ASSERT.ENQUOTE_NAME(DQT||Q_SCHEMA||DQT) || '.' || 
<                  DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) || 
<                  ' IN EXCLUSIVE MODE ');
---
>     EXECUTE_STMT3(' LOCK TABLE ' ||
>                   DBMS_ASSERT.ENQUOTE_NAME(DQT||Q_SCHEMA||DQT) || '.' || 
>                   DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) || 
>                   ' IN EXCLUSIVE MODE ');
795,799c1067,1078
<       EXECUTE IMMEDIATE SUBTABQUERY INTO PROXYNO
<       USING Q_NAME, PROXY_ADDR, PROXY_PROT;
< 
<       PEXIST := TRUE;
<       RETURN;
---
>       SUBTAB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>                                    AQ$_BND(STR_VAL => PROXY_ADDR),
>                                    AQ$_BND(NUM_VAL => PROXY_PROT));
>       SUBTAB_CUR := KWQAEXGCUR(SUBTABQUERY, SUBTAB_BNDS);
>       FETCH SUBTAB_CUR INTO  PROXYNO;
>       IF (SUBTAB_CUR%FOUND) THEN
>         CLOSE SUBTAB_CUR;   
>         PEXIST := TRUE;
>         RETURN; 	         
>       ELSE
>         CLOSE SUBTAB_CUR;
>       END IF;
802,803d1080
<       WHEN NO_DATA_FOUND THEN
< 	NULL;
835,838c1112,1117
< 
<     EXECUTE IMMEDIATE SUBTABINSERT
<     USING   PROXYNO, Q_NAME, PROXY_ADDR, PROXY_PROT, PROXY_FLAG;
< 
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTABINSERT,
>       IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, PROXY_ADDR),
>       IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2,3),
>       IN_NUM_ARRAY => NUM_ARRAY_TYPE(PROXYNO, PROXY_PROT, PROXY_FLAG),
>       IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 4, 5));
>                                   
940c1219
<       DBMS_AQADM_INV.EXECUTE_STMT2(' LOCK TABLE ' ||
---
>       EXECUTE_STMT3(' LOCK TABLE ' ||
979,980c1258,1262
<        EXECUTE IMMEDIATE ADDRADD
<        USING   ADDRID, Q_NAME, AGENT_ADDRESS, AGENT_PROTOCOL;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(ADDRADD,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, AGENT_ADDRESS),
>         IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2,3),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(ADDRID, AGENT_PROTOCOL),
>         IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 4));
1039a1322,1323
>     SUB_COUNT_BNDS     AQ$_BND_ARRAY;
>     SUB_COUNT_CUR      SYS_REFCURSOR;
1040a1325,1326
>     REMOTE_SUB_BNDS    AQ$_BND_ARRAY;
>     REMOTE_SUB_CUR     SYS_REFCURSOR;
1131c1417,1421
<     EXECUTE IMMEDIATE SUB_COUNT_STMT INTO SUB_COUNT USING Q_NAME, 1, 1;
---
>     SUB_COUNT_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>       AQ$_BND(NUM_VAL => 1), AQ$_BND(NUM_VAL => 1));
>     SUB_COUNT_CUR := KWQAEXGCUR(SUB_COUNT_STMT, SUB_COUNT_BNDS);
>     FETCH SUB_COUNT_CUR INTO SUB_COUNT;
>     CLOSE SUB_COUNT_CUR;
1144,1147c1434
<                        ' AND (bitand(subscriber_type, :3) = :4) ' ;
< 
<     EXECUTE IMMEDIATE REMOTE_SUB_STMT INTO REMOTE_SUB_COUNT
<       USING Q_NAME, SUB.ADDRESS, 1, 1;
---
>                        ' AND (bitand(subscriber_type, :3) = :4) ';
1148a1436,1442
>     REMOTE_SUB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>       AQ$_BND(STR_VAL => SUB.ADDRESS), AQ$_BND(NUM_VAL => 1),
>       AQ$_BND(NUM_VAL => 1));
>     REMOTE_SUB_CUR := KWQAEXGCUR(REMOTE_SUB_STMT, REMOTE_SUB_BNDS);
>     FETCH REMOTE_SUB_CUR INTO REMOTE_SUB_COUNT;
>     CLOSE REMOTE_SUB_CUR;
>                   
1304a1599,1600
>   SUBTAB_BNDS        AQ$_BND_ARRAY;
>   SUBTAB_CUR         SYS_REFCURSOR;
1428,1429c1724,1729
<       EXECUTE IMMEDIATE DEQIOT_SQL
<       USING SUBID, '0', SUB.NAME;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(DEQIOT_SQL,
>         IN_STR_ARRAY => STR_ARRAY_TYPE('0', SUB.NAME),
>         IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2,3),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID),
>         IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1));
> 
1436,1437d1735
<        EXECUTE IMMEDIATE HIOT_SQL
<        USING SUBID, '0', '0', SUB.NAME;
1439,1443c1737,1747
<        IF ADDRID = 0 OR (BITAND(SUBSCR_TYPE, 4) != 4) THEN
<          ADD_ADDRESS_1(Q_SCHEMA, Q_NAME, SUBTAB_NAME, SUBSCR_TYPE,
<                        DQT||Q_SCHEMA||DQT || '.' || DQT||Q_NAME||DQT, 0,
<                        ADDRID);
<        END IF;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(HIOT_SQL,
>         IN_STR_ARRAY => STR_ARRAY_TYPE('0', '0', SUB.NAME),
>         IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3, 4),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID),
>         IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1));
> 
>       IF ADDRID = 0 OR (BITAND(SUBSCR_TYPE, 4) != 4) THEN
>         ADD_ADDRESS_1(Q_SCHEMA, Q_NAME, SUBTAB_NAME, SUBSCR_TYPE,
>                       DQT||Q_SCHEMA||DQT || '.' || DQT||Q_NAME||DQT, 0,
>                       ADDRID);
>       END IF;
1470a1775,1781
>  
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTAB_SQL,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(RULE_NAME, CONCAT_TRANS, CONCAT_RULESET,
>                                        CONCAT_NEG_RULESET),
>         IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3, 4, 5),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUB_FLAG, SUBID),
>         IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 6));
1472,1474d1782
<       EXECUTE IMMEDIATE SUBTAB_SQL
<       USING   SUB_FLAG, RULE_NAME, CONCAT_TRANS, CONCAT_RULESET,
<               CONCAT_NEG_RULESET, SUBID;
1484,1486c1792,1798
<       EXECUTE IMMEDIATE SUBTAB_SQL
<       USING SUBID, Q_NAME, SUB.NAME, SUB.ADDRESS, SUB.PROTOCOL, SUB_FLAG,
<             RULE_NAME, CONCAT_TRANS, CONCAT_RULESET, CONCAT_NEG_RULESET;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTAB_SQL,
>         IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, SUB.NAME, SUB.ADDRESS,
>                           RULE_NAME, CONCAT_TRANS, CONCAT_RULESET,
>                           CONCAT_NEG_RULESET),
>         IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3, 4, 7, 8, 9, 10),
>         IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID, SUB.PROTOCOL, SUB_FLAG),
>         IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 5, 6));
1498c1810,1813
<           EXECUTE IMMEDIATE SUBTAB_SQL USING CUR_QT_TIME, ADD_SCN, SUBID ;
---
>         SUBTAB_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>           AQ$_BND(STR_VAL => ADD_SCN), AQ$_BND(NUM_VAL => SUBID));
>         SUBTAB_CUR := KWQAEXGCUR(SUBTAB_SQL, SUBTAB_BNDS);
>         CLOSE SUBTAB_CUR;
1596,1599c1911,1914
<       DBMS_AQADM_INV.EXECUTE_STMT2(' LOCK TABLE ' || 
<                    DBMS_ASSERT.ENQUOTE_NAME(DQT||Q_SCHEMA||DQT) || '.' ||
<                    DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) || 
< 		   ' IN EXCLUSIVE MODE ');
---
>       EXECUTE_STMT3(' LOCK TABLE ' || 
>                     DBMS_ASSERT.ENQUOTE_NAME(DQT||Q_SCHEMA||DQT) || '.' ||
>                     DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) || 
> 		    ' IN EXCLUSIVE MODE ');
1616,1618c1931,1935
<           EXECUTE IMMEDIATE RCPTADD
<           USING   RCPTID, Q_NAME, AGENT_NAME, AGENT_ADDRESS, 0, PRVTAQIS_BUFFERED_RECP ;
< 
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(RCPTADD,
>             IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, AGENT_NAME, AGENT_ADDRESS),
>             IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3, 4),
>             IN_NUM_ARRAY => NUM_ARRAY_TYPE(RCPTID, 0, PRVTAQIS_BUFFERED_RECP),
>             IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 5, 6));
1646a1964,1965
>     SUBTAB_BNDS        AQ$_BND_ARRAY;
>     SUBTAB_CUR         SYS_REFCURSOR;
1709c2028,2029
<     EXECUTE IMMEDIATE SUBTAB_SQL USING SUBID ;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTAB_SQL,
>       IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID));
1718c2038,2042
<        EXECUTE IMMEDIATE SUBTAB_SQL USING CUR_QT_TIME, REMOVE_SCN, SUBID ;
---
> 
>        SUBTAB_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>          AQ$_BND(STR_VAL => REMOVE_SCN), AQ$_BND(NUM_VAL => SUBID));
>        SUBTAB_CUR := KWQAEXGCUR(SUBTAB_SQL, SUBTAB_BNDS);
>        CLOSE SUBTAB_CUR;
1770a2095,2096
>     SUB_UPD_BNDS          AQ$_BND_ARRAY;
>     SUB_UPD_CUR           SYS_REFCURSOR;
1953,1955c2279,2284
<         EXECUTE IMMEDIATE SUB_UPDATE 
< 	  USING NEW_RULE_NAME, NEW_TRANS_NAME, FULL_RULESET, FULL_NEG_RULESET,
<                 CUR_QT_TIME, SUBID ;
---
>         SUB_UPD_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => NEW_RULE_NAME),
>           AQ$_BND(STR_VAL => NEW_TRANS_NAME), AQ$_BND(STR_VAL => FULL_RULESET),
>           AQ$_BND(STR_VAL => FULL_NEG_RULESET), AQ$_BND(TM_VAL => CUR_QT_TIME),
>           AQ$_BND(NUM_VAL => SUBID));
>         SUB_UPD_CUR := KWQAEXGCUR(SUB_UPDATE, SUB_UPD_BNDS);
>         CLOSE SUB_UPD_CUR;
1970c2299,2302
<              EXECUTE IMMEDIATE SUB_UPDATE USING CUR_QT_TIME, SUBID ;
---
>              SUB_UPD_BNDS := AQ$_BND_ARRAY(AQ$_BND(TM_VAL => CUR_QT_TIME),
>                AQ$_BND(NUM_VAL => SUBID));
>              SUB_UPD_CUR := KWQAEXGCUR(SUB_UPDATE, SUB_UPD_BNDS);
>              CLOSE SUB_UPD_CUR;
1994c2326
<      DBMS_AQADM_INV.EXECUTE_STMT2(' DELETE FROM ' || 
---
>      EXECUTE_STMT3(' DELETE FROM ' || 
2002c2334
<      DBMS_AQADM_INV.EXECUTE_STMT2(' DELETE FROM SYS.AQ$_SUBSCRIBER_TABLE ' || 
---
>     DBMS_AQADM_INV.EXECUTE_STMT2(' DELETE FROM SYS.AQ$_SUBSCRIBER_TABLE ' || 
2175c2507
<         DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE '
---
>        EXECUTE_STMT3('CREATE TABLE '
2197c2529
<         DBMS_AQADM_INV.EXECUTE_STMT2('CREATE TABLE '
---
>        EXECUTE_STMT3('CREATE TABLE '
2220c2552
<     DBMS_AQADM_INV.EXECUTE_STMT2('ALTER TABLE '
---
>      EXECUTE_STMT3('ALTER TABLE '
2276c2608
<     DBMS_AQADM_INV.EXECUTE_STMT2('DROP TABLE '|| 
---
>     EXECUTE_STMT3('DROP TABLE '|| 
2279c2611
<                   IGNORE_DDL_ERROR, TRUE);
---
>                   IGNORE_DDL_ERROR);
2305c2637
<     DBMS_AQADM_INV.EXECUTE_STMT('CREATE OR REPLACE VIEW '                    || 
---
>     EXECUTE_STMT3('CREATE OR REPLACE VIEW '                    || 
2342c2674
<     DBMS_AQADM_INV.EXECUTE_STMT2( ' DROP VIEW ' || 
---
>     EXECUTE_STMT3(' DROP VIEW ' || 
2363c2695
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE SEQUENCE '|| 
---
>     EXECUTE_STMT3('CREATE SEQUENCE '|| 
2386c2718
<     DBMS_AQADM_INV.EXECUTE_STMT2( 'DROP SEQUENCE '|| 
---
>     EXECUTE_STMT3( 'DROP SEQUENCE '|| 
2397,2398d2728
<     TYPE RS_CUR_TYPE  IS REF CURSOR;
<     A_CV              RS_CUR_TYPE;
2399a2730,2731
>     A_SEL_BNDS        AQ$_BND_ARRAY;
>     A_SEL_CUR         SYS_REFCURSOR;
2429c2761,2762
<     OPEN A_CV FOR A_SEL_SQL;
---
>     A_SEL_BNDS := AQ$_BND_ARRAY();
>     A_SEL_CUR := KWQAEXGCUR(A_SEL_SQL, A_SEL_BNDS);
2431,2432c2764,2765
<         FETCH A_CV INTO SUB_NAME, OLD_ADDRESS, SUB_ID;
<         EXIT WHEN A_CV%NOTFOUND;
---
>         FETCH A_SEL_CUR INTO SUB_NAME, OLD_ADDRESS, SUB_ID;
>         EXIT WHEN A_SEL_CUR%NOTFOUND;
2469c2802,2804
<         EXECUTE IMMEDIATE A_UPD_SQL USING NEW_ADDRESS, SUB_ID;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(A_UPD_SQL,
>           IN_STR_ARRAY => STR_ARRAY_TYPE(NEW_ADDRESS),
>           IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUB_ID));
2471c2806
<     CLOSE A_CV;    
---
>     CLOSE A_SEL_CUR;    
2496a2832,2833
>   SUBSEQ_BNDS       AQ$_BND_ARRAY;
>   SUBSEQ_CUR        SYS_REFCURSOR;
2499a2837,2838
>   SQL_BNDS          AQ$_BND_ARRAY;
>   SQL_CUR           SYS_REFCURSOR;
2557,2558c2896,2900
<     BEGIN		    
<       EXECUTE IMMEDIATE SUBSEQ_QUERY INTO MAX_SID;
---
>     BEGIN
>       SUBSEQ_BNDS := AQ$_BND_ARRAY();
>       SUBSEQ_CUR := KWQAEXGCUR(SUBSEQ_QUERY, SUBSEQ_BNDS);
>       FETCH SUBSEQ_CUR INTO  MAX_SID;
>       CLOSE SUBSEQ_CUR;
2569c2911
<       DBMS_AQADM_INV.EXECUTE_STMT2('DROP SEQUENCE ' ||
---
>       EXECUTE_STMT3('DROP SEQUENCE ' ||
2582c2924
<     DBMS_AQADM_INV.EXECUTE_STMT2('CREATE SEQUENCE '|| 
---
>     EXECUTE_STMT3('CREATE SEQUENCE '|| 
2627c2969
<           EXECUTE IMMEDIATE NO_CMPRS_SQL;               
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);               
2634c2976
<             EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>             EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
2645c2987
<         EXECUTE IMMEDIATE SUB_TXFM_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(SUB_TXFM_SQL);
2708c3050
<         EXECUTE IMMEDIATE NO_CMPRS_SQL;                 
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);     
2716c3058
<           EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
2727c3069
<       EXECUTE IMMEDIATE SUB_RSET_SQL;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SUB_RSET_SQL);
2777,2781c3119,3122
<         EXECUTE IMMEDIATE SQLTXT INTO DUMMY USING SCHEMA ;
<         BADSUBFK := TRUE;
<         WRITE_TRACE('bad fkey: subs with no rule: '|| DUMMY);
<       EXCEPTION
<         WHEN NO_DATA_FOUND THEN
---
>         SQL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => SCHEMA));
>         SQL_CUR := KWQAEXGCUR(SQLTXT, SQL_BNDS);
>         FETCH SQL_CUR INTO DUMMY;
>         IF (SQL_CUR%NOTFOUND) THEN
2783a3125,3130
>         ELSE
>           BADSUBFK := TRUE;
>           WRITE_TRACE('bad fkey: subs with no rule: '|| DUMMY);
>         END IF;
>         CLOSE SQL_CUR;
>       EXCEPTION
2800,2804c3147,3150
<         EXECUTE IMMEDIATE SQLTXT INTO IGNORE USING SCHEMA ;
<         BADRULEFK := TRUE;
<         WRITE_TRACE('bad fkey: rule with no subs: '||IGNORE);
<       EXCEPTION
<         WHEN NO_DATA_FOUND THEN
---
>         SQL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => SCHEMA));
>         SQL_CUR := KWQAEXGCUR(SQLTXT, SQL_BNDS);
>         FETCH SQL_CUR INTO DUMMY;
>         IF (SQL_CUR%NOTFOUND) THEN
2806a3153,3158
>         ELSE
>           BADRULEFK := TRUE;
>           WRITE_TRACE('bad fkey: rule with no subs: '|| IGNORE);
>         END IF;
>         CLOSE SQL_CUR;
>       EXCEPTION
2892a3245,3246
>   SQL_BNDS AQ$_BND_ARRAY;
>   SQL_CUR  SYS_REFCURSOR;
2908,2909c3262,3270
<       EXECUTE IMMEDIATE SQLTEXT INTO IGNORE;
<       RETURN 4;				  
---
>       SQL_BNDS := AQ$_BND_ARRAY();
>       SQL_CUR := KWQAEXGCUR(SQLTEXT, SQL_BNDS);
>       FETCH SQL_CUR INTO IGNORE; 
>       IF (SQL_CUR%FOUND) THEN
>         CLOSE SQL_CUR;
>         RETURN 4;
>       ELSE
>         CLOSE SQL_CUR;
>       END IF;
2913,2914d3273
<       WHEN NO_DATA_FOUND THEN
< 	NULL;
2924c3283,3286
<       EXECUTE IMMEDIATE SQLTEXT INTO IGNORE;
---
>       SQL_BNDS := AQ$_BND_ARRAY();
>       SQL_CUR := KWQAEXGCUR(SQLTEXT, SQL_BNDS);
>       FETCH SQL_CUR INTO IGNORE; 
>       CLOSE SQL_CUR;
2952a3315,3316
>   SEL_BNDS          AQ$_BND_ARRAY;
>   SEL_CUR           SYS_REFCURSOR;
2979c3343,3346
<       EXECUTE IMMEDIATE SEL_STMT INTO ROW_EXISTS ;
---
>       SEL_BNDS := AQ$_BND_ARRAY();
>       SEL_CUR := KWQAEXGCUR(SEL_STMT, SEL_BNDS);
>       FETCH SEL_CUR INTO ROW_EXISTS;
>       CLOSE SEL_CUR;
2993c3360
<     DBMS_AQADM_INV.EXECUTE_STMT2(' LOCK TABLE ' ||
---
>     EXECUTE_STMT3(' LOCK TABLE ' ||
3001c3368
<       DBMS_AQADM_INV.EXECUTE_STMT2('INSERT INTO '
---
>       EXECUTE_STMT3('INSERT INTO '
3013c3380
<       DBMS_AQADM_INV.EXECUTE_STMT2('INSERT INTO '
---
>       EXECUTE_STMT3('INSERT INTO '
3111,3113c3478,3482
<             EXECUTE IMMEDIATE SUB_INSERT        
<             USING SID, Q_NAME, SUB.NAME, SUB.ADDRESS, SUB.PROTOCOL;
< 
---
>             EXECUTE_STMT_IN_KERNEL_CURSOR(SUB_INSERT,
>               IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, SUB.NAME, SUB.ADDRESS),
>               IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3, 4),
>               IN_NUM_ARRAY => NUM_ARRAY_TYPE(SID, SUB.PROTOCOL),
>               IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 5));
3184,3185c3553,3554
<   TYPE RT IS        REF CURSOR;          
<   SUBS_RC           RT;
---
>   SUB_BNDS          AQ$_BND_ARRAY;
>   SUB_CUR           SYS_REFCURSOR;
3235c3604,3605
<       OPEN SUBS_RC FOR SUB_SELECT USING Q_NAME;
---
>       SUB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME));
>       SUB_CUR := KWQAEXGCUR(SUB_SELECT, SUB_BNDS); 
3237,3238c3607,3608
<         FETCH SUBS_RC INTO NAME, ADDRESS, PROTOCOL;       
<         EXIT WHEN SUBS_RC%NOTFOUND;
---
>         FETCH SUB_CUR INTO NAME, ADDRESS, PROTOCOL;       
>         EXIT WHEN SUB_CUR%NOTFOUND;
3271a3642
>       CLOSE SUB_CUR;
3281c3652
<     DBMS_AQADM_INV.EXECUTE_STMT2(' DELETE  FROM ' ||
---
>     EXECUTE_STMT3(' DELETE  FROM ' ||
3758c4129
<       DBMS_AQADM_INV.EXECUTE_STMT('CREATE OR REPLACE VIEW '                  || 
---
>       EXECUTE_STMT3('CREATE OR REPLACE VIEW '                  || 
3821c4192
<       DBMS_AQADM_INV.EXECUTE_STMT('CREATE OR REPLACE VIEW '                  || 
---
>       EXECUTE_STMT3('CREATE OR REPLACE VIEW '                  || 
3864c4235
<    DBMS_AQADM_INV.EXECUTE_STMT2(' DROP VIEW ' || 
---
>    EXECUTE_STMT3(' DROP VIEW ' || 
3970a4342,4343
>    INS_BNDS           AQ$_BND_ARRAY;
>    INS_CUR            SYS_REFCURSOR;
3971a4345,4346
>    SUB_BNDS           AQ$_BND_ARRAY;
>    SUB_CUR            SYS_REFCURSOR;
3977,3978d4351
<    TYPE  SUB_C_TYPE   IS REF CURSOR;  
<    SUB_C              SUB_C_TYPE;
4030c4403,4404
<      OPEN SUB_C FOR SUB_STMT USING QUEUE_NAME ;
---
>      SUB_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QUEUE_NAME));
>      SUB_CUR := KWQAEXGCUR(SUB_STMT, SUB_BNDS);
4033,4036c4407,4412
<        FETCH SUB_C INTO SUBSCRIBER_ID, Q_NAME, SUB_NAME, ADDRESS, PROTOCOL,
<                         SUBSCR_TYPE, RULE_NAME, TRANS_NAME, RULESET, 
<                         NEGATIVE_RULESET, CREATETIME, MODTIME, DELTIME, 
<                         SCNATREMOVE, SCNATADD ;
---
>        FETCH SUB_CUR INTO SUBSCRIBER_ID, Q_NAME, SUB_NAME, ADDRESS, PROTOCOL,
>                           SUBSCR_TYPE, RULE_NAME, TRANS_NAME, RULESET, 
>                           NEGATIVE_RULESET, CREATETIME, MODTIME, DELTIME, 
>                           SCNATREMOVE, SCNATADD ;
> 
>        EXIT WHEN SUB_CUR%NOTFOUND;
4049d4424
<        EXIT WHEN SUB_C%NOTFOUND;
4052,4058c4427,4440
<              EXECUTE IMMEDIATE INS_STMT USING 
<                      POPULATE_SYS_SUBSCRIBER_TABLE.SCHEMA, 
<                      POPULATE_SYS_SUBSCRIBER_TABLE.QUEUE_TABLE, QTAB_OBJ,
<                      Q_ID, SUBSCRIBER_ID, QUEUE_NAME, SUB_NAME, ADDRESS,
<                      PROTOCOL, SUBSCR_TYPE, RULE_NAME, TRANS_NAME, RULESET,
<                      NEGATIVE_RULESET, CREATETIME, MODTIME, DELTIME, 
<                      SCNATREMOVE, SCNATADD ;
---
>          INS_BNDS := AQ$_BND_ARRAY(
>            AQ$_BND(STR_VAL => POPULATE_SYS_SUBSCRIBER_TABLE.SCHEMA),
>            AQ$_BND(STR_VAL => POPULATE_SYS_SUBSCRIBER_TABLE.QUEUE_TABLE),
>            AQ$_BND(NUM_VAL => QTAB_OBJ), AQ$_BND(NUM_VAL => Q_ID),
>            AQ$_BND(NUM_VAL => SUBSCRIBER_ID), AQ$_BND(STR_VAL => QUEUE_NAME),
>            AQ$_BND(STR_VAL => SUB_NAME), AQ$_BND(STR_VAL => ADDRESS),
>            AQ$_BND(NUM_VAL => PROTOCOL), AQ$_BND(NUM_VAL => SUBSCR_TYPE),
>            AQ$_BND(STR_VAL => RULE_NAME), AQ$_BND(STR_VAL => TRANS_NAME),
>            AQ$_BND(STR_VAL => RULESET), AQ$_BND(STR_VAL => NEGATIVE_RULESET),
>            AQ$_BND(TM_VAL => CREATETIME), AQ$_BND(TM_VAL => MODTIME),
>            AQ$_BND(TM_VAL => DELTIME), AQ$_BND(NUM_VAL => SCNATREMOVE),
>            AQ$_BND(NUM_VAL => SCNATADD));
>          INS_CUR := KWQAEXGCUR(INS_STMT, INS_BNDS);
>          CLOSE INS_CUR;
4067a4450
>      CLOSE SUB_CUR;
4113,4114d4495
<    TYPE RSUBCURTYP    IS REF CURSOR;  
<    RSUB_CV            RSUBCURTYP;  
4115a4497,4498
>    RULE_BNDS          AQ$_BND_ARRAY;
>    RULE_CUR           SYS_REFCURSOR;
4180,4181c4563,4564
< 
<     OPEN RSUB_CV FOR RULE_STMT USING QUEUE;
---
>     RULE_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QUEUE));
>     RULE_CUR := KWQAEXGCUR(RULE_STMT, RULE_BNDS);
4185,4186c4568,4569
<       FETCH RSUB_CV INTO  RS_NAME, NRS_NAME;
<       EXIT WHEN RSUB_CV%NOTFOUND;
---
>       FETCH RULE_CUR INTO  RS_NAME, NRS_NAME;
>       EXIT WHEN RULE_CUR%NOTFOUND;
4212c4595,4596
<     END LOOP;   
---
>     END LOOP;
>     CLOSE RULE_CUR;
4304a4689,4690
>    RS_SEL_BNDS       AQ$_BND_ARRAY;
>    RS_SEL_CUR        SYS_REFCURSOR;
4307,4308d4692
<    TYPE RS_CUR_TYPE  IS REF CURSOR;
<    RS_CV             RS_CUR_TYPE;
4344c4728,4729
<     OPEN RS_CV FOR RS_SEL_SQL;
---
>     RS_SEL_BNDS := AQ$_BND_ARRAY();
>     RS_SEL_CUR := KWQAEXGCUR(RS_SEL_SQL, RS_SEL_BNDS);
4346,4347c4731,4732
<       FETCH RS_CV INTO ORIG_RS_NAME, SUB_ID;
<       EXIT WHEN RS_CV%NOTFOUND;
---
>       FETCH RS_SEL_CUR INTO ORIG_RS_NAME, SUB_ID;
>       EXIT WHEN RS_SEL_CUR%NOTFOUND;
4355,4356c4740,4742
<           EXECUTE IMMEDIATE RS_UPD_SQL USING '"' || CANON_RS_SNAME || '"', 
<                                              SUB_ID;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(RS_UPD_SQL,
>             IN_STR_ARRAY => STR_ARRAY_TYPE('"' || CANON_RS_SNAME || '"'),
>             IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUB_ID));
4358c4744,4746
<           EXECUTE IMMEDIATE RS_UPD_SQL USING CANON_RS_NAME, SUB_ID;
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(RS_UPD_SQL,
>             IN_STR_ARRAY => STR_ARRAY_TYPE(CANON_RS_SNAME),
>             IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUB_ID));
4362c4750,4751
<         EXECUTE IMMEDIATE RS_UPD_SQL_DUMMY USING SUB_ID;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(RS_UPD_SQL_DUMMY,
>           IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUB_ID));
4365c4754
<     CLOSE RS_CV;
---
>     CLOSE RS_SEL_CUR;
4379a4769,4770
>    COMPRESS_BNDS        AQ$_BND_ARRAY;
>    COMPRESS_CUR         SYS_REFCURSOR;
4392c4783,4787
<      EXECUTE IMMEDIATE COMPRESS_SQL INTO TAB_SP1 USING ST_NAME, QT_SCHEMA ;
---
>      COMPRESS_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => ST_NAME),
>                                     AQ$_BND(STR_VAL => QT_SCHEMA));
>      COMPRESS_CUR := KWQAEXGCUR(COMPRESS_SQL, COMPRESS_BNDS);
>      FETCH COMPRESS_CUR INTO TAB_SP1;
>      CLOSE COMPRESS_CUR;
4400c4795
<         EXECUTE IMMEDIATE NO_CMPRS_SQL;               
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);   
4476c4871
<      EXECUTE IMMEDIATE SUB_COLUMN_SQL;
---
>      EXECUTE_STMT_IN_KERNEL_CURSOR(SUB_COLUMN_SQL);
4533c4928
<         EXECUTE IMMEDIATE RS_EXP_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(RS_EXP_SQL);
4562c4957
<         EXECUTE IMMEDIATE NO_CMPRS_SQL;
---
>         EXECUTE_STMT_IN_KERNEL_CURSOR(NO_CMPRS_SQL);
4570c4965
<             EXECUTE IMMEDIATE REBUILD_IDX_SQL;
---
>             EXECUTE_STMT_IN_KERNEL_CURSOR(REBUILD_IDX_SQL);
4580c4975
<       EXECUTE IMMEDIATE SUB_RSET_SQL;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(SUB_RSET_SQL);
4601,4602c4996,4997
<    TYPE RSUBCURTYP   IS REF CURSOR;  
<    RSUB_CV           RSUBCURTYP;  
---
>    SUB_BNDS          AQ$_BND_ARRAY;
>    SUB_CUR           SYS_REFCURSOR;
4614c5009
<     EXECUTE IMMEDIATE SUBTAB_SQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTAB_SQL);
4621c5016
<     EXECUTE IMMEDIATE SUBTAB_SQL;
---
>     EXECUTE_STMT_IN_KERNEL_CURSOR(SUBTAB_SQL);
4635c5030,5032
<     OPEN RSUB_CV FOR  SUB_STMT;
---
> 
>     SUB_BNDS := AQ$_BND_ARRAY();
>     SUB_CUR := KWQAEXGCUR(SUB_STMT, SUB_BNDS);
4639,4640c5036,5037
<      FETCH RSUB_CV INTO Q_NAME, SUBID, RULE_NAME;
<      EXIT WHEN RSUB_CV%NOTFOUND;
---
>      FETCH SUB_CUR INTO Q_NAME, SUBID, RULE_NAME;
>      EXIT WHEN SUB_CUR%NOTFOUND;
4662,4663c5059,5062
<      			   
<      EXECUTE IMMEDIATE UPD_STMT USING RULESET_NAME, RULE_NAME, SUBID;
---
> 
>      EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_STMT,
>        IN_STR_ARRAY => STR_ARRAY_TYPE(RULESET_NAME, RULE_NAME), 
>        IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID)); 
4665a5065
>     CLOSE SUB_CUR;
4679,4688c5079,5090
<   SUBTAB_SEL       VARCHAR2(1024);
<   SUB_TABLE        DBMS_QUOTED_ID2;
<   SUBID            NUMBER;
<   SUB_RULE_NAME    VARCHAR2(128);
<   Q_NAME           VARCHAR2(128);
<   UPD_SUB_TXT      VARCHAR2(1024);
<   DF_RS_NM         VARCHAR2(128);
<   RULE_NM          VARCHAR2(128);
<   RULESET_NAME     DBMS_QUOTED_ID2;
<   DROP_RULE_TAB    VARCHAR2(1024);
---
>   SUBTAB_SEL      VARCHAR2(1024);
>   SUBTAB_BNDS     AQ$_BND_ARRAY;
>   SUBTAB_CUR      SYS_REFCURSOR;
>   SUB_TABLE       DBMS_QUOTED_ID2;
>   SUBID           NUMBER;
>   SUB_RULE_NAME   VARCHAR2(128);
>   Q_NAME          VARCHAR2(128);
>   UPD_SUB_TXT     VARCHAR2(1024);
>   DF_RS_NM        VARCHAR2(128);
>   RULE_NM         VARCHAR2(128);
>   RULESET_NAME    DBMS_QUOTED_ID2;
>   DROP_RULE_TAB   VARCHAR2(1024);
4697,4702c5099,5100
<       SUBCUR := DBMS_SQL.OPEN_CURSOR;
<       DBMS_SQL.PARSE(SUBCUR, SUBTAB_SEL, DBMS_SQL.V7);
<       DBMS_SQL.DEFINE_COLUMN(SUBCUR, 1, SUBID);
<       DBMS_SQL.DEFINE_COLUMN(SUBCUR, 2, SUB_RULE_NAME, M_IDEN_LEN);
<       DBMS_SQL.DEFINE_COLUMN(SUBCUR, 3, Q_NAME, M_IDEN_LEN);      
<       IGNORE := DBMS_SQL.EXECUTE(SUBCUR);
---
>       SUBTAB_BNDS := AQ$_BND_ARRAY();
>       SUBTAB_CUR := KWQAEXGCUR(SUBTAB_SEL, SUBTAB_BNDS);
4705,4734c5103,5125
<        IF (DBMS_SQL.FETCH_ROWS(SUBCUR) > 0) THEN
<           BEGIN
<             DBMS_SQL.COLUMN_VALUE(SUBCUR, 1, SUBID);
<             DBMS_SQL.COLUMN_VALUE(SUBCUR, 2, SUB_RULE_NAME);
< 	    DBMS_SQL.COLUMN_VALUE(SUBCUR, 3, Q_NAME);      
<             
<             WRITE_TRACE('upgrade_90_92: sub_rule_name = ' || SUB_RULE_NAME);
<             WRITE_TRACE('upgrade_90_92: q_name = ' || Q_NAME);
< 
<             
<             
<             DF_RS_NM := GET_DEFAULT_RULESET(Q_NAME, SUBID);
< 	    RULE_NM := GET_RULE_NAME(Q_NAME, SUBID);
<             DBMS_PRVTAQIS.ADD_QUEUE_RULE(
<                                '"'||QT_SCHEMA ||'"'||'.'||'"'||DF_RS_NM||'"', 
<                                 QT_SCHEMA, QT_NAME, QT_SCHEMA, 
<                                 RULE_NM, NULL);
< 
<             UPD_SUB_TXT := 'UPDATE '|| SUB_TABLE || 
<               ' SET rule_name = :1, ruleset_name = :2 '||
<                ' WHERE subscriber_id = :3';
<             EXECUTE IMMEDIATE UPD_SUB_TXT USING  RULE_NM, DF_RS_NM, SUBID;
< 
<           EXCEPTION
<             WHEN OTHERS THEN
< 	     RAISE;
<           END;
<         ELSE
<           EXIT;
<         END IF;
---
>         BEGIN
>           FETCH SUBTAB_CUR INTO SUBID, SUB_RULE_NAME, Q_NAME;
>           EXIT WHEN SUBTAB_CUR%NOTFOUND;
>               
>           WRITE_TRACE('upgrade_90_92: sub_rule_name = ' || SUB_RULE_NAME);
>           WRITE_TRACE('upgrade_90_92: q_name = ' || Q_NAME);
>   
>           
>           
>           DF_RS_NM := GET_DEFAULT_RULESET(Q_NAME, SUBID);
>   	  RULE_NM := GET_RULE_NAME(Q_NAME, SUBID);
>           DBMS_PRVTAQIS.ADD_QUEUE_RULE(
>                                  '"'||QT_SCHEMA ||'"'||'.'||'"'||DF_RS_NM||'"', 
>                                   QT_SCHEMA, QT_NAME, QT_SCHEMA, 
>                                   RULE_NM, NULL);
>   
>           UPD_SUB_TXT := 'UPDATE '|| SUB_TABLE || 
>                 ' SET rule_name = :1, ruleset_name = :2 '||
>                  ' WHERE subscriber_id = :3';
>   
>           EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_SUB_TXT,
>                 IN_STR_ARRAY => STR_ARRAY_TYPE(RULE_NM, DF_RS_NM), 
>                 IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID)); 
4736,4737c5127,5132
<       END LOOP;    
<     DBMS_SQL.CLOSE_CURSOR(SUBCUR);
---
>         EXCEPTION
>           WHEN OTHERS THEN
> 	    RAISE;
>         END;
>       END LOOP;
>       CLOSE SUBTAB_CUR;
4744c5139
<       EXECUTE IMMEDIATE DROP_RULE_TAB;
---
>       EXECUTE_STMT_IN_KERNEL_CURSOR(DROP_RULE_TAB);
4758a5154,5155
>   SUBTAB_BNDS      AQ$_BND_ARRAY;
>   SUBTAB_CUR       SYS_REFCURSOR;
4772,4778c5169,5171
<     SUBCUR := DBMS_SQL.OPEN_CURSOR;
<     DBMS_SQL.PARSE(SUBCUR, SUBTAB_SEL, DBMS_SQL.V7);
<     DBMS_SQL.DEFINE_COLUMN(SUBCUR, 1, SUBID);
<     DBMS_SQL.DEFINE_COLUMN(SUBCUR, 2, SUB_RULE_NAME, M_IDEN_LEN);
<     DBMS_SQL.DEFINE_COLUMN(SUBCUR, 3, SUB_RULESET_NAME, M_IDEN_LEN);
<       
<     IGNORE := DBMS_SQL.EXECUTE(SUBCUR);
---
> 
>     SUBTAB_BNDS := AQ$_BND_ARRAY();
>     SUBTAB_CUR := KWQAEXGCUR(SUBTAB_SEL, SUBTAB_BNDS);
4781,4794c5174,5179
<       IF (DBMS_SQL.FETCH_ROWS(SUBCUR) > 0) THEN
<         BEGIN
<            DBMS_SQL.COLUMN_VALUE(SUBCUR, 1, SUBID);
<            DBMS_SQL.COLUMN_VALUE(SUBCUR, 2, SUB_RULE_NAME);
<            DBMS_SQL.COLUMN_VALUE(SUBCUR, 3, SUB_RULESET_NAME);
< 
<            WRITE_TRACE('downgrade_92_90: sub_rule_name = ' || SUB_RULE_NAME);
<            WRITE_TRACE('downgrade_92_90: sub_ruleset_name = ' || SUB_RULESET_NAME);
< 
<            IF (SUB_RULE_NAME IS NOT NULL) THEN
<              
<              DBMS_PRVTAQIS.DROP_QUEUE_RULE_SET(
< 				QT_SCHEMA ||'.'||SUB_RULESET_NAME, 
< 	                        QT_SCHEMA, QT_NAME, FALSE);
---
>       BEGIN
>         FETCH SUBTAB_CUR INTO SUBID, SUB_RULE_NAME, SUB_RULESET_NAME;
>         EXIT WHEN SUBTAB_CUR%NOTFOUND;
> 
>         WRITE_TRACE('downgrade_92_90: sub_rule_name = ' || SUB_RULE_NAME);
>         WRITE_TRACE('downgrade_92_90: sub_ruleset_name = ' || SUB_RULESET_NAME);
4796c5181,5187
<              UPD_SUB_TXT := 'UPDATE '|| SUB_TABLE || 
---
>         IF (SUB_RULE_NAME IS NOT NULL) THEN
>           
>           DBMS_PRVTAQIS.DROP_QUEUE_RULE_SET(
>                           QT_SCHEMA ||'.'||SUB_RULESET_NAME, 
> 	                  QT_SCHEMA, QT_NAME, FALSE);
> 
>           UPD_SUB_TXT := 'UPDATE '|| SUB_TABLE || 
4800,4801d5190
<              EXECUTE IMMEDIATE UPD_SUB_TXT 
< 	     USING GET_OLD_RULE_NAME(SUBID), SUBID;                
4803,4811c5192,5202
<           END IF;              
<         EXCEPTION
<           WHEN OTHERS THEN
<            NULL;
<         END;
<       ELSE
<           EXIT;
<       END IF;
<     END LOOP;    
---
>           EXECUTE_STMT_IN_KERNEL_CURSOR(UPD_SUB_TXT,
>             IN_STR_ARRAY => STR_ARRAY_TYPE(GET_OLD_RULE_NAME(SUBID)),
>             IN_NUM_ARRAY => NUM_ARRAY_TYPE(SUBID));
> 
>         END IF;              
>       EXCEPTION
>         WHEN OTHERS THEN
>           NULL;
>       END;
>     END LOOP;
>     CLOSE SUBTAB_CUR;
4815d5205
<     DBMS_SQL.CLOSE_CURSOR(SUBCUR);
4825,4826c5215,5220
<   RULE_STMT   VARCHAR2(500);                                 
<   ECTX_STMT   VARCHAR2(500);                                 
---
>   RULE_STMT   VARCHAR2(500);
>   RULE_BNDS   AQ$_BND_ARRAY;
>   RULE_CUR    SYS_REFCURSOR;       
>   ECTX_STMT   VARCHAR2(500);                       
>   ECTX_BNDS   AQ$_BND_ARRAY;
>   ECTX_CUR    SYS_REFCURSOR;       
4832,4833d5225
<   TYPE RSUBCURTYP       IS REF CURSOR;  
<   RSUB_CV               RSUBCURTYP;     
4865c5257,5258
<      OPEN RSUB_CV FOR RULE_STMT;
---
>      RULE_BNDS := AQ$_BND_ARRAY();
>      RULE_CUR := KWQAEXGCUR(RULE_STMT, RULE_BNDS);
4868,4869c5261,5262
<        FETCH RSUB_CV INTO RULE_NAME;
<        EXIT WHEN RSUB_CV%NOTFOUND;
---
>        FETCH RULE_CUR INTO RULE_NAME;
>        EXIT WHEN RULE_CUR%NOTFOUND;
4884a5278
>      CLOSE RULE_CUR;
4890c5284,5285
<      OPEN RSUB_CV FOR RULE_STMT USING Q_NAME;
---
>      RULE_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME));
>      RULE_CUR := KWQAEXGCUR(RULE_STMT, RULE_BNDS);
4893,4894c5288,5289
<        FETCH RSUB_CV INTO RULE_NAME;
<        EXIT WHEN RSUB_CV%NOTFOUND;
---
>        FETCH RULE_CUR INTO RULE_NAME;
>        EXIT WHEN RULE_CUR%NOTFOUND;
4898,4901c5293,5303
<        BEGIN
<          EXECUTE IMMEDIATE ECTX_STMT INTO RECTX_NAME 
<          USING QT_SCHEMA, RULE_NAME;
< 
---
>        ECTX_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => QT_SCHEMA),
>          AQ$_BND(STR_VAL => RULE_NAME));
>        ECTX_CUR := KWQAEXGCUR(ECTX_STMT, ECTX_BNDS);
>        FETCH ECTX_CUR INTO RECTX_NAME;
>   
>        IF (ECTX_CUR%NOTFOUND) THEN 
>          DBMS_SYSTEM.KSDWRT(DBMS_SYSTEM.ALERT_FILE,
>                             'Warning:upgrade_rule_10i: rule not present:'||
>                             QT_SCHEMA || '.'||RULE_NAME);
>          CNG_ECTX := FALSE;
>        ELSE
4908,4915c5310,5311
< 
<        EXCEPTION
<          WHEN NO_DATA_FOUND THEN
<          DBMS_SYSTEM.KSDWRT(DBMS_SYSTEM.ALERT_FILE,
<                             'Warning:upgrade_rule_10i: rule not present:'||
<                             QT_SCHEMA || '.'||RULE_NAME);
<          CNG_ECTX := FALSE;
<        END;        
---
>        END IF;
>        CLOSE ECTX_CUR;
4934a5331
>      CLOSE RULE_CUR;
4943c5340,5342
<   RULE_STMT   VARCHAR2(500);                                 
---
>   RULE_STMT   VARCHAR2(500);
>   RULE_BNDS   AQ$_BND_ARRAY;
>   RULE_CUR    SYS_REFCURSOR;                              
4948,4949d5346
<   TYPE RSUBCURTYP    IS REF CURSOR;  
<   RSUB_CV            RSUBCURTYP;     
4960c5357,5358
<   OPEN RSUB_CV FOR RULE_STMT;
---
>   RULE_BNDS := AQ$_BND_ARRAY();
>   RULE_CUR := KWQAEXGCUR(RULE_STMT, RULE_BNDS);
4963,4964c5361,5362
<     FETCH RSUB_CV INTO RULE_NAME;
<     EXIT WHEN RSUB_CV%NOTFOUND;  
---
>     FETCH RULE_CUR INTO RULE_NAME;
>     EXIT WHEN RULE_CUR%NOTFOUND;  
4979c5377,5378
<  END LOOP;                           
---
>   END LOOP;
>   CLOSE RULE_CUR;                     
4989a5389,5390
>   STAB_BNDS   AQ$_BND_ARRAY;
>   STAB_CUR    SYS_REFCURSOR;
5002,5006c5403,5404
<    DBMS_SQL.PARSE(STAB_CURSOR, SEL_STMT, DBMS_SQL.V7);
<    DBMS_SQL.DEFINE_COLUMN(STAB_CURSOR, 1, RSET_NAM, M_IDEN_LEN);
<    DBMS_SQL.DEFINE_COLUMN(STAB_CURSOR, 2, RULE_NAM, M_IDEN_LEN);
< 
<    IGNORE := DBMS_SQL.EXECUTE(STAB_CURSOR);
---
>    STAB_BNDS := AQ$_BND_ARRAY();
>    STAB_CUR := KWQAEXGCUR(SEL_STMT, STAB_BNDS);
5009,5011c5407,5408
<      IF DBMS_SQL.FETCH_ROWS(STAB_CURSOR) > 0 THEN
<        BEGIN
<           
---
>      FETCH STAB_CUR INTO RSET_NAM, RULE_NAM;
>      EXIT WHEN STAB_CUR%NOTFOUND;
5013,5014c5410,5411
<           DBMS_SQL.COLUMN_VALUE(STAB_CURSOR, 1, RSET_NAM);
<           DBMS_SQL.COLUMN_VALUE(STAB_CURSOR, 2, RULE_NAM);
---
>      BEGIN
>        
5016,5017c5413,5414
<           WRITE_TRACE('fix_subtab: rset_nam = ' || RSET_NAM);
<           WRITE_TRACE('fix_subtab: rule_nam  = ' || RULE_NAM);
---
>        WRITE_TRACE('fix_subtab: rset_nam = ' || RSET_NAM);
>        WRITE_TRACE('fix_subtab: rule_nam  = ' || RULE_NAM);
5019,5031c5416,5426
<           DBMS_RULE_ADM.ADD_RULE(DQT||RSCHEMA||DQT || '.'||
<                                  DQT||RULE_NAM||DQT, 
< 	    	                 DQT||RSCHEMA||DQT || '.'||
<                                  DQT||RSET_NAM||DQT);
<         EXCEPTION
<            WHEN RULE_ALREADY_ADDED THEN
<             DBMS_SYSTEM.KSDWRT(1, 'already added rule: '||RULE_NAM ||
<                                   'to ruleset: ' || RSET_NAM);
<       END;
<     ELSE
<       EXIT;
<     END IF;
<   END LOOP;
---
>        DBMS_RULE_ADM.ADD_RULE(DQT||RSCHEMA||DQT || '.'||
>                               DQT||RULE_NAM||DQT, 
>   	                      DQT||RSCHEMA||DQT || '.'||
>                               DQT||RSET_NAM||DQT);
>      EXCEPTION
>        WHEN RULE_ALREADY_ADDED THEN
>          DBMS_SYSTEM.KSDWRT(1, 'already added rule: '||RULE_NAM ||
>                                'to ruleset: ' || RSET_NAM);
>      END;
>    END LOOP;
>    CLOSE STAB_CUR;
5036d5430
<   QTAB_CURSOR     INTEGER;
5038a5433,5434
>   QTAB_BNDS       AQ$_BND_ARRAY;
>   QTAB_CUR        SYS_REFCURSOR;
5048,5054c5444,5445
<    QTAB_CURSOR := DBMS_SQL.OPEN_CURSOR;
< 
<    DBMS_SQL.PARSE(QTAB_CURSOR, QTAB_STMT, DBMS_SQL.V7);
<    DBMS_SQL.DEFINE_COLUMN(QTAB_CURSOR, 1, QTAB_SCHEMA, M_IDEN_LEN);
<    DBMS_SQL.DEFINE_COLUMN(QTAB_CURSOR, 2, QTAB_NAME, M_IDEN_LEN);
< 
<    IGNORE := DBMS_SQL.EXECUTE(QTAB_CURSOR);
---
>    QTAB_BNDS := AQ$_BND_ARRAY();
>    QTAB_CUR := KWQAEXGCUR(QTAB_STMT, QTAB_BNDS);
5057,5059c5448,5449
<      IF DBMS_SQL.FETCH_ROWS(QTAB_CURSOR) > 0 THEN
<       DBMS_SQL.COLUMN_VALUE(QTAB_CURSOR, 1, QTAB_SCHEMA);
<       DBMS_SQL.COLUMN_VALUE(QTAB_CURSOR, 2, QTAB_NAME);
---
>      FETCH QTAB_CUR INTO QTAB_SCHEMA, QTAB_NAME;
>      EXIT WHEN QTAB_CUR%NOTFOUND;
5061,5062c5451,5452
<       WRITE_TRACE('fix_subscriber_tables_2424746: qtab_schema ' || QTAB_SCHEMA);
<       WRITE_TRACE('fix_subscriber_tables_2424746: qtab_name  ' || QTAB_NAME);
---
>      WRITE_TRACE('fix_subscriber_tables_2424746: qtab_schema ' || QTAB_SCHEMA);
>      WRITE_TRACE('fix_subscriber_tables_2424746: qtab_name  ' || QTAB_NAME);
5064,5066c5454,5456
<       SUB_TAB :=  DBMS_ASSERT.ENQUOTE_NAME(DQT||QTAB_SCHEMA||DQT) || '.' ||
<                   DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$_'||QTAB_NAME||'_S'||DQT);
<       
---
>      SUB_TAB :=  DBMS_ASSERT.ENQUOTE_NAME(DQT||QTAB_SCHEMA||DQT) || '.' ||
>                  DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$_'||QTAB_NAME||'_S'||DQT);
>      
5068c5458
<       FIX_SUBTAB(QTAB_SCHEMA, SUB_TAB);
---
>      FIX_SUBTAB(QTAB_SCHEMA, SUB_TAB);
5070,5072d5459
<      ELSE                                            
<        EXIT;
<      END IF;
5074d5460
< 
5076,5079c5462
<    IF DBMS_SQL.IS_OPEN(QTAB_CURSOR) THEN
<      DBMS_SQL.CLOSE_CURSOR(QTAB_CURSOR);
<      WRITE_TRACE('fix_subscriber_tables_2424746: close_cursor');
<    END IF;
---
>    CLOSE QTAB_CUR;
5104c5487,5489
<   SELRSUB_STMT     VARCHAR2(600);
---
>   SELRSUB_STMT    VARCHAR2(600);
>   SELRSUB_BNDS    AQ$_BND_ARRAY;
>   SELRSUB_CUR     SYS_REFCURSOR;
5105a5491,5492
>   SUBSELQNO_BNDS  AQ$_BND_ARRAY;
>   SUBSELQNO_CUR   SYS_REFCURSOR;
5106a5494,5495
>   DEQUIOT_BNDS    AQ$_BND_ARRAY;
>   DEQUIOT_CUR     SYS_REFCURSOR;
5107a5497,5498
>   HISTIOT_BNDS    AQ$_BND_ARRAY;
>   HISTIOT_CUR     SYS_REFCURSOR;
5122a5514,5515
>   ADDR_SEL_BNDS   AQ$_BND_ARRAY;
>   ADDR_SEL_CUR    SYS_REFCURSOR;
5146,5155c5539,5541
<   STMT_CSR1 := DBMS_SQL.OPEN_CURSOR;
<   DBMS_SQL.PARSE(STMT_CSR1, SELRSUB_STMT, DBMS_SQL.V7);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 1, SUBID);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 2, SUBNAM, M_IDEN_LEN);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 3, SUBADDR, 1024);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 4, SUBPROTO);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 5, SUBTYP);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 6, RULE_NAM, M_IDEN_LEN);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 7, Q_NAME, M_IDEN_LEN);
<   ROWS_PROCESSED := DBMS_SQL.EXECUTE(STMT_CSR1);
---
>   SELRSUB_BNDS := AQ$_BND_ARRAY();
> 
>   SELRSUB_CUR := KWQAEXGCUR(SELRSUB_STMT, SELRSUB_BNDS);
5159,5175c5545,5554
<    IF DBMS_SQL.FETCH_ROWS(STMT_CSR1) > 0 THEN
< 
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 1, SUBID);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 2, SUBNAM);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 3, SUBADDR);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 4, SUBPROTO);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 5, SUBTYP);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 6, RULE_NAM);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 7, Q_NAME);
< 
<      
<      WRITE_TRACE('subnam : '     || SUBNAM);
<      
<      
<      
<      WRITE_TRACE('rule_nam : ' || RULE_NAM);
<      WRITE_TRACE('q_name : ' || Q_NAME);
---
>    FETCH SELRSUB_CUR INTO SUBID, SUBNAM, SUBADDR, SUBPROTO, SUBTYP, RULE_NAM,
>                           Q_NAME;
>    EXIT WHEN  SELRSUB_CUR%NOTFOUND;
>    
>    WRITE_TRACE('subnam : '     || SUBNAM);
>    
>    
>    
>    WRITE_TRACE('rule_nam : ' || RULE_NAM);
>    WRITE_TRACE('q_name : ' || Q_NAME);
5177,5178c5556,5557
<      
<      SUBSELQNO  := ' SELECT subscriber_id ' ||
---
>    
>    SUBSELQNO  := ' SELECT subscriber_id ' ||
5185,5189c5564,5571
<      WRITE_TRACE('subselstmt : ' || SUBSELQNO);
<      
<      EXECUTE IMMEDIATE SUBSELQNO INTO QUEUE_NO 
< 	    USING Q_NAME, QT_SCHEMA ||'.'||Q_NAME, 
<             DQT || QT_SCHEMA || DQT || '.' || DQT || Q_NAME || DQT;
---
>    WRITE_TRACE('subselstmt : ' || SUBSELQNO);
>    
>    SUBSELQNO_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>      AQ$_BND(STR_VAL => QT_SCHEMA ||'.'||Q_NAME),
>      AQ$_BND(STR_VAL => DQT || QT_SCHEMA || DQT || '.' || DQT || Q_NAME || DQT));
>    SUBSELQNO_CUR := KWQAEXGCUR(SUBSELQNO, SUBSELQNO_BNDS);
>    FETCH SUBSELQNO_CUR INTO QUEUE_NO;
>    CLOSE SUBSELQNO_CUR; 
5191c5573
<      
---
>    
5193,5194c5575,5576
<      
<      IF (SUBADDR IS NOT NULL) OR (SUBPROTO != 0) THEN
---
>    
>    IF (SUBADDR IS NOT NULL) OR (SUBPROTO != 0) THEN
5200,5202c5582,5584
<        BEGIN
<          
<          SYS.DBMS_AQADM_INV.PARSE_NAME(
---
>          BEGIN
>            
>            SYS.DBMS_AQADM_INV.PARSE_NAME(
5207c5589
<          ADDR_SEL_STMT  := ' SELECT subscriber_id ' ||
---
>            ADDR_SEL_STMT  := ' SELECT subscriber_id ' ||
5215,5221c5597,5604
< 
<          EXECUTE IMMEDIATE ADDR_SEL_STMT INTO ADDRNO 
< 	             USING Q_NAME, SUBADDR, DB_DOM, SUBADDR, DB_DOM, 
<                            DBLKCONQ, SUBADDR;
< 
<          
<          EXCEPTION
---
>            ADDR_SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>              AQ$_BND(STR_VAL => SUBADDR), AQ$_BND(STR_VAL => DB_DOM),
>              AQ$_BND(STR_VAL => SUBADDR),  AQ$_BND(STR_VAL => DB_DOM),
>              AQ$_BND(STR_VAL => DBLKCONQ), AQ$_BND(STR_VAL => SUBADDR));
> 
>            ADDR_SEL_CUR := KWQAEXGCUR(ADDR_SEL_STMT, ADDR_SEL_BNDS);
>            FETCH ADDR_SEL_CUR INTO ADDRNO;
>            IF (ADDR_SEL_CUR%NOTFOUND) THEN
5223,5227c5606,5611
<            WHEN NO_DATA_FOUND THEN		
<  	       
<  	       
< 	       GOTO NEXT_RSUB;
< 	   END;   
---
>              CLOSE ADDR_SEL_CUR;
>              GOTO NEXT_RSUB;
>            ELSE
>              CLOSE ADDR_SEL_CUR;
>            END IF; 
>          END;   
5238,5241c5622,5626
< 
<            EXECUTE IMMEDIATE ADDR_SEL_STMT INTO ADDRNO 
< 	              USING Q_NAME, SUBADDR, SUBPROTO;
<          EXCEPTION 
---
>            ADDR_SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>              AQ$_BND(STR_VAL => SUBADDR), AQ$_BND(NUM_VAL => SUBPROTO));
>            ADDR_SEL_CUR := KWQAEXGCUR(ADDR_SEL_STMT, ADDR_SEL_BNDS);
>            FETCH ADDR_SEL_CUR INTO  ADDRNO;
>            IF (ADDR_SEL_CUR%NOTFOUND) THEN
5243,5246c5628,5632
<            WHEN NO_DATA_FOUND THEN		
< 
< 	     
<            GOTO NEXT_RSUB;
---
>              CLOSE ADDR_SEL_CUR;
>              GOTO NEXT_RSUB;
>            ELSE
>              CLOSE ADDR_SEL_CUR;
>            END IF; 
5287,5288c5673,5680
<          EXECUTE IMMEDIATE HISTIOT_UPD USING SUBID, ZSUBNAME, SUBNAM, ADDRNO, 
<            MESSID RETURNING BULK COLLECT INTO MSGLIST;
---
>          
>          HISTIOT_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUBID),
>            AQ$_BND(STR_VAL => ZSUBNAME),  AQ$_BND(STR_VAL => SUBNAM),
>            AQ$_BND(NUM_VAL => ADDRNO),  AQ$_BND(RAW_VAL => MESSID),
>            AQ$_BND(RAW_VAL => NULL, BMODE => 1));
>          HISTIOT_CUR := KWQAEXGCUR(HISTIOT_UPD, HISTIOT_BNDS);
>          MSGLAST := HISTIOT_BNDS(6).RAW_VAL;
> 
5292,5294c5684,5689
<          MSGLAST := MSGLIST(MSGLIST.LAST);
<          EXECUTE IMMEDIATE HISTIOT_UPD USING SUBID, ZSUBNAME, SUBNAM, ADDRNO, 
<            MSGLAST RETURNING BULK COLLECT INTO MSGLIST;
---
>          HISTIOT_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUBID),
>            AQ$_BND(STR_VAL => ZSUBNAME),  AQ$_BND(STR_VAL => SUBNAM),
>            AQ$_BND(NUM_VAL => ADDRNO),  AQ$_BND(RAW_VAL => MSGLAST),
>            AQ$_BND(RAW_VAL => NULL, BMODE => 1));
>          HISTIOT_CUR := KWQAEXGCUR(HISTIOT_UPD, HISTIOT_BNDS);
>          MSGLAST := HISTIOT_BNDS(6).RAW_VAL;
5297c5692,5693
<        IF SQL%NOTFOUND THEN
---
>        IF (HISTIOT_CUR%ROWCOUNT = 0) THEN
>          CLOSE HISTIOT_CUR;
5298a5695,5696
>        ELSE
>          CLOSE HISTIOT_CUR;
5306,5307c5704,5709
<          EXECUTE IMMEDIATE DEQUIOT_UPD USING SUBID, ZSUBNAME, SUBNAM, QUEUE_NO;
<          IF SQL%NOTFOUND THEN
---
>          DEQUIOT_BNDS := AQ$_BND_ARRAY(AQ$_BND(NUM_VAL => SUBID),
>            AQ$_BND(STR_VAL => ZSUBNAME),  AQ$_BND(STR_VAL => SUBNAM),
>            AQ$_BND(NUM_VAL => QUEUE_NO));
>          DEQUIOT_CUR := KWQAEXGCUR(DEQUIOT_UPD, DEQUIOT_BNDS);
>          IF (DEQUIOT_CUR%ROWCOUNT = 0) THEN
>            CLOSE DEQUIOT_CUR;
5308a5711,5712
>          ELSE
>            CLOSE DEQUIOT_CUR;
5313,5315d5716
<    ELSE
<      EXIT;
<    END IF;    
5321d5721
< 
5323,5325c5723,5724
<   IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<     DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
<   END IF;
---
>   CLOSE SELRSUB_CUR;
> 
5329,5330c5728,5729
<       IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<         DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
---
>       IF (SELRSUB_CUR%ISOPEN) THEN
>         CLOSE SELRSUB_CUR;
5333,5334c5732,5733
<       IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<         DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
---
>       IF (SELRSUB_CUR%ISOPEN) THEN
>         CLOSE SELRSUB_CUR;
5336c5735
< 	RAISE;
---
>       RAISE;
5354,5355d5752
<   TABLE_DOES_NOT_EXIST EXCEPTION;
<   PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942);
5366c5763,5765
<   SELRSUB_STMT     VARCHAR2(400);
---
>   SELRSUB_STMT    VARCHAR2(400);
>   SELRSUB_BNDS    AQ$_BND_ARRAY;
>   SELRSUB_CUR     SYS_REFCURSOR;
5367a5767,5768
>   SUBSELQNO_BNDS  AQ$_BND_ARRAY;
>   SUBSELQNO_CUR   SYS_REFCURSOR;
5384a5786,5787
>   ADDR_SEL_BNDS   AQ$_BND_ARRAY;
>   ADDR_SEL_CUR    SYS_REFCURSOR;
5402,5412c5805,5806
<   STMT_CSR1 := DBMS_SQL.OPEN_CURSOR;
<   DBMS_SQL.PARSE(STMT_CSR1, SELRSUB_STMT, DBMS_SQL.V7);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 1, SUBID);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 2, SUBNAM, M_IDEN_LEN);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 3, SUBADDR, 1024);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 4, SUBPROTO);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 5, SUBTYP);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 6, RULE_NAM, M_IDEN_LEN);
<   DBMS_SQL.DEFINE_COLUMN(STMT_CSR1, 7, Q_NAME, M_IDEN_LEN);
<   ROWS_PROCESSED := DBMS_SQL.EXECUTE(STMT_CSR1);
< 
---
>   SELRSUB_BNDS := AQ$_BND_ARRAY();
>   SELRSUB_CUR := KWQAEXGCUR(SELRSUB_STMT, SELRSUB_BNDS);
5414,5415d5807
<   LOOP   
<    IF DBMS_SQL.FETCH_ROWS(STMT_CSR1) > 0 THEN
5417,5423c5809,5812
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 1, SUBID);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 2, SUBNAM);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 3, SUBADDR);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 4, SUBPROTO);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 5, SUBTYP);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 6, RULE_NAM);
<      DBMS_SQL.COLUMN_VALUE(STMT_CSR1, 7, Q_NAME);
---
>   LOOP   
>     FETCH SELRSUB_CUR INTO SUBID, SUBNAM, SUBADDR, SUBPROTO, SUBTYP, RULE_NAM,
>                           Q_NAME;
>     EXIT WHEN SELRSUB_CUR%NOTFOUND; 
5425,5431c5814,5820
<      
<      WRITE_TRACE('subnam : '     || SUBNAM);
<      
<      
<      
<      WRITE_TRACE('rule_nam : ' || RULE_NAM);
<      WRITE_TRACE('q_name : ' || Q_NAME);
---
>     
>     WRITE_TRACE('subnam : '     || SUBNAM);
>     
>     
>     
>     WRITE_TRACE('rule_nam : ' || RULE_NAM);
>     WRITE_TRACE('q_name : ' || Q_NAME);
5433,5434c5822,5823
<      
<      SUBSELQNO  := ' SELECT subscriber_id ' ||
---
>     
>     SUBSELQNO  := ' SELECT subscriber_id ' ||
5441,5444c5830,5836
<      
<      
<      EXECUTE IMMEDIATE SUBSELQNO INTO QUEUE_NO 
< 	    USING Q_NAME, QT_SCHEMA ||'.'||Q_NAME;
---
>     
>     
>     SUBSELQNO_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>                                     AQ$_BND(STR_VAL => QT_SCHEMA ||'.'||Q_NAME));
>     SUBSELQNO_CUR := KWQAEXGCUR(SUBSELQNO, SUBSELQNO_BNDS);
>     FETCH SUBSELQNO_CUR INTO QUEUE_NO;
>     CLOSE SUBSELQNO_CUR;
5455d5846
<        BEGIN
5469a5861,5870
>          ADDR_SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>            AQ$_BND(STR_VAL => SUBADDR), AQ$_BND(STR_VAL => DB_DOM),
>            AQ$_BND(STR_VAL => SUBADDR), AQ$_BND(STR_VAL => DB_DOM),
>            AQ$_BND(STR_VAL => DBLKCONQ), AQ$_BND(STR_VAL => SUBADDR));
> 
>          ADDR_SEL_CUR := KWQAEXGCUR(ADDR_SEL_STMT, ADDR_SEL_BNDS);
>          FETCH ADDR_SEL_CUR INTO ADDRNO;
>          IF (ADDR_SEL_CUR%NOTFOUND) THEN
>            
> 	   
5471,5481c5872
<          EXECUTE IMMEDIATE ADDR_SEL_STMT INTO ADDRNO
<                      USING Q_NAME, SUBADDR, DB_DOM, SUBADDR, DB_DOM,
<                            DBLKCONQ, SUBADDR;
< 
< 
<          
<          EXCEPTION
< 	     
<            WHEN NO_DATA_FOUND THEN		
< 
< 	     
---
> 	   
5483,5487c5874,5878
< 	     CRE_ADDR_STMT := 'INSERT INTO '|| 
<                               DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
<                               DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) ||
<                               '(subscriber_id, queue_name, name, address, '||
< 				' protocol, subscriber_type) '||
---
> 	   CRE_ADDR_STMT := 'INSERT INTO '|| 
>                             DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
>                             DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) ||
>                             '(subscriber_id, queue_name, name, address, '||
> 	                    ' protocol, subscriber_type) '||
5495c5886
< 	     
---
> 	   
5497c5888
< 	     
---
> 	   
5504,5510c5895,5901
< 	     
< 	     
<  	     
< 	     IF (MY_DB_DOM = DB_DOM)  THEN
< 	       ADDR_ENTRY := RQSCHEMA||'.'||RQNAME||'@'||DB_NAME;
< 	     ELSE
< 	       ADDR_ENTRY := SUBADDR;
---
> 	   
> 	   
>  	   
> 	   IF (MY_DB_DOM = DB_DOM)  THEN
> 	     ADDR_ENTRY := RQSCHEMA||'.'||RQNAME||'@'||DB_NAME;
> 	   ELSE
> 	     ADDR_ENTRY := SUBADDR;
5513,5514c5904,5905
< 	     
< 	     ADDRNO := SYS.DBMS_PRVTAQIS.AGENTID(QT_SCHEMA, QT_NAME);
---
> 	   
> 	   ADDRNO := SYS.DBMS_PRVTAQIS.AGENTID(QT_SCHEMA, QT_NAME);
5517,5520c5908,5914
< 	     EXECUTE IMMEDIATE CRE_ADDR_STMT 
< 	        USING ADDRNO, Q_NAME, ADDR_ENTRY;
< 	      
< 	   END;   
---
>            EXECUTE_STMT_IN_KERNEL_CURSOR(CRE_ADDR_STMT,
>                            IN_STR_ARRAY => STR_ARRAY_TYPE(Q_NAME, ADDR_ENTRY),
>                            IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2, 3),
>                            IN_NUM_ARRAY => NUM_ARRAY_TYPE(ADDRNO),
>                            IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1));
> 	 END IF;
>          CLOSE ADDR_SEL_CUR;
5522,5536c5916,5930
<          BEGIN  
<            
<            ADDR_SEL_STMT  := ' SELECT subscriber_id ' ||
<               ' FROM ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
<                           DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) ||
<               ' WHERE subscriber_type = 4 ' ||
<               ' AND queue_name = :1  AND name IS NULL ' ||
<               ' AND address = :2 AND protocol = :3 ';
< 
<            EXECUTE IMMEDIATE ADDR_SEL_STMT INTO ADDRNO 
< 	              USING Q_NAME, SUBADDR, SUBPROTO;
<          EXCEPTION 
< 	     
<            WHEN NO_DATA_FOUND THEN		
< 	       CRE_ADDR_STMT := 'INSERT INTO '|| 
---
>          
>          ADDR_SEL_STMT  := ' SELECT subscriber_id ' ||
>             ' FROM ' || DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
>                         DBMS_ASSERT.ENQUOTE_NAME(DQT||SUBTAB_NAME||DQT) ||
>             ' WHERE subscriber_type = 4 ' ||
>             ' AND queue_name = :1  AND name IS NULL ' ||
>             ' AND address = :2 AND protocol = :3 ';
> 
>          ADDR_SEL_BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME),
>            AQ$_BND(STR_VAL => SUBADDR), AQ$_BND(NUM_VAL => SUBPROTO));
> 
>          ADDR_SEL_CUR := KWQAEXGCUR(ADDR_SEL_STMT, ADDR_SEL_BNDS);
>          FETCH ADDR_SEL_CUR INTO ADDRNO;
>          IF (ADDR_SEL_CUR%NOTFOUND) THEN
> 	   CRE_ADDR_STMT := 'INSERT INTO '|| 
5542,5543c5936,5937
< 	     
< 	     ADDRNO := SYS.DBMS_PRVTAQIS.AGENTID(QT_SCHEMA, QT_NAME);
---
> 	   
> 	   ADDRNO := SYS.DBMS_PRVTAQIS.AGENTID(QT_SCHEMA, QT_NAME);
5545,5547c5939,5945
< 	     EXECUTE IMMEDIATE CRE_ADDR_STMT 
< 	        USING ADDRNO, SUBADDR, SUBPROTO;
<          END;
---
>            EXECUTE_STMT_IN_KERNEL_CURSOR(CRE_ADDR_STMT,
>                            IN_STR_ARRAY => STR_ARRAY_TYPE(SUBADDR),
>                            IN_STRPOS_ARRAY => NUM_ARRAY_TYPE(2),
>                            IN_NUM_ARRAY => NUM_ARRAY_TYPE(ADDRNO, SUBPROTO),
>                            IN_NUMPOS_ARRAY => NUM_ARRAY_TYPE(1, 3));
>          END IF;
>          CLOSE ADDR_SEL_CUR;
5592,5594d5989
<    ELSE
<      EXIT;
<    END IF;    
5596d5990
< 
5598,5600c5992
<   IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<     DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
<   END IF;
---
>   CLOSE SELRSUB_CUR;
5604,5605c5996,5997
<       IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<         DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
---
>       IF (SELRSUB_CUR%ISOPEN) THEN
>         CLOSE SELRSUB_CUR;
5608,5609c6000,6001
<       IF DBMS_SQL.IS_OPEN(STMT_CSR1) THEN
<         DBMS_SQL.CLOSE_CURSOR(STMT_CSR1);
---
>       IF (SELRSUB_CUR%ISOPEN) THEN
>         CLOSE SELRSUB_CUR;
5611c6003
< 	RAISE;
---
>       RAISE;
5633a6026,6027
>     BNDS              AQ$_BND_ARRAY;
>     CUR               SYS_REFCURSOR;
5655a6050,6053
>     BNDS := AQ$_BND_ARRAY(AQ$_BND(STR_VAL => Q_NAME));
>     CUR := KWQAEXGCUR(BUFF_SUB_COUNT, BNDS);
>     FETCH CUR INTO QBS_COUNT; 
>     CLOSE CUR;
5657,5658d6054
<     EXECUTE IMMEDIATE BUFF_SUB_COUNT INTO QBS_COUNT USING Q_NAME;
<   
5712,5774d6107
< 
<   PROCEDURE AQ_INTERNAL_EXESTMT(
<               SQL_STMT         IN      VARCHAR2,
<               OPCODE           IN      NUMBER          DEFAULT NULL,
<               BYPASS_DV        IN      BOOLEAN         DEFAULT TRUE,
<               BYPASS_AUDIT     IN      BOOLEAN         DEFAULT TRUE,
<               IN_STR_ARRAY     IN      STR_ARRAY_TYPE  DEFAULT NULL,
<               IN_STRPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUM_ARRAY     IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_NUMPOS_ARRAY  IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_STR_ARRAY    IN OUT  STR_ARRAY_TYPE,
<               OUT_STRPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               OUT_NUM_ARRAY    IN OUT  NUM_ARRAY_TYPE,
<               OUT_NUMPOS_ARRAY IN      NUM_ARRAY_TYPE  DEFAULT NULL,
<               IN_RAW_PARAM1    IN      RAW             DEFAULT NULL,
<               IN_RAW_PARAM2    IN      RAW             DEFAULT NULL,
<               IN_BINT_PARAM1   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_BINT_PARAM2   IN      BINARY_INTEGER  DEFAULT NULL,
<               IN_INT_PARAM1    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_INT_PARAM2    IN      PLS_INTEGER     DEFAULT NULL,
<               IN_TIME_PARAM1   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               IN_TIME_PARAM2   IN      TIMESTAMP WITH TIME ZONE DEFAULT NULL,
<               OUT_RAW_PARAM1   OUT     RAW,
<               OUT_RAW_PARAM2   OUT     RAW,
<               OUT_BINT_PARAM1  OUT     BINARY_INTEGER,
<               OUT_BINT_PARAM2  OUT     BINARY_INTEGER,
<               OUT_INT_PARAM1   OUT     PLS_INTEGER,
<               OUT_INT_PARAM2   OUT     PLS_INTEGER,
<               OUT_TIME_PARAM1  OUT     TIMESTAMP WITH TIME ZONE,
<               OUT_TIME_PARAM2  OUT     TIMESTAMP WITH TIME ZONE)
<   IS EXTERNAL 
<      NAME "aq_internal_exeStmt"
<      WITH CONTEXT
<      PARAMETERS(CONTEXT,
<                 SQL_STMT         OCISTRING,   SQL_STMT         INDICATOR  SB2,
<                 OPCODE           OCINUMBER,   OPCODE           INDICATOR  SB2,
<                 BYPASS_DV        SB4,         BYPASS_DV        INDICATOR  SB2,
<                 BYPASS_AUDIT     SB4,         BYPASS_AUDIT     INDICATOR  SB2,
<                 IN_STR_ARRAY     OCICOLL,     IN_STR_ARRAY     INDICATOR  SB2,
<                 IN_STRPOS_ARRAY  OCICOLL,     IN_STRPOS_ARRAY  INDICATOR  SB2,
<                 IN_NUM_ARRAY     OCICOLL,     IN_NUM_ARRAY     INDICATOR  SB2,
<                 IN_NUMPOS_ARRAY  OCICOLL,     IN_NUMPOS_ARRAY  INDICATOR  SB2,
<                 OUT_STR_ARRAY    OCICOLL,     OUT_STR_ARRAY    INDICATOR  SB2,
<                 OUT_STRPOS_ARRAY OCICOLL,     OUT_STRPOS_ARRAY INDICATOR  SB2,
<                 OUT_NUM_ARRAY    OCICOLL,     OUT_NUM_ARRAY    INDICATOR  SB2,
<                 OUT_NUMPOS_ARRAY OCICOLL,     OUT_NUMPOS_ARRAY INDICATOR  SB2,
<                 IN_RAW_PARAM1    OCIRAW,      IN_RAW_PARAM1    INDICATOR  SB2,
<                 IN_RAW_PARAM2    OCIRAW,      IN_RAW_PARAM2    INDICATOR  SB2,
<                 IN_BINT_PARAM1   UB4,         IN_BINT_PARAM1   INDICATOR  SB2,
<                 IN_BINT_PARAM2   UB4,         IN_BINT_PARAM2   INDICATOR  SB2,
<                 IN_INT_PARAM1    SB4,         IN_INT_PARAM1    INDICATOR  SB2,
<                 IN_INT_PARAM2    SB4,         IN_INT_PARAM2    INDICATOR  SB2,
<                 IN_TIME_PARAM1   OCIDATETIME, IN_TIME_PARAM1   INDICATOR  SB2,
<                 IN_TIME_PARAM2   OCIDATETIME, IN_TIME_PARAM2   INDICATOR  SB2,
<                 OUT_RAW_PARAM1   OCIRAW,      OUT_RAW_PARAM1   INDICATOR  SB2,
<                 OUT_RAW_PARAM2   OCIRAW,      OUT_RAW_PARAM2   INDICATOR  SB2,
<                 OUT_BINT_PARAM1  UB4,         OUT_BINT_PARAM1  INDICATOR  SB2,
<                 OUT_BINT_PARAM2  UB4,         OUT_BINT_PARAM2  INDICATOR  SB2,
<                 OUT_INT_PARAM1   SB4,         OUT_INT_PARAM1   INDICATOR  SB2,
<                 OUT_INT_PARAM2   SB4,         OUT_INT_PARAM2   INDICATOR  SB2,
<                 OUT_TIME_PARAM1  OCIDATETIME, OUT_TIME_PARAM1  INDICATOR  SB2,
<                 OUT_TIME_PARAM2  OCIDATETIME, OUT_TIME_PARAM2  INDICATOR  SB2)
<      LIBRARY DBMS_AQINT_LIB;
SYS.DBMS_RCVMAN - PACKAGE BODY (19.4RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.04.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.04.02.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.06.00.00'; 
10986c10986,10987
<     WHERE CON.CON_ID >= 1;
---
>     WHERE CON.CON_ID >= 1
>  ORDER BY CON.CON_ID;
30686a30688,30743
> 
> 
> PROCEDURE LISTPDBS
> IS
> BEGIN
>    DEB(DEB_ENTER, 'listPdbs');
> 
> 
>    IF (TRANSLATEPDBNAME_C%ISOPEN) THEN
>       CLOSE TRANSLATEPDBNAME_C;
>    END IF;
> 
>    OPEN TRANSLATEPDBNAME_C;
> 
> 
>    DEB(DEB_EXIT);
> END LISTPDBS;
> 
> 
> FUNCTION LISTGETPDB(
>    PDBNAME      OUT VARCHAR2,
>    PDBID        OUT NUMBER,
>    PDBGUID      OUT VARCHAR2)
> RETURN NUMBER IS
>    LOCAL    PDBNAMEREC_T;
> BEGIN
> 
> 
>    FETCH TRANSLATEPDBNAME_C INTO LOCAL;
>    IF TRANSLATEPDBNAME_C%NOTFOUND THEN
>       DEB(DEB_PRINT, 'found all the PDBs, closing translatePdbName_c');
>       CLOSE TRANSLATEPDBNAME_C;
>       RETURN FALSE#;
>    ELSE
>       PDBNAME := LOCAL.NAME;
>       PDBID   := LOCAL.PDBID;
>       PDBGUID := LOCAL.PDBGUID;
>       RETURN TRUE#;
>    END IF;
> 
> END LISTGETPDB;
> 
> 
> PROCEDURE ENDLISTPDBS
> IS
> BEGIN
>    DEB(DEB_ENTER, 'endListPdbs');
> 
> 
>    IF (TRANSLATEPDBNAME_C%ISOPEN) THEN
>       CLOSE TRANSLATEPDBNAME_C;
>    END IF;
> 
> 
>    DEB(DEB_EXIT);
> END ENDLISTPDBS;
SYS.DBMS_RCVMAN - PACKAGE BODY (19.5RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.01.00'; 
SYS.DBMS_SMB_INTERNAL - PACKAGE BODY (RU):
728d727
<     EMPTY_FILTER    VARCHAR2(25);
730,749d728
<     DELETE FROM SMB$CONFIG;
< 
<     
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE) VALUES 
<       ('SPACE_BUDGET_PERCENT', 10);
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE) VALUES 
<       ('PLAN_RETENTION_WEEKS', 53);
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE) VALUES 
<       ('SPM_TRACING', 0);
< 
<     
<     EMPTY_FILTER := '<filters></filters>';
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
<       VALUES ('AUTO_CAPTURE_PARSING_SCHEMA_NAME', 0, EMPTY_FILTER);
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
<       VALUES ('AUTO_CAPTURE_MODULE', 0, EMPTY_FILTER);
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
<       VALUES ('AUTO_CAPTURE_ACTION', 0, EMPTY_FILTER);
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA) 
<       VALUES ('AUTO_CAPTURE_SQL_TEXT', 0, EMPTY_FILTER);
753c732
<     DBMS_SPM_INTERNAL.LOAD_AUTO_EVOLVE_TASK_CONFIG;
---
>     DBMS_SPM_INTERNAL.LOAD_SPM_SMB_CONFIG;
SYS.DBMS_SPM - PACKAGE BODY (19.4RUR):
535,538c535,537
<         SYS.DBMS_SPM_INTERNAL.CHECK_AUTO_SPM_ENABLED;
< 
<         DBMS_AUTO_TASK_ADMIN.ENABLE('Auto SPM Task', NULL, NULL);
<         DBMS_AUTO_TASK_ADMIN.ENABLE('Auto STS Capture Task', NULL, NULL);
---
>         
>         
>         
544a544,549
> 
>         
>         SYS.DBMS_SPM_INTERNAL.CHECK_AUTO_SPM_ENABLED;
> 
>         DBMS_AUTO_TASK_ADMIN.ENABLE('Auto SPM Task', NULL, NULL);
>         DBMS_AUTO_TASK_ADMIN.ENABLE('Auto STS Capture Task', NULL, NULL);
SYS.DBMS_SPM - PACKAGE BODY (RU):
9c9,10
<   PLAN_RETENTION_WEEKS_DEFAULT   CONSTANT NUMBER := 53;
---
>   PLAN_RETENTION_WEEKS_DEFAULT   CONSTANT NUMBER :=
>     DBMS_SPM_INTERNAL.PLAN_RETENTION_WEEKS_DEFAULT;
15c16,17
<   SPACE_BUDGET_PERCENT_DEFAULT   CONSTANT NUMBER := 10;
---
>   SPACE_BUDGET_PERCENT_DEFAULT   CONSTANT NUMBER := 
>     DBMS_SPM_INTERNAL.SPACE_BUDGET_PERCENT_DEFAULT;
528c530,532
<     IF (PARAMETER_NAME = DBMS_SPM_INTERNAL.AUTO_SPM_EVOLVE_TASK) THEN
---
>     IF (PARAMETER_NAME = SYS.DBMS_SPM_INTERNAL.AUTO_SPM_EVOLVE_TASK) THEN
>       
>       
534a539,551
>         
>         
>         
>         
>         
>         
>         SYS.PRVT_ADVISOR.SET_TASK_PARAMETER(
>           TASK_NAME => SYS.DBMS_SPM_INTERNAL.AUTO_EVOLVE_TASK_NAME,
>           PARAMETER => PAR_ALTERNATE_BASELINE,
>           DATA      => SYS.DBMS_SPM_INTERNAL.AUTO_EVOLVE_TASK_ALTERNATE_VAL,
>           TASK_OWNER_ID => SYS.PRVT_ADVISOR.SYS_USER_ID);
> 
>         
539,544d555
< 
<         
<         DBMS_ADVISOR.SET_TASK_PARAMETER(
<           DBMS_SPM_INTERNAL.AUTO_EVOLVE_TASK_NAME,
<           PAR_ALTERNATE_BASELINE,
<           DBMS_SPM_INTERNAL.AUTO_EVOLVE_TASK_ALTERNATE_VAL);
SYS.DBMS_SPM_INTERNAL - PACKAGE BODY (RU):
91c91
<                source.elapsed_time, source.executions,
---
>                source.elapsed_time, source.executions DESC NULLS LAST,
94a95,113
>  
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   ALTERNATE_PLAN_ORDER_BY_AI VARCHAR2(32767) :=
>     ' ORDER BY source.elapsed_time, source.cpu_time, source.buffer_gets, 
>                source.executions DESC NULLS LAST, source.disk_reads, 
>                source.direct_writes ';
> 
107,108c126
<                cc.buffer_gets,
<                cc.direct_writes,
---
>                cc.buffer_gets,               cc.direct_writes,
494c512
<                     min(cpu_plus_io)) > :ratio * 100) 
---
>                     min(cpu_plus_io)) > :ratio / 100) 
511a530,533
>   
>   
>   
>   
551c573,577
<         and ai.execution_name = spa.exec_name) highload #';
---
>         and ai.execution_name = spa.exec_name
>         and not exists 
>           (select 1 from dba_sql_plan_baselines b
>             where dbms_sqltune_util0.sqltext_to_sqlid(b.sql_text) = ai.sql_id_vc
>             and b.accepted = 'YES')) highload #';
1662c1688,1695
<   PROCEDURE LOAD_AUTO_EVOLVE_TASK_CONFIG
---
>   
>   
>   
>   
>   
>   PROCEDURE INIT_SPM_SMB_PARAMETERS(
>     PARAMETER_NAME  IN VARCHAR2, 
>     PARAMETER_VALUE IN NUMBER)
1663a1697,1698
>     EXIST_CNT NUMBER;
>     EMPTY_FILTER VARCHAR(25);
1666,1668c1701,1703
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
<     VALUES (AUTO_SPM_EVOLVE_TASK, 0, 
<             AUTO_SPM_EVOLVE_TASK_DEFAULT);
---
>     SELECT COUNT(*) INTO EXIST_CNT
>     FROM SMB$CONFIG
>     WHERE PARAMETER_NAME = INIT_SPM_SMB_PARAMETERS.PARAMETER_NAME;
1670,1672c1705,1736
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE) VALUES 
<       (AUTO_SPM_EVOLVE_TASK_ITV,
<        AUTO_EVOLVE_TASK_ITV_DEFAULT);
---
>     IF (EXIST_CNT = 0) THEN
>       
>       IF (PARAMETER_NAME IN (SPACE_BUDGET_PERCENT, PLAN_RETENTION_WEEKS,
>                                  SPM_TRACING, AUTO_SPM_EVOLVE_TASK_ITV,
>                                  AUTO_SPM_EVOLVE_TASK_MAX_RT )) THEN
>    
>         INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE)
>         VALUES (INIT_SPM_SMB_PARAMETERS.PARAMETER_NAME, 
>                 INIT_SPM_SMB_PARAMETERS.PARAMETER_VALUE);
>    
>       
>       ELSIF(PARAMETER_NAME IN (AUTOCAP_SQL_TEXT, AUTOCAP_MODULE, 
>                                    AUTOCAP_ACTION, AUTOCAP_USER)) THEN
>    
>         EMPTY_FILTER := '<filters></filters>';
>         INSERT INTO SMB$CONFIG
>           (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
>         VALUES (INIT_SPM_SMB_PARAMETERS.PARAMETER_NAME, 
>                 INIT_SPM_SMB_PARAMETERS.PARAMETER_VALUE, EMPTY_FILTER);
>    
>       
>       ELSIF(PARAMETER_NAME = AUTO_SPM_EVOLVE_TASK) THEN
>         INSERT INTO SMB$CONFIG 
>           (PARAMETER_NAME, PARAMETER_VALUE, PARAMETER_DATA)
>         VALUES (INIT_SPM_SMB_PARAMETERS.PARAMETER_NAME, 
>                 INIT_SPM_SMB_PARAMETERS.PARAMETER_VALUE,
>                 AUTO_SPM_EVOLVE_TASK_DEFAULT);
>       END IF;
> 
>     END IF;
> 
>   END INIT_SPM_SMB_PARAMETERS;
1674,1676d1737
<     INSERT INTO SMB$CONFIG (PARAMETER_NAME, PARAMETER_VALUE) VALUES 
<       (AUTO_SPM_EVOLVE_TASK_MAX_RT,
<        AUTO_EVOLVE_TASK_MAX_RT_DEF);
1678c1739,1784
<   END  LOAD_AUTO_EVOLVE_TASK_CONFIG;
---
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   PROCEDURE LOAD_SPM_SMB_CONFIG
>   IS
>   BEGIN
>     
>     INIT_SPM_SMB_PARAMETERS(SPACE_BUDGET_PERCENT,
>                             SPACE_BUDGET_PERCENT_DEFAULT);
>     INIT_SPM_SMB_PARAMETERS(PLAN_RETENTION_WEEKS, 
>                             PLAN_RETENTION_WEEKS_DEFAULT);
>     INIT_SPM_SMB_PARAMETERS(SPM_TRACING, SPM_TRACING_DEFAULT);
> 
>     
>     INIT_SPM_SMB_PARAMETERS(AUTOCAP_SQL_TEXT, 0);
>     INIT_SPM_SMB_PARAMETERS(AUTOCAP_MODULE, 0);
>     INIT_SPM_SMB_PARAMETERS(AUTOCAP_ACTION, 0);
>     INIT_SPM_SMB_PARAMETERS(AUTOCAP_USER, 0);
>    
>     
>    
>     INIT_SPM_SMB_PARAMETERS(AUTO_SPM_EVOLVE_TASK, 0);
>     INIT_SPM_SMB_PARAMETERS(AUTO_SPM_EVOLVE_TASK_ITV,
>                             AUTO_EVOLVE_TASK_ITV_DEFAULT);
>     INIT_SPM_SMB_PARAMETERS(AUTO_SPM_EVOLVE_TASK_MAX_RT, 
>                             AUTO_EVOLVE_TASK_MAX_RT_DEF);
>   
>     
>     DBMS_SPM.CONFIGURE(AUTO_SPM_EVOLVE_TASK, AUTO_SPM_EVOLVE_TASK_DEFAULT);
> 
>     EXCEPTION
>       WHEN OTHERS THEN
>         NULL;
> 
>   END LOAD_SPM_SMB_CONFIG;
3145a3252,3259
>     
>     
>     
>     
>     
>     
>     
> 
3150c3264
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
---
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
3152d3265
<                           /STATS.TESTEXEC_TOTAL_EXECS
3155c3268
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
---
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
3157d3269
<                           /STATS.TESTEXEC_TOTAL_EXECS
3160,3161c3272,3273
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
<                     FLOOR(STATS.BUFFER_GETS/STATS.TESTEXEC_TOTAL_EXECS)),
---
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
>                     STATS.BUFFER_GETS),
3163,3168c3275,3280
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
<                     FLOOR(STATS.DISK_READS/STATS.TESTEXEC_TOTAL_EXECS)),
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
<                     FLOOR(STATS.DIRECT_WRITES/STATS.TESTEXEC_TOTAL_EXECS)),
<              DECODE(STATS.TESTEXEC_TOTAL_EXECS, 0, 0, NULL, 0,
<                     FLOOR(STATS.ROWS_PROCESSED/STATS.TESTEXEC_TOTAL_EXECS))
---
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
>                     STATS.DISK_READS),
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
>                     STATS.DIRECT_WRITES),
>              DECODE(STATS.EXECUTIONS, 0, 0, NULL, 0,
>                     STATS.ROWS_PROCESSED)
4485,4486c4597,4602
<                            source.plan_hash_value <> highload.plan_hash_value'
<                            || ALTERNATE_PLAN_ORDER_BY_CLAUSE || ')';
---
>                            source.plan_hash_value <> highload.plan_hash_value';
>       IF(AIMODE) THEN
>         ALT_QUERY := ALT_QUERY || ALTERNATE_PLAN_ORDER_BY_AI || ')';
>       ELSE
>         ALT_QUERY := ALT_QUERY || ALTERNATE_PLAN_ORDER_BY_CLAUSE || ')';
>       END IF;
4889,4892c5005,5016
<                FETCH_NAME_USING_SIG_CAT_PID(
<                DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(PLAN_ROW.SQL_TEXT,
<                FALSE), DBMS_SMB_INTERNAL.DEFAULT_VAL, 
<                PLAN_ROW.PLAN_HASH_VALUE) IS NOT NULL) THEN
---
>             FETCH_NAME_USING_SIG_CAT_PID(
>             DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(PLAN_ROW.SQL_TEXT,
>             FALSE), DBMS_SMB_INTERNAL.DEFAULT_VAL, 
>             PLAN_ROW.PLAN_HASH_VALUE) IS NOT NULL AND
>             
>             
>             
>             
>             
>             
>             
>             NOT AI_MODE) THEN
5273,5276c5397,5408
<               FETCH_NAME_USING_SIG_CAT_PID(
<                DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(PLAN_ROW_STS.SQL_TEXT,FALSE),
<                DBMS_SMB_INTERNAL.DEFAULT_VAL,
<                PLAN_ROW_STS.PLAN_HASH_VALUE) IS NOT NULL) THEN
---
>             FETCH_NAME_USING_SIG_CAT_PID(
>             DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(PLAN_ROW_STS.SQL_TEXT,FALSE),
>             DBMS_SMB_INTERNAL.DEFAULT_VAL,
>             PLAN_ROW_STS.PLAN_HASH_VALUE) IS NOT NULL AND
>             
>             
>             
>             
>             
>             
>             
>             NOT AI_MODE) THEN
5756c5888
<             (FETCH_NAME_USING_SIG_CAT_PID(
---
>             FETCH_NAME_USING_SIG_CAT_PID(
5759c5891,5899
<             SQLSET_REC.PLAN_HASH_VALUE) IS NOT NULL)) THEN
---
>             SQLSET_REC.PLAN_HASH_VALUE) IS NOT NULL AND
>             
>             
>             
>             
>             
>             
>             
>             NOT AI_MODE) THEN
SYS.DBMS_SQLTUNE - PACKAGE BODY (RU):
14291c14291,14294
<       (SELECT INST_ID,
---
>       (SELECT * 
>          FROM 
>          TABLE(GV$(CURSOR(
>               SELECT USERENV('instance') AS INST_ID,
14408,14409c14411,14412
<        FROM   GV$ALL_SQL_MONITOR MO1
<        WHERE  MO1.INST_ID BETWEEN I_REPORT_SQL_MONITOR_XML.TARGET_INST_ID_LOW
---
>        FROM   V$ALL_SQL_MONITOR MO1
>        WHERE  USERENV('INSTANCE') BETWEEN I_REPORT_SQL_MONITOR_XML.TARGET_INST_ID_LOW
14432c14435,14437
<                                      MO1.PX_SERVER#)))),
---
>                                      MO1.PX_SERVER#)))
>        )))                               
>       ),
18021,18039c18026,18056
<                  (SELECT   LO.SQL_PLAN_LINE_ID            PLAN_LINE_ID,
<                            DECODE(SUM(LO.TOTALWORK), 0, NULL,
<                                  ROUND(SUM(LO.SOFAR)*100/SUM(LO.TOTALWORK)))
<                                                           PERCENT_COMPLETE,
<                            MAX(LO.TIME_REMAINING)         TIME_REMAINING
<                   FROM     GV$SESSION_LONGOPS LO,
<                            MONITOR_DATA MO
<                WHERE    (I_REPORT_SQL_MONITOR_XML.TARGET_IS_RUNNING = 'Y'
<                             OR I_REPORT_SQL_MONITOR_XML.TARGET_STATUS = 
<                                         'DONE (ERROR)')
<                     AND    LO.SQL_ID
<                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_ID
<                     AND    LO.SQL_EXEC_START
<                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_START
<                     AND    LO.SQL_EXEC_ID
<                            = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_ID
<                     AND    LO.INST_ID     = MO.INST_ID
<                     AND    LO.SID         = MO.SID
<                   GROUP BY LO.SQL_PLAN_LINE_ID) LO,
---
>                 (SELECT  LO2.SQL_PLAN_LINE_ID PLAN_LINE_ID,
>                         DECODE(SUM(LO2.TOTALWORK), 0, NULL,
>                                    ROUND(SUM(LO2.SOFAR)*100/SUM(LO2.TOTALWORK)))
>                                                             PERCENT_COMPLETE,
>                         MAX(LO2.TIME_REMAINING)       TIME_REMAINING
>                  FROM   MONITOR_DATA MO,
>                        (SELECT * 
>                         FROM  
>                           TABLE( 
>                             GV$(CURSOR( 
>                               SELECT USERENV('instance') INST_ID, 
>                                  SQL_PLAN_LINE_ID,
>                                  TOTALWORK,
>                                  SOFAR, 
>                                  TIME_REMAINING,
>                                  SID
>                               FROM   V$SESSION_LONGOPS L    
>                               WHERE  (I_REPORT_SQL_MONITOR_XML.TARGET_IS_RUNNING = 'Y'
>                                       OR I_REPORT_SQL_MONITOR_XML.TARGET_STATUS = 
>                                                 'DONE (ERROR)')
>                                      AND   L.SQL_ID
>                                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_ID
>                                      AND   L.SQL_EXEC_START
>                                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_START
>                                      AND   L.SQL_EXEC_ID
>                                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_ID
>                             )))) LO2
>                  WHERE
>                        LO2.INST_ID    = MO.INST_ID
>                  AND   LO2.SID        = MO.SID
>                  GROUP BY LO2.SQL_PLAN_LINE_ID ) LO, 
18260c18277,18294
<                               FROM GV$ALL_SQL_PLAN_MONITOR A) PLM,
---
>                               FROM 
>                                 (SELECT * FROM TABLE(GV$(CURSOR( 
>                                    SELECT USERENV('instance') INST_ID, A0.*
>                                    FROM V$ALL_SQL_PLAN_MONITOR A0
>                                    WHERE   
>                                     A0.SQL_ID = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_ID
>                                     AND A0.SQL_EXEC_START 
>                                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_START
>                                     AND A0.SQL_EXEC_ID
>                                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_ID
>                                     AND  USERENV('instance')
>                                              BETWEEN 
>                                          I_REPORT_SQL_MONITOR_XML.TARGET_INST_ID_LOW
>                                              AND 
>                                          I_REPORT_SQL_MONITOR_XML.TARGET_INST_ID_HIGH
>                                  )))
>                                 ) A
>                               ) PLM,
18262,18268c18296
<                     WHERE    PLM.SQL_ID = 
<                                 I_REPORT_SQL_MONITOR_XML.TARGET_SQL_ID
<                       AND    PLM.SQL_EXEC_START
<                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_START
<                       AND    PLM.SQL_EXEC_ID
<                          = I_REPORT_SQL_MONITOR_XML.TARGET_SQL_EXEC_ID
<                       AND    PLM.INST_ID         = MO.INST_ID
---
>                     WHERE    PLM.INST_ID         = MO.INST_ID
SYS.DBMS_STATS - PACKAGE BODY (RU):
45689c45689
<      :=    'dbms_stats.ather_system_stats(gathering_mode=>''flush_cache'');';
---
>      :=    'dbms_stats.gather_system_stats(gathering_mode=>''flush_cache'');';
SYS.DBMS_STATS_ADVISOR - PACKAGE BODY (RU):
3655c3655,3657
<       DBMS_STATS_INTERNAL.WRITE_CLOB_TO_FILE(DIR_NAME, FILE_NAME, SCRIPT);
---
>       
>       
>       DBMS_LOB.CLOB2FILE(SCRIPT, DIR_NAME, FILE_NAME);
SYS.DBMS_SWRF_REPORT_INTERNAL - PACKAGE BODY (RU):
17973a17974,18028
>      IF RPT_INST IS NOT NULL AND L_DBID = SYS_CONTEXT('USERENV', 'DBID') THEN
>         BEGIN
>            CURSOR_STR_IN :=
>                'SELECT  distinct sp.instance_number 
>                 FROM ' || DBMS_UMF_PROTECTED.KEUQQPAT_AWR_VN_DFLT_PAT
>                        || 'pdb_in_snap sp, '
>                        || DBMS_UMF_PROTECTED.KEUQQPAT_AWR_VN_DFLT_PAT
>                        || 'pdb_in_snap ep
>                 WHERE sp.dbid = :dbid
>                       AND ep.dbid = :dbid
>                       AND sp.snap_id = :bid
>                       AND ep.snap_id = :eid
>                       AND sp.con_dbid = SYS_CONTEXT(''USERENV'', ''CON_DBID'') 
>                       AND sp.con_dbid = ep.con_dbid
>                       AND sp.instance_number = ep.instance_number';
> 
>            DBMS_UMF_PROTECTED.PSF_INIT_DEFINES(DEFS);
> 
>            DBMS_UMF_PROTECTED.PSF_INIT_BINDS(BINDS);
>            DBMS_UMF_PROTECTED.PSF_ADD_BIND(
>            DBMS_UMF_PROTECTED.PSF_BIND_DBID_TYPE, L_DBID, BINDS);
>            DBMS_UMF_PROTECTED.PSF_ADD_BIND(
>            DBMS_UMF_PROTECTED.PSF_BIND_BID_TYPE,  L_BEGIN_SNAP, BINDS);
>            DBMS_UMF_PROTECTED.PSF_ADD_BIND(
>            DBMS_UMF_PROTECTED.PSF_BIND_EID_TYPE,  L_END_SNAP, BINDS);
> 
>            NUM_ROWS := DBMS_UMF_PROTECTED.PSF_EXECUTE_QUERY(
>              CURSOR_STR_IN, DBMS_UMF_PROTECTED.PSF_INST_LIST_QUERY_TYPE,
>              DEFS, BINDS, PS_ENV_FLAG);
> 
>            IF NUM_ROWS = 0 THEN
>               RAISE NO_DATA_FOUND;
>            END IF;
> 
>            DBMS_UMF_PROTECTED.PSF_GET_DEFINE(DEFS, 1, RPT_INST);
> 
>         EXCEPTION
>                                                                  
> 
>            WHEN NO_DATA_FOUND THEN
>               COMMENTS := COMMENTS || 
>                    '-> Error: no instance open at database ' || 
>                    SYS_CONTEXT('USERENV', 'CON_DBID') ||
>                    '  during specified snapshot interval ' ||
>                    L_BEGIN_SNAP || '-' || L_END_SNAP || NL_CHR;
>            WHEN OTHERS THEN
>               COMMENTS := COMMENTS || 
>                           '-> checking for error at awr_root_pdb_in_snap '
>                           || SQLERRM || NL_CHR;
>            RAISE;
>                                                                    
>         END;
>      END IF; 
> 
>      
SYS.DBMS_TRANSFORM_EXIMP - PACKAGE BODY (RU):
10a11,23
> 
> 
> 
> 
>   FUNCTION KWQAEXGCUR(STMT          IN     VARCHAR2,
>                       BND_ARRAY     IN OUT AQ$_BND_ARRAY,
>                       USER          IN     VARCHAR2    DEFAULT NULL,
>                       FLAGS         IN     PLS_INTEGER DEFAULT NULL,
>                       OPCODE        IN     PLS_INTEGER DEFAULT NULL)
>             RETURN SYS_REFCURSOR;
>   PRAGMA INTERFACE(C, KWQAEXGCUR);
> 
>   
181c194,195
< 
---
>     TRANS_BNDS      AQ$_BND_ARRAY;
>     TRANS_CUR       SYS_REFCURSOR;
198,199c212,213
<       EXECUTE IMMEDIATE
<         'SELECT trans_name FROM ' ||
---
>       TRANS_BNDS := AQ$_BND_ARRAY();
>       TRANS_CUR := KWQAEXGCUR('SELECT trans_name FROM ' ||
203,204c217,219
<         ' GROUP BY trans_name ORDER BY trans_name'
<       BULK COLLECT INTO TRANS_NAMES;
---
>         ' GROUP BY trans_name ORDER BY trans_name', TRANS_BNDS);
>       FETCH TRANS_CUR BULK COLLECT INTO TRANS_NAMES;
>       CLOSE TRANS_CUR; 
SYS.DBMS_TRANSFORM_EXIMP_INTERNAL - PACKAGE BODY (RU):
16c16
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
SYS.DBMS_TRANSFORM_INTERNAL - PACKAGE BODY (RU):
8c8
<   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(512);
---
>   TYPE STR_ARRAY_TYPE IS VARRAY(100) OF VARCHAR2(32767);
16c16,17
<   END;  
---
>   END;
> 
SYS.KUPW$WORKER - PACKAGE BODY (RU):
26836c26836
<                        V_SINGLE_DDL_CLOB);
---
>                        DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB, 1500, 1));
27382,27383c27382,27384
<                        NVL(TO_CHAR(BIND_PATTERN), 'NULL') || ',' ||
<                        DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB,100,1));
---
>                  NVL(TO_CHAR(BIND_PATTERN), 'NULL') || ', ddllen=' ||
>                  LENGTH(V_SINGLE_DDL_CLOB) || ', ' ||
>                  DBMS_LOB.SUBSTR(V_SINGLE_DDL_CLOB,250,1));
SYS.AQ$_BND - TYPE (RU):
0a1,40
> TYPE aq$_bnd FORCE AS OBJECT (
>    dtype        NUMBER,            /* data type of bind variable
>                                        0 - VARCHAR2
>                                        1 - NUMBER
>                                        2 - RAW
>                                        3 - TIMESTAMP WITH TIMEZONE
>                                        4 - UROWID
>                                                                   */
>    bmode        NUMBER,               /* bind mode (IN|OUT)
>                                                0 - IN, 1 - OUT    */
> 
>    sz           NUMBER,       /* Maximum size of data buffer
>                                       in case of OUT bind         */
> 
>    /* Depending the datatype set in dtype, only one of the following
>     * fields is used at any given point.
>     */
>    str_val      VARCHAR2(32767),
>    num_val      NUMBER,
>    raw_val      RAW(32767),
>    tm_val       TIMESTAMP WITH TIME ZONE,
> 
>    /* Constructors overloaded for different data types
>     *
>     * PARAMETERS  TO CONSTRUCTOR METHODS:
>     *
>     *   xxx_val   - Data value of the bind variable
>     *   bmode     - Bind mode (IN|OUT)
>     *                 0 - IN, 1 - OUT
>     *   size      - Maximum size of data buffer in case of out bind
>     *               Used oly for constructor methods of VARCHAR2, RAW, LONG RAW types
>     */
> 
>    CONSTRUCTOR FUNCTION aq$_bnd(str_val VARCHAR2, bmode PLS_INTEGER DEFAULT 0, sz PLS_INTEGER DEFAULT 0) RETURN SELF AS RESULT,
>    CONSTRUCTOR FUNCTION aq$_bnd(num_val NUMBER, bmode PLS_INTEGER DEFAULT 0) RETURN SELF AS RESULT,
>    CONSTRUCTOR FUNCTION aq$_bnd(raw_val RAW, bmode PLS_INTEGER DEFAULT 0, sz PLS_INTEGER DEFAULT 0) RETURN SELF AS RESULT,
>    CONSTRUCTOR FUNCTION aq$_bnd(tm_val TIMESTAMP WITH TIME ZONE, bmode PLS_INTEGER DEFAULT 0) RETURN SELF AS RESULT,
>    CONSTRUCTOR FUNCTION aq$_bnd(urowid_val VARCHAR2, bmode PLS_INTEGER DEFAULT 0) RETURN SELF AS RESULT
> ) NOT PERSISTABLE;
> 
SYS.AQ$_BND_ARRAY - TYPE (RU):
0a1
> TYPE aq$_bnd_array FORCE IS VARRAY(64) OF (aq$_bnd) NOT PERSISTABLE;
SYS.AQ$_BND - TYPE BODY (RU):
0a1,57
> TYPE BODY aq$_bnd AS
> 
> CONSTRUCTOR FUNCTION aq$_bnd(str_val VARCHAR2, bmode PLS_INTEGER DEFAULT 0,
>                              sz PLS_INTEGER DEFAULT 0)
>                      RETURN SELF AS RESULT IS
> BEGIN
>   SELF.dtype := 0;
>   SELF.bmode := bmode;
>   SELF.sz := sz;
>   SELF.str_val := str_val;
>   RETURN;
> END;
> 
> CONSTRUCTOR FUNCTION aq$_bnd(num_val NUMBER, bmode PLS_INTEGER DEFAULT 0)
>                      RETURN SELF AS RESULT IS
> BEGIN
>   SELF.dtype := 1;
>   SELF.bmode := bmode;
>   SELF.sz := 0;
>   SELF.num_val := num_val;
>   RETURN;
> END;
> 
> CONSTRUCTOR FUNCTION aq$_bnd(raw_val RAW, bmode PLS_INTEGER DEFAULT 0,
>                              sz PLS_INTEGER DEFAULT 0)
>                      RETURN SELF AS RESULT IS
> BEGIN
>   SELF.dtype := 2;
>   SELF.bmode := bmode;
>   SELF.sz := sz;
>   SELF.raw_val := raw_val;
>   RETURN;
> END;
> 
> CONSTRUCTOR FUNCTION aq$_bnd(tm_val TIMESTAMP WITH TIME ZONE,
>                              bmode PLS_INTEGER DEFAULT 0)
>                      RETURN SELF AS RESULT IS
> BEGIN
>   SELF.dtype := 3;
>   SELF.bmode := bmode;
>   SELF.sz := 0;
>   SELF.tm_val := tm_val;
>   RETURN;
> END;
> 
> CONSTRUCTOR FUNCTION aq$_bnd(urowid_val VARCHAR2, bmode PLS_INTEGER DEFAULT 0)
>                      RETURN SELF AS RESULT IS
> BEGIN
>   SELF.dtype := 4;
>   SELF.bmode := bmode;
>   SELF.sz := 0;
>   SELF.str_val := urowid_val;
>   RETURN;
> END;
> 
> END;
> 
XDB.DBMS_JSON - PACKAGE BODY (RU):
248a249
>                       MAXVC NUMBER,
253,256c254,258
< TYPESTR VARCHAR(4000);
< VCNAME VARCHAR2(130);
< VNM    VARCHAR2(130);
< DM VARCHAR2(130);
---
> TYPESTR VARCHAR2(4000);
> VCNAME  VARCHAR2(130);
> VNM     VARCHAR2(130);
> DM      VARCHAR2(130);
> LEN     NUMBER;
274,275c276,284
<   ELSIF (COLOBJ.GET_STRING('type') = 'string' OR
<          COLOBJ.GET_STRING('type') = 'boolean' OR
---
>   ELSIF (COLOBJ.GET_STRING('type') = 'string') THEN
>     
>     LEN := COLOBJ.GET_NUMBER('o:length');
>     IF (LEN <= MAXVC) THEN
>       TYPESTR := ' varchar2('|| LEN ||') path ';
>     ELSE
>       TYPESTR := ' clob path ';
>     END IF;
>   ELSIF (COLOBJ.GET_STRING('type') = 'boolean' OR
370a380
>                      MAXVC NUMBER,
434c444
<         BUILDJCOLS(TEMPOBJ, PATH, FIRST, JDDL, ERRST, RCLST, COLCNT);
---
>         BUILDJCOLS(TEMPOBJ, PATH, FIRST, JDDL, MAXVC, ERRST, RCLST, COLCNT);
458c468
<                  ERRST, RCLST, COLCNT);
---
>                  MAXVC, ERRST, RCLST, COLCNT);
470c480
<                     ERRST, RCLST, COLCNT);
---
>                     MAXVC, ERRST, RCLST, COLCNT);
481,482c491,492
<           BUILDCOLUMN(ITEMSOBJ, '$[*]', FIRSTINNESTED, JDDL, ERRST, RCLST,
<                       COLCNT);
---
>           BUILDCOLUMN(ITEMSOBJ, '$[*]', FIRSTINNESTED, JDDL, MAXVC,
>                       ERRST, RCLST, COLCNT);
492c502,503
<           BUILDJCOLS(PROPSOBJ, '$', FIRSTINNESTED, JDDL, ERRST, RCLST, COLCNT);
---
>           BUILDJCOLS(PROPSOBJ, '$', FIRSTINNESTED, JDDL, MAXVC,
>                      ERRST, RCLST, COLCNT);
508c519
<                   ERRST, RCLST, COLCNT);
---
>                   MAXVC, ERRST, RCLST, COLCNT);
537a549
> MAXVC  NUMBER;
543a556
>   MAXVC := SYS.DBMS_JSON0.GETMAXVCSIZE();
550c563
<   BUILDJCOLS(PROPS, '$', FIRSTJCOL, JSNDDL, ERRST, RCSTK, COLCNT);
---
>   BUILDJCOLS(PROPS, '$', FIRSTJCOL, JSNDDL, MAXVC, ERRST, RCSTK, COLCNT);
XDB.DBMS_SODA_ADMIN - PACKAGE BODY (RU):
116,126c116,133
<     FOR I IN 1..V_ID_LENGTH LOOP
<       V_ID_CHAR := SUBSTR(P_URI_NAME,I,1);
<       IF (V_ID_CHAR = '"') THEN
<         V_ID_CHAR := '_';
<       ELSIF (INSTR(CONTROL_CHARS, V_ID_CHAR) > 0) THEN
<         V_ID_CHAR := '_';
<       ELSIF (INSTR('abcdefghijklmnopqrstuvwxyz', V_ID_CHAR) > 0) THEN
<         V_HAS_LOWER := TRUE;
<       ELSIF (INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ', V_ID_CHAR) > 0) THEN
<         V_HAS_UPPER := TRUE;
<       ELSIF (INSTR('0123456789_$#', V_ID_CHAR) <= 0) THEN
---
>     BEGIN
>       FOR I IN 1..V_ID_LENGTH LOOP
>         V_ID_CHAR := SUBSTR(P_URI_NAME,I,1);
>         IF (V_ID_CHAR = '"') THEN
>           V_ID_CHAR := '_';
>         ELSIF (INSTR(CONTROL_CHARS, V_ID_CHAR) > 0) THEN
>           V_ID_CHAR := '_';
>         ELSIF (INSTR('abcdefghijklmnopqrstuvwxyz', V_ID_CHAR) > 0) THEN
>           V_HAS_LOWER := TRUE;
>         ELSIF (INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ', V_ID_CHAR) > 0) THEN
>           V_HAS_UPPER := TRUE;
>         ELSIF (INSTR('0123456789_$#', V_ID_CHAR) <= 0) THEN
>           V_TO_UPPER := FALSE;
>         END IF;
>         P_TABLE_NAME := P_TABLE_NAME||V_ID_CHAR;
>       END LOOP;
>       
>       IF ((V_HAS_UPPER) AND (V_HAS_LOWER)) THEN
129,142c136,147
<       P_TABLE_NAME := P_TABLE_NAME||V_ID_CHAR;
<     END LOOP;
<    
<     IF ((V_HAS_UPPER) AND (V_HAS_LOWER)) THEN
<         V_TO_UPPER := FALSE;
<     END IF;
<     
<     V_ID_CHAR := SUBSTR(P_TABLE_NAME,1,1);
<     IF (V_TO_UPPER AND
<         ((INSTR('abcdefghijklmnopqrstuvwxyz', V_ID_CHAR) > 0) OR
<          (INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ', V_ID_CHAR) > 0))) THEN
<       P_TABLE_NAME := UPPER(P_TABLE_NAME);
<     END IF;
<     
---
>       
>       V_ID_CHAR := SUBSTR(P_TABLE_NAME,1,1);
>       IF (V_TO_UPPER AND
>           ((INSTR('abcdefghijklmnopqrstuvwxyz', V_ID_CHAR) > 0) OR
>            (INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ', V_ID_CHAR) > 0))) THEN
>         P_TABLE_NAME := UPPER(P_TABLE_NAME);
>       END IF;
>       
>     EXCEPTION WHEN OTHERS THEN
>       
>       SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40674,'table or column name',128);
>     END;
703c708
<              (P_KEY_ASSIGNMENT_METHOD <> 'MONGO')) THEN
---
>              (P_KEY_ASSIGNMENT_METHOD <> 'OID')) THEN
707c712
<           'UUID, MONGO');
---
>           'UUID, OID');
719c724
<       ELSIF ((P_KEY_ASSIGNMENT_METHOD = 'MONGO') AND
---
>       ELSIF ((P_KEY_ASSIGNMENT_METHOD = 'OID') AND
1311c1316
<           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);  
---
>           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);
1318c1323
<           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);  
---
>           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);
1325c1330
<           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);  
---
>           SYS.DBMS_SODA_UTIL.RAISE_SYSTEM_ERROR(-40646, V_CONTENT_COLUMN_TYPE);
1351,1352c1356,1357
<     ELSIF (UPPER(V_KEY_ASSIGNMENT_METHOD) = 'MONGO') THEN
<       V_KEY_ASSIGNMENT_METHOD := 'MONGO';
---
>     ELSIF (UPPER(V_KEY_ASSIGNMENT_METHOD) = 'OID') THEN
>       V_KEY_ASSIGNMENT_METHOD := 'OID';
1524c1529
<         (V_KEY_ASSIGNMENT_METHOD IN ('EXTRACT','INSERT','MONGO'))) THEN
---
>         (V_KEY_ASSIGNMENT_METHOD IN ('EXTRACT','INSERT','OID'))) THEN

Useful Links:

Have you enjoyed? Please leave a comment or give a 👍!

Deixe um comentário

Seu e-mail não será publicado.