Dissecting 191016 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 October 2019 - 191016?

VERSION    PATCH      OWNER                          TYPE                 TOTAL
---------- ---------- ------------------------------ --------------- ----------
11.2.0.4   BP         SYS                            PACKAGE BODY             1
11.2.0.4   PSU        SYS                            PACKAGE BODY             1
12.1.0.2   BP         SYS                            PACKAGE                  2
12.1.0.2   BP         SYS                            PACKAGE BODY             9
12.1.0.2   PSU        DVSYS                          PACKAGE                  1
12.1.0.2   PSU        DVSYS                          PACKAGE BODY             2
12.1.0.2   PSU        LBACSYS                        PACKAGE BODY             1
12.1.0.2   PSU        SYS                            PACKAGE                  1
12.1.0.2   PSU        SYS                            PACKAGE BODY             1
12.2.0.1   RU         SYS                            PACKAGE                  2
12.2.0.1   RU         SYS                            PACKAGE BODY             7
12.2.0.1   RU         SYS                            VIEW                     1
18.0.0.0   18.6RUR    SYS                            PACKAGE                  2
18.0.0.0   18.6RUR    SYS                            PACKAGE BODY             1
18.0.0.0   18.7RUR    SYS                            PACKAGE                  2
18.0.0.0   18.7RUR    SYS                            PACKAGE BODY             1
18.0.0.0   RU         SYS                            PACKAGE                  4
18.0.0.0   RU         SYS                            PACKAGE BODY             5
18.0.0.0   RU         XDB                            PACKAGE                  1
18.0.0.0   RU         XDB                            PACKAGE BODY             1
19.0.0.0   19.3RUR    SYS                            PACKAGE                  2
19.0.0.0   19.3RUR    SYS                            PACKAGE BODY             2
19.0.0.0   19.4RUR    SYS                            PACKAGE                  2
19.0.0.0   19.4RUR    SYS                            PACKAGE BODY             1
19.0.0.0   RU         DVSYS                          PACKAGE                  2
19.0.0.0   RU         DVSYS                          PACKAGE BODY             2
19.0.0.0   RU         MDSYS                          PACKAGE                  7
19.0.0.0   RU         MDSYS                          PACKAGE BODY             7
19.0.0.0   RU         MDSYS                          TYPE BODY                1
19.0.0.0   RU         SYS                            PACKAGE                  6
19.0.0.0   RU         SYS                            PACKAGE BODY             9
19.0.0.0   RU         SYS                            TYPE BODY                1
19.0.0.0   RU         SYS                            VIEW                     1
19.0.0.0   RU         XDB                            PACKAGE                  1
19.0.0.0   RU         XDB                            PACKAGE BODY             1

And created?

VERSION    PATCH      OWNER                          TYPE                 TOTAL
---------- ---------- ------------------------------ --------------- ----------
19.0.0.0   RU         DVSYS                          VIEW                     1

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

So which are exactly the objects modified by 191016?

 VERSION    PATCH           OWNER                          TYPE            NAME                           ACTION
---------- --------------- ------------------------------ --------------- ------------------------------ ------
11.2.0.4   PSU & BP        SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
12.1.0.2   BP              SYS                            PACKAGE         PRVT_COMPRESSION               MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_QOPATCH                   MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_SNAP_INTERNAL             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   BP              SYS                            PACKAGE BODY    DBMS_SYNC_REFRESH              MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_XSTREAM_ADM_INTERNAL      MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    DBMS_XSTREAM_GG_INTERNAL       MOD
12.1.0.2   BP              SYS                            PACKAGE BODY    PRVT_COMPRESSION               MOD
12.1.0.2   PSU             DVSYS                          PACKAGE         DBMS_MACUTL                    MOD
12.1.0.2   PSU             DVSYS                          PACKAGE BODY    DBMS_MACADM                    MOD
12.1.0.2   PSU             DVSYS                          PACKAGE BODY    DBMS_MACUTL                    MOD
12.1.0.2   PSU             LBACSYS                        PACKAGE BODY    OLS_ENFORCEMENT                MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE         DBMS_RCVMAN                    MOD
12.1.0.2   PSU & BP        SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
12.2.0.1   RU              SYS                            PACKAGE         DBMS_RCVMAN                    MOD
12.2.0.1   RU              SYS                            PACKAGE         DBMS_REDEFINITION_INTERNAL     MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_HEAT_MAP_INTERNAL         MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_REDEFINITION              MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_REDEFINITION_INTERNAL     MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_STATS                     MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    DBMS_STATS_ADVISOR             MOD
12.2.0.1   RU              SYS                            PACKAGE BODY    PRVT_ILM                       MOD
12.2.0.1   RU              SYS                            VIEW            DBA_APPLY_ERROR                MOD
18.0.0.0   RU              SYS                            PACKAGE         DBMS_RCVMAN                    MOD
18.0.0.0   RU              SYS                            PACKAGE         DBMS_REDEFINITION_INTERNAL     MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_HEAT_MAP_INTERNAL         MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_REDEFINITION              MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_REDEFINITION_INTERNAL     MOD
18.0.0.0   RU              SYS                            PACKAGE BODY    PRVT_ILM                       MOD
18.0.0.0   RU              XDB                            PACKAGE         DBMS_SODA_ADMIN                MOD
18.0.0.0   RU              XDB                            PACKAGE BODY    DBMS_SODA_ADMIN                MOD
18.0.0.0   RU & 18.7RUR &  SYS                            PACKAGE         DBMS_BACKUP_RESTORE            MOD
           18.6RUR
18.0.0.0   RU & 18.7RUR &  SYS                            PACKAGE         DBMS_REGISTRY                  MOD
           18.6RUR
18.0.0.0   RU & 18.7RUR &  SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
           18.6RUR
19.0.0.0   RU              DVSYS                          VIEW            DBA_DV_COMMON_OPERATION_STATUS NEW
19.0.0.0   19.3RUR         SYS                            PACKAGE BODY    DBMS_DBFS_SFS                  MOD
19.0.0.0   RU              DVSYS                          PACKAGE         DBMS_MACADM                    MOD
19.0.0.0   RU              DVSYS                          PACKAGE         DBMS_MACUTL                    MOD
19.0.0.0   RU              DVSYS                          PACKAGE BODY    DBMS_MACADM                    MOD
19.0.0.0   RU              DVSYS                          PACKAGE BODY    DBMS_MACUTL                    MOD
19.0.0.0   RU              MDSYS                          PACKAGE         RDF_APIS_INTERNAL              MOD
19.0.0.0   RU              MDSYS                          PACKAGE         SDO_SEM_INFERENCE              MOD
19.0.0.0   RU              MDSYS                          PACKAGE         SEM_RDFCTX                     MOD
19.0.0.0   RU              MDSYS                          PACKAGE         SEM_RDFCTX_DR                  MOD
19.0.0.0   RU              MDSYS                          PACKAGE         S_SDO_RDF_INFO                 MOD
19.0.0.0   RU              MDSYS                          PACKAGE         S_SDO_RDF_INTERNAL             MOD
19.0.0.0   RU              MDSYS                          PACKAGE         S_SDO_RDF_QUERY                MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    RDF_APIS_INTERNAL              MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_RDF                        MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_RDF_INTERNAL               MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_SEM_INFERENCE              MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SDO_SEM_INF_INTERNAL           MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    SEM_RDFCTX_DR                  MOD
19.0.0.0   RU              MDSYS                          PACKAGE BODY    S_SDO_RDF_INTERNAL             MOD
19.0.0.0   RU              MDSYS                          TYPE BODY       SEMCONTEXTINDEXMETHODS         MOD
19.0.0.0   RU              SYS                            PACKAGE         DBMS_ASH                       MOD
19.0.0.0   RU              SYS                            PACKAGE         PRVT_ASH_OMX                   MOD
19.0.0.0   RU              SYS                            PACKAGE         SDO_RDF_EXP_IMP                MOD
19.0.0.0   RU              SYS                            PACKAGE         SDO_RDF_SYS                    MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_AQ_INV                    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_INTERNAL       MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_HEAT_MAP_INTERNAL         MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    DBMS_SCHEDULER                 MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    PRVT_ASH_OMX                   MOD
19.0.0.0   RU              SYS                            PACKAGE BODY    PRVT_ILM                       MOD
19.0.0.0   RU              SYS                            TYPE BODY       WRI$_REPT_ASH_OMX              MOD
19.0.0.0   RU              SYS                            VIEW            DBA_AUTO_INDEX_EXECUTIONS      MOD
19.0.0.0   RU              XDB                            PACKAGE         DBMS_SODA_ADMIN                MOD
19.0.0.0   RU              XDB                            PACKAGE BODY    DBMS_SODA_ADMIN                MOD
19.0.0.0   RU & 19.4RUR &  SYS                            PACKAGE         DBMS_BACKUP_RESTORE            MOD
           19.3RUR
19.0.0.0   RU & 19.4RUR &  SYS                            PACKAGE         DBMS_REGISTRY                  MOD
           19.3RUR
19.0.0.0   RU & 19.4RUR &  SYS                            PACKAGE BODY    DBMS_RCVMAN                    MOD
           19.3RUR

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

Changed Objects

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

11.2.0.4

SYS.DBMS_RCVMAN - PACKAGE BODY (PSU):
563c563
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
SYS.DBMS_RCVMAN - PACKAGE BODY (BP):
563c563
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,

12.1.0.2

DVSYS.DBMS_MACUTL - PACKAGE (PSU):
463a464,472
>   /**
>   * Checks whether the given role is enabled in the current session.
>   *
>   * @param p_role Role to check
>   * @return TRUE if the role is enabled in the current session
>   */
>   FUNCTION session_enabled_role(p_role    IN VARCHAR2)
>     RETURN BOOLEAN;
> 
497a507,515
> 
>   /**
>   * Checks whether the given role is enabled in the current session.
>   *
>   * @param p_role Role to check
>   * @return Y if the role is enabled in the current session, N otherwise
>   */
>   FUNCTION session_enabled_role_varchar(p_role    IN VARCHAR2)
>     RETURN VARCHAR2;
DVSYS.DBMS_MACADM - PACKAGE BODY (PSU):
3400c3400,3401
<     IF DVSYS.DBMS_MACUTL.USER_HAS_ROLE_VARCHAR('DV_ACCTMGR', LOGIN_USER) = 'N' THEN
---
>     IF DVSYS.DBMS_MACUTL.USER_HAS_ROLE_VARCHAR('DV_ACCTMGR', LOGIN_USER) = 'N' AND
>        DVSYS.DBMS_MACUTL.SESSION_ENABLED_ROLE_VARCHAR('DV_ACCTMGR') = 'N' THEN
DVSYS.DBMS_MACUTL - PACKAGE BODY (PSU):
603a604,620
>    FUNCTION SESSION_ENABLED_ROLE(P_ROLE     IN VARCHAR2)
>    RETURN BOOLEAN
>    IS EXTERNAL
>    LANGUAGE C
>    NAME "kzvIsRoleEnabled"
>          LIBRARY DVSYS.KZV$UTL_LIBT
>          WITH CONTEXT
>    PARAMETERS
>    (CONTEXT,
>     P_ROLE             STRING,
>     P_ROLE INDICATOR   SB4,
>     P_ROLE LENGTH      SB4,
> 
>     RETURN INDICATOR SB4,
>     RETURN           SB2
>    );
> 
776a794,805
>   FUNCTION SESSION_ENABLED_ROLE_VARCHAR(P_ROLE    IN VARCHAR2)
>   RETURN VARCHAR2 IS
>     IS_ENABLED BOOLEAN ;
>   BEGIN
>     IS_ENABLED := DBMS_MACUTL.SESSION_ENABLED_ROLE(P_ROLE);
> 
>     IF ( IS_ENABLED ) THEN
>         RETURN G_YES;
>     ELSE
>         RETURN G_NO;
>     END IF;
>   END;
LBACSYS.OLS_ENFORCEMENT - PACKAGE BODY (PSU):
7a8,24
> FUNCTION SESSION_ENABLED_ROLE(P_ROLE     IN VARCHAR2)
>    RETURN BOOLEAN
>    IS EXTERNAL
>    LANGUAGE C
>    NAME "kzvIsRoleEnabled"
>    LIBRARY LBACSYS.LBAC$EVENT_LIBT
>          WITH CONTEXT
>    PARAMETERS
>    (CONTEXT,
>     P_ROLE             STRING,
>     P_ROLE INDICATOR   SB4,
>     P_ROLE LENGTH      SB4,
> 
>     RETURN INDICATOR SB4,
>     RETURN           SB2
>    );
> 
14a32,39
> 
>   
>   
>   IF (LBACDBA_ROLE_COUNT + DVOWNER_ROLE_COUNT) < 1 THEN
>     IF (SESSION_ENABLED_ROLE('DV_OWNER')) THEN
>       DVOWNER_ROLE_COUNT := 1;
>     END IF;
>   END IF;
SYS.DBMS_RCVMAN - PACKAGE (BP):
1232c1232,1234
< -- 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.
1236c1238
< --     tag of the datafile copies to be translated
---
> --     tag of the datafile copies/backup sets to be translated
1237a1240,1241
> --   use_like
> --     input tag parameter to be used similar to LIKE semantics in SQL
1239c1243
< PROCEDURE setTag(tag IN varchar2 DEFAULT NULL);
---
> PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
SYS.DBMS_RCVMAN - PACKAGE (PSU):
1224c1224,1226
< -- 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.
1228c1230
< --     tag of the datafile copies to be translated
---
> --     tag of the datafile copies/backup sets to be translated
1229a1232,1233
> --   use_like
> --     input tag parameter to be used similar to LIKE semantics in SQL
1231c1235
< PROCEDURE setTag(tag IN varchar2 DEFAULT NULL);
---
> PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
SYS.PRVT_COMPRESSION - PACKAGE (BP):
39a40,41
> COMP_MIN_SAMPLE_BLOCKS        CONSTANT NUMBER := 1000;
> 
SYS.DBMS_QOPATCH - PACKAGE BODY (BP):
23a24,28
> V_CODE     NUMBER;
> V_ERRM     VARCHAR2(128);
> 
> 
> 
105a111,127
> --+
> PROCEDURE LOG_STATUS(MSG VARCHAR2) IS 
> BEGIN
>         IF DO_DEBUG THEN
>                 DBMS_OUTPUT.PUT_LINE(MSG);
>         END IF;
> 	DBMS_SYSTEM.KSDWRT(1,MSG);
> 	
> END;
> 
> --+
> 
> 
> 
> 
> 
> 
304,306d325
<     IF DO_DEBUG THEN
<           DBMS_OUTPUT.PUT_LINE ('QPI: GOT lock at :' || SYSTIMESTAMP);
<     END IF;
309a329
>        LOG_STATUS('QPI: Obtaining lock FAILED, qp_result=' || QP_RESULT || ' at : ' || SYSTIMESTAMP);
310a331,332
>     ELSIF QP_RESULT = 0 OR QP_RESULT = 4 THEN
>         LOG_STATUS('QPI: Obtaining lock SUCCESSFUL, qp_result=' || QP_RESULT || ' at : ' || SYSTIMESTAMP);
333,334c355,359
<     IF DO_DEBUG THEN
<           DBMS_OUTPUT.PUT_LINE ('QPI: Releasing the lock at :' || SYSTIMESTAMP);
---
> 
>     IF QP_RESULT = 0 THEN
>         LOG_STATUS('QPI: Releasing lock SUCCESSFUL, qp_result=' || QP_RESULT || ' at : ' || SYSTIMESTAMP);
>     ELSE
>         LOG_STATUS('QPI: Releasing lock FAILED, qp_result=' || QP_RESULT || ' at : ' || SYSTIMESTAMP);
431,432c456,457
<       V_ERRM := SUBSTR(SQLERRM, 1, 64);
<       DBMS_OUTPUT.PUT_LINE('Error code ' || V_CODE || ': ' || V_ERRM);
---
>       V_ERRM := SUBSTR(SQLERRM, 1, 128);
>       LOG_STATUS('QPI: in config_oinv_jobs, Error code ' || V_CODE || ': ' || V_ERRM);
731a757
>  PRAGMA     AUTONOMOUS_TRANSACTION;
736,738c762
<   IF DO_DEBUG THEN
<     DBMS_OUTPUT.PUT_LINE('QPI: In REFRESH_OPATCH_DATA');
<   END IF;
---
>   LOG_STATUS('QPI: In REFRESH_OPATCH_DATA');
744,746c768
<   IF DO_DEBUG THEN
<     DBMS_OUTPUT.PUT_LINE('QPI: Latest xml inventory is loaded into table');
<   END IF;
---
>   LOG_STATUS('QPI: Latest xml inventory is loaded into table');
748a771,774
>    LOG_STATUS('QPI: Caught error while querying opatch_xml_inv');
>    V_CODE := SQLCODE;
>    V_ERRM := SUBSTR(SQLERRM, 1, 128);
>    LOG_STATUS('QPI: in REFRESH_OPATCH_DATA, ERROR code ' || V_CODE || ' : ' || V_ERRM);
809a836,842
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in get_opatch_install_info, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
858a892,898
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in get_opatch_install_info, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
915a956,962
>      WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in IS_PATCH_INSTALLED, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
974a1022,1028
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in GET_OPATCH_DATA, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1040a1095,1101
>     WHEN OTHERS THEN
>       V_CODE := SQLCODE;
>       V_ERRM := SUBSTR(SQLERRM, 1, 128);
>       LOG_STATUS('QPI: in GET_OPATCH_BUGS, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>       QP_RESULT:= RELEASE_QOPATCH_LOCK();
>       RAISE;
> 
1061,1063c1122,1126
<      IF DO_DEBUG THEN
<        DBMS_OUTPUT.PUT_LINE('QPI: In GET_OPATCH_FILES');
<      END IF;
---
>      LOG_STATUS('QPI: In GET_OPATCH_FILES');
> 
>      QP_RESULT := GET_QOPATCH_LOCK();
> 
>      LOG_STATUS('QPI: Got lock get_opatch_files');
1076a1140,1143
> 
>      LOG_STATUS('QPI: Release lock get_opatch_files');
>      QP_RESULT:= RELEASE_QOPATCH_LOCK();
> 
1077a1145,1157
> 
>      EXCEPTION
>        WHEN UNABLE_TO_LOCK THEN
>          RAISE_APPLICATION_ERROR(-20016, 
>                  'Unable to get the lock : get_opatch_files : ' || QP_RESULT);
> 
>      WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in GET_OPATCH_FILES, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1127a1208,1214
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in GET_OPATCH_COUNT, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1180a1268,1274
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in GET_OPATCH_PREQS, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1229a1324,1335
>     EXCEPTION
>       WHEN UNABLE_TO_LOCK THEN
>         RAISE_APPLICATION_ERROR(-20016, 
>                  'Unable to get the lock : get_opatch_install_info : ' || QP_RESULT);
> 
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in GET_OPATCH_OLAYS, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1284a1391,1397
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in PATCH_CONFLICT_DETECTION, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
1564,1565c1677,1678
<       V_ERRM := SUBSTR(SQLERRM, 1, 64);
<       DBMS_OUTPUT.PUT_LINE('Error code ' || V_CODE || ': ' || V_ERRM);
---
>       V_ERRM := SUBSTR(SQLERRM, 1, 128);
>       LOG_STATUS('QPI: in add_oinv_job, Error code ' || V_CODE || ': ' || V_ERRM);
1926a2040,2043
>     WHEN UNABLE_TO_LOCK THEN
>       RAISE_APPLICATION_ERROR(-20016, 
>                  'Unable to get the lock : get_pending_activity : ' || QP_RESULT);
> 
1932,1933c2049,2052
< 
<    WHEN UNABLE_TO_LOCK THEN
---
>     WHEN OTHERS THEN
>       V_CODE := SQLCODE;
>       V_ERRM := SUBSTR(SQLERRM, 1, 128);
>       LOG_STATUS('QPI: in get_pending_activity, ERROR code ' || V_CODE || ' : ' || V_ERRM);
1935,1937c2054
<     IF DO_DEBUG THEN
<         DBMS_OUTPUT.PUT_LINE('QPI: org_node and inst resore 2:' || ORG_NODE || ':' || ORG_INST);
<     END IF; 
---
>         LOG_STATUS('QPI: org_node and inst resore 2:' || ORG_NODE || ':' || ORG_INST);
1939,1945d2055
< 
<     IF DO_DEBUG THEN
<        DBMS_OUTPUT.PUT_LINE('QPI: Unable to get the lock : get_pending_activity');
<     END IF;
<    RAISE_APPLICATION_ERROR(-20016, 'Unable to get the lock : get_pending_activity :' || QP_RESULT );
< 
<     WHEN OTHERS THEN
1949c2059
<   
---
> 
2016a2127,2133
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in get_opatch_lsinventory, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
2359,2365c2476,2485
<        WHEN  NO_DATA_FOUND THEN
<              RAISE_APPLICATION_ERROR(-20005, 'Job ' || JOBNAME || ' cleanup failed');
<        WHEN UNABLE_TO_LOCK THEN
<              RAISE_APPLICATION_ERROR(-20016, 
<                  'Unable to get the lock : clean_metadata : ' || QP_RESULT);
<        WHEN OTHERS THEN
<             RAISE;
---
>       WHEN UNABLE_TO_LOCK THEN
>         RAISE_APPLICATION_ERROR(-20016, 
>               'Unable to get the lock : clean_metadata : ' || QP_RESULT);
>       WHEN OTHERS THEN
>         V_CODE := SQLCODE;
>         V_ERRM := SUBSTR(SQLERRM, 1, 128);
>         LOG_STATUS('QPI: in get_opatch_lsinventory, ERROR code ' || V_CODE || ' : ' || V_ERRM);
>         QP_RESULT:= RELEASE_QOPATCH_LOCK();
>         RAISE;
> 
SYS.DBMS_RCVMAN - PACKAGE BODY (BP):
158a159
> TAG_LIKE        NUMBER := 0;
587a589,591
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
610c614
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
865a870,872
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
956a964
>        AND RESTORETAG IS NULL
1027a1036,1038
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1097a1109,1111
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1228a1243,1245
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1334a1352,1354
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1644a1665,1667
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1766a1790,1792
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1861a1888,1890
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1987a2017,2019
>            AND (RESTORETAG IS NULL OR
>                 ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                  (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2042a2075,2077
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2177a2213,2215
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2691a2730,2732
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2778a2820,2822
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2872a2917,2919
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2953a3001,3003
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3078a3129
>       AND RESTORETAG IS NULL
3294a3346,3348
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3508a3563,3565
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3618a3676,3678
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3665a3726,3728
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3687a3751,3753
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3713a3780,3782
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3748a3818,3820
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3806a3879,3881
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3852a3928,3930
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3900a3979,3981
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3937a4019,4021
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4027,4030c4111,4120
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4113,4116c4203,4212
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4199,4202c4295,4304
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4288,4291c4390,4399
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4378,4381c4486,4495
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4465,4468c4579,4588
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4554,4557c4674,4683
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
5288,5291c5414,5423
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
6801a6934,6936
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6816a6952,6954
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6950a7089,7091
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6997a7139,7141
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7037a7182,7184
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7121a7269,7271
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7201a7352,7354
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7269a7423,7425
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7344a7501,7503
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7375a7535,7537
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7446a7609,7611
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7523a7689,7691
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7583a7752,7754
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7636a7808,7810
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7722a7897,7899
>              AND (RESTORETAG IS NULL OR
>                   ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                    (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7796a7974,7976
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7858a8039,8041
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7911a8095,8097
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7998a8185,8187
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8015a8205,8207
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8037c8229,8232
<           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
8066a8262,8264
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XDF.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XDF.TAG = RESTORETAG)))
8091a8290,8292
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8133a8335,8337
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
8200a8405,8407
>                  AND (RESTORETAG IS NULL OR
>                       ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                        (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8230a8438,8440
>                   AND (RESTORETAG IS NULL OR
>                        ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                         (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8298a8509,8511
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8402a8616,8618
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8445a8662,8664
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8690a8910,8912
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8916a9139,9141
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9035a9261,9263
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9254c9482,9483
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
9368a9598
> 
9464c9694,9695
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
10556c10787
<       IF (TAG IS NOT NULL AND NOT TAGMATCHREQUIRED) THEN
---
>       IF (TAG IS NOT NULL AND TAGMATCHREQUIRED) THEN
10561c10792,10793
<          IF (TAG = LOCAL.TAG) THEN
---
>          IF ((TAG_LIKE = 1 AND LOCAL.TAG LIKE TAG) OR 
>              (TAG_LIKE <> 1 AND LOCAL.TAG = TAG)) THEN
10577c10809,10810
<             DEB(DEB_IN, 'tag does not match, continuing search');
---
>             DEB(DEB_IN, 'tag does not match, continuing search:' ||
>                 LOCAL.TAG);
11268,11269c11501,11505
<           (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>'));
12246c12482,12485
<    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
13210a13450,13453
> 
> 
> 
> 
13450c13693,13694
<       IF (RMANCMD != OBSOLETECMD_T) THEN
---
>       IF (RMANCMD != OBSOLETECMD_T OR
>           (RESTORETAG IS NOT NULL AND RMANCMD = OBSOLETECMD_T)) THEN
13598d13841
<    
13600,13601c13843
<        ACTION.TYPE_CON  = BACKUPSET_CON_T AND
<        RMANCMD         != OBSOLETECMD_T ) THEN
---
>        ACTION.TYPE_CON  = BACKUPSET_CON_T) THEN
13610c13852,13853
<       IF (VALIDATIONREC.TAG = RESTORETAG OR
---
>       IF (((TAG_LIKE = 1 AND VALIDATIONREC.TAG LIKE RESTORETAG) OR
>            (TAG_LIKE <> 1 AND VALIDATIONREC.TAG = RESTORETAG)) OR
13670,13675d13912
<    
<    IF (RMANCMD = OBSOLETECMD_T AND NOT ISVALIDACTION(ACTION)) THEN
<       DEB(DEB_EXIT, 'with action_SKIP');
<       RETURN ACTION_SKIP;
<    END IF;
< 
17066c17303,17306
<    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
17360a17601,17603
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17638a17882,17884
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17729a17976
>        AND RESTORETAG IS NULL
17801a18049,18051
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17871a18122,18124
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18440c18693,18694
<             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
---
>             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
>       AND RESTORETAG IS NULL;
18482c18736,18739
<             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)));
18529a18787
>                       AND RESTORETAG IS NULL
18580a18839,18841
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR
>                             (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
18646a18908
>                       AND RESTORETAG IS NULL
18681a18944,18946
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18710a18976,18978
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18768c19036
< 
---
>                     AND RESTORETAG IS NULL
18799a19068,19070
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18824a19096,19098
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18899a19174
>                       AND RESTORETAG IS NULL
18938a19214,19216
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18970a19249,19251
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19404c19685,19686
<    TAG IN VARCHAR2 DEFAULT NULL)
---
>    TAG IN VARCHAR2 DEFAULT NULL,
>    USE_LIKE IN NUMBER DEFAULT 0)
19406a19689,19694
>    
>    
>    IF (NVL(TAG, ' ') <> NVL(RESTORETAG, ' ') AND RCVRECCURSOR1_C%ISOPEN) THEN
>       DEB(DEB_PRINT, 'closing cursor rcRecCursor_c');
>       CLOSE RCVRECCURSOR1_C;
>    END IF;
19407a19696,19697
>    TAG_LIKE := USE_LIKE;
>    DEB(DEB_PRINT, 'restoreTag='|| RESTORETAG ||  ',tag_like='|| TAG_LIKE);
24929a25220,25222
> 
>   VALIDATIONREC        VALIDBACKUPSETREC_T;
>   BS_RCVREC            RCVREC_T;
25585a25879,25880
>   <<NEXTROW>>
> 
25812a26108,26143
>     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;
> 
25907c26238,26239
<                 ELSIF (LISTBACKUPINMKS(LBSTATE.LBDFRECTABUS, LBREC,
---
>                 ELSIF (LBREC.FILE_TYPE <> SPFILE_TXT AND
>                        LISTBACKUPINMKS(LBSTATE.LBDFRECTABUS, LBREC,
27663c27995
<             DEB(DEB_IN, 'tag does not match');
---
>             DEB(DEB_IN, 'tag does not match for controlfile proxy copy');
27988c28320
<             DEB(DEB_EXIT, 'tag does not match');
---
>             DEB(DEB_EXIT, 'tag does not match for proxy copy:'||BRLREC.TAG_CON);
28227,28239c28559,28565
<       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);
28256,28265d28581
<          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;
28531a28848
>    DEB(DEB_PRINT, 'getRA_likePattern='|| PATTERN);
SYS.DBMS_RCVMAN - PACKAGE BODY (PSU):
147a148
> TAG_LIKE        NUMBER := 0;
568a570,572
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
591c595
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
834a839,841
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
922a930
>        AND RESTORETAG IS NULL
990a999,1001
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1057a1069,1071
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1187a1202,1204
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1292a1310,1312
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1600a1621,1623
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1721a1745,1747
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1816a1843,1845
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1940a1970,1972
>            AND (RESTORETAG IS NULL OR
>                 ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                  (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1994a2027,2029
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2128a2164,2166
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2627a2666,2668
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2713a2755,2757
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2807a2852,2854
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2888a2936,2938
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3013a3064
>       AND RESTORETAG IS NULL
3229a3281,3283
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3443a3498,3500
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3553a3611,3613
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3600a3661,3663
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3622a3686,3688
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3648a3715,3717
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3683a3753,3755
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3737a3810,3812
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3783a3859,3861
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3831a3910,3912
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3868a3950,3952
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3958,3961c4042,4051
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4044,4047c4134,4143
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4130,4133c4226,4235
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4219,4222c4321,4330
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4309,4312c4417,4426
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4396,4399c4510,4519
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
4485,4488c4605,4614
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
5210,5213c5336,5345
<           DECODE(BITAND(FE.FESTA, (4096+128 +4 )),
<                         4096+4, 1,
<                         128+4,  1,
<                         0)
---
>           CASE WHEN FE.CON_ID > 1 AND
>              DECODE(BITAND(FE.FESTA, (4096+128)), 0, 0,
>                     DECODE(FE.FECPS, FE1.PDBSTOPSCN, 1, 0)) > 0 THEN
>              0
>           ELSE
>              DECODE(BITAND(FE.FESTA, (4096+128+4)),
>                     4096+4, 1,
>                     128+4,  1,
>                     0)
>           END
6723a6856,6858
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6738a6874,6876
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6872a7011,7013
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6919a7061,7063
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
6959a7104,7106
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7043a7191,7193
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7123a7274,7276
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7191a7345,7347
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7266a7423,7425
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7297a7457,7459
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7368a7531,7533
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7445a7611,7613
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7505a7674,7676
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7558a7730,7732
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7644a7819,7821
>              AND (RESTORETAG IS NULL OR
>                   ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                    (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7718a7896,7898
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7780a7961,7963
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7833a8017,8019
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7920a8107,8109
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7937a8127,8129
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7959c8151,8154
<           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
7988a8184,8186
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XDF.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XDF.TAG = RESTORETAG)))
8013a8212,8214
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8055a8257,8259
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
8123a8328,8330
>                  AND (RESTORETAG IS NULL OR
>                       ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                        (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8153a8361,8363
>                   AND (RESTORETAG IS NULL OR
>                        ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                         (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8221a8432,8434
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8325a8539,8541
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8368a8585,8587
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8613a8833,8835
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8839a9062,9064
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8958a9184,9186
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9177c9405,9406
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
9291a9521
> 
9387c9617,9618
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
10479c10710
<       IF (TAG IS NOT NULL AND NOT TAGMATCHREQUIRED) THEN
---
>       IF (TAG IS NOT NULL AND TAGMATCHREQUIRED) THEN
10484c10715,10716
<          IF (TAG = LOCAL.TAG) THEN
---
>          IF ((TAG_LIKE = 1 AND LOCAL.TAG LIKE TAG) OR 
>              (TAG_LIKE <> 1 AND LOCAL.TAG = TAG)) THEN
10500c10732,10733
<             DEB(DEB_IN, 'tag does not match, continuing search');
---
>             DEB(DEB_IN, 'tag does not match, continuing search:' ||
>                 LOCAL.TAG);
11191,11192c11424,11428
<           (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>'));
12169c12405,12408
<    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
13133a13373,13376
> 
> 
> 
> 
13369c13612,13613
<       IF (RMANCMD != OBSOLETECMD_T) THEN
---
>       IF (RMANCMD != OBSOLETECMD_T OR
>           (RESTORETAG IS NOT NULL AND RMANCMD = OBSOLETECMD_T)) THEN
13517d13760
<    
13519,13520c13762
<        ACTION.TYPE_CON  = BACKUPSET_CON_T AND
<        RMANCMD         != OBSOLETECMD_T ) THEN
---
>        ACTION.TYPE_CON  = BACKUPSET_CON_T) THEN
13529c13771,13772
<       IF (VALIDATIONREC.TAG = RESTORETAG OR
---
>       IF (((TAG_LIKE = 1 AND VALIDATIONREC.TAG LIKE RESTORETAG) OR
>            (TAG_LIKE <> 1 AND VALIDATIONREC.TAG = RESTORETAG)) OR
13589,13594d13831
<    
<    IF (RMANCMD = OBSOLETECMD_T AND NOT ISVALIDACTION(ACTION)) THEN
<       DEB(DEB_EXIT, 'with action_SKIP');
<       RETURN ACTION_SKIP;
<    END IF;
< 
16979c17216,17219
<    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
17267a17508,17510
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17533a17777,17779
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17621a17868
>        AND RESTORETAG IS NULL
17690a17938,17940
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
17757a18008,18010
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18318c18571,18572
<             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
---
>             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
>       AND RESTORETAG IS NULL;
18360c18614,18617
<             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)));
18407a18665
>                       AND RESTORETAG IS NULL
18458a18717,18719
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR
>                             (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
18524a18786
>                       AND RESTORETAG IS NULL
18559a18822,18824
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18588a18854,18856
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18646c18914
< 
---
>                     AND RESTORETAG IS NULL
18677a18946,18948
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18702a18974,18976
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18777a19052
>                       AND RESTORETAG IS NULL
18816a19092,19094
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18848a19127,19129
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19282c19563,19564
<    TAG IN VARCHAR2 DEFAULT NULL)
---
>    TAG IN VARCHAR2 DEFAULT NULL,
>    USE_LIKE IN NUMBER DEFAULT 0)
19284a19567,19572
>    
>    
>    IF (NVL(TAG, ' ') <> NVL(RESTORETAG, ' ') AND RCVRECCURSOR1_C%ISOPEN) THEN
>       DEB(DEB_PRINT, 'closing cursor rcRecCursor_c');
>       CLOSE RCVRECCURSOR1_C;
>    END IF;
19285a19574,19575
>    TAG_LIKE := USE_LIKE;
>    DEB(DEB_PRINT, 'restoreTag='|| RESTORETAG ||  ',tag_like='|| TAG_LIKE);
24722a25013,25015
> 
>   VALIDATIONREC        VALIDBACKUPSETREC_T;
>   BS_RCVREC            RCVREC_T;
25287a25581,25582
>   <<NEXTROW>>
> 
25514a25810,25845
>     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;
> 
27355c27686
<             DEB(DEB_IN, 'tag does not match');
---
>             DEB(DEB_IN, 'tag does not match for controlfile proxy copy');
27680c28011
<             DEB(DEB_EXIT, 'tag does not match');
---
>             DEB(DEB_EXIT, 'tag does not match for proxy copy:'||BRLREC.TAG_CON);
27919,27931c28250,28256
<       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);
27948,27957d28272
<          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;
28223a28539
>    DEB(DEB_PRINT, 'getRA_likePattern='|| PATTERN);
SYS.DBMS_SNAP_INTERNAL - PACKAGE BODY (BP):
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); 
580,581c581,583
<       SECURE_OWNER := TABOWNER;
<       SECURE_NAME := TABNAME;
---
>       
>       SECURE_OWNER := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABOWNER);
>       SECURE_NAME  := DBMS_SNAP_INTERNAL.CANONICALIZE_IDENTIFIER(TABNAME); 
SYS.DBMS_SQLPATCH - PACKAGE BODY (BP):
405d404
<       
419c418
<           INSTALLED_BUNDLE := 0;
---
>           INSTALLED_BUNDLE := REGISTRY_ID;
SYS.DBMS_STATS - PACKAGE BODY (BP):
11466c11466,11467
<               ALLTXT := ALLTXT || ' add ch1 varchar2(1000)';
---
>               
>               ALLTXT := ALLTXT || ' add ch1 varchar2(1000 byte)';
11546,11550c11547,11559
<               ALLTXT := 'alter table ' ||  STATTABQ ||
<                         ' modify (r1 raw(1000), r2 raw(1000),' ||
<                         '   statid varchar2(128), c1 varchar2(128), c2 varchar2(128), ' ||
<                         '   c3 varchar2(128), c4 varchar2(128), c5 varchar2(128)) ' ||
<                         ' add (c6 varchar2(128), r3 raw(1000), n13 number, t1 timestamp with time zone)';
---
>               
>               ALLTXT := 'alter table ' ||  STATTABQ 
>                      || ' modify (r1 raw(1000), r2 raw(1000),'
>                      || ' statid varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' c1 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' c2 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' c3 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' c4 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' c5 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte))'
>                      || ' add (c6 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),'
>                      || ' r3 raw(1000),'
>                      || ' n13 number,'
>                      || ' t1 timestamp with time zone)';
17840a17850
>     
17842,17843c17852,17853
<         ' statid varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' type char(1),' ||
---
>         ' statid varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' type char(1 byte),' ||
17846,17851c17856,17861
<         ' c1 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' c2 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' c3 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' c4 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' c5 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
<         ' c6 varchar2(' || DSC_ST_TAB_M_IDEN || '),' ||
---
>         ' c1 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' c2 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' c3 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' c4 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' c5 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
>         ' c6 varchar2(' || DSC_ST_TAB_M_IDEN || ' byte),' ||
17870c17880
<         ' ch1 varchar2(1000),' ||     
---
>         ' ch1 varchar2(1000 byte),' ||     
21679c21689,21690
<         IF (NDV <= MNB) THEN
---
>         
>         IF (MNB = 1 OR NDV <= MNB) THEN
SYS.DBMS_SYNC_REFRESH - PACKAGE BODY (BP):
591,592c591,593
< 
<     MV_NAME VARCHAR2(62) := NULL;
---
>     
>     
>     MV_NAME VARCHAR2(300) := NULL;
595c596
<       MV_NAME := REC.SOWNER || '.' || REC.VNAME;
---
>       MV_NAME := '"' || REC.SOWNER || '"."' || REC.VNAME || '"';
SYS.DBMS_XSTREAM_ADM_INTERNAL - PACKAGE BODY (BP):
411c411
<         TOTAL_SIZE := 24;
---
>         TOTAL_SIZE := 25;
415c415
<         TOTAL_SIZE := 25;
---
>         TOTAL_SIZE := 26;
419c419
<         TOTAL_SIZE := 24;
---
>         TOTAL_SIZE := 25;
423c423
<         TOTAL_SIZE := 25;
---
>         TOTAL_SIZE := 26;
539a540,551
> 
>         IF IS_GRANT THEN
>           SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>             'grant execute on system.logmnr$gsba_gg_tabf_public to ' ||
>              SAFE_GRANTEE);
>         ELSE
>           SCRIPT(OLDSIZE + INCREMENT) := CONSTRUCT_SQL_T(
>             'revoke execute on system.logmnr$gsba_gg_tabf_public from ' ||
>             SAFE_GRANTEE);
>         END IF;
>         INCREMENT := INCREMENT + 1;
> 
SYS.DBMS_XSTREAM_GG_INTERNAL - PACKAGE BODY (BP):
73a74
>       PRBA NUMBER := RBA;
83c84
<           SEQ# = SEQNO AND RBA = RBA AND INDEX# = INDEX_NUM;
---
>           SEQ# = SEQNO AND RBA = PRBA AND INDEX# = INDEX_NUM;
87c88
<           SEQ# = SEQNO AND RBA = RBA AND INDEX# = INDEX_NUM;
---
>           SEQ# = SEQNO AND RBA = PRBA AND INDEX# = INDEX_NUM;

12.2.0.1

SYS.DBMS_RCVMAN - PACKAGE (RU):
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_REDEFINITION_INTERNAL - PACKAGE (RU):
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_HEAT_MAP_INTERNAL - PACKAGE BODY (RU):
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_RCVMAN - PACKAGE BODY (RU):
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_REDEFINITION - PACKAGE BODY (RU):
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_INTERNAL - PACKAGE BODY (RU):
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_STATS - PACKAGE BODY (RU):
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 (RU):
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.PRVT_ILM - PACKAGE BODY (RU):
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.DBA_APPLY_ERROR - VIEW (RU):
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'

18.0.0.0

SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.07.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.08.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.07.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.07.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.07.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('18.07.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.08.00.00', 1, fsn - 1));
31c31
<                to_number(substr('18.07.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.08.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.07.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.08.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.07.00.00',  psn + 1));
---
>                              to_number(substr('18.08.00.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.6RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.06.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.06.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.06.01.00', '.');
<   msn  CONSTANT NUMBER := instr('18.06.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.06.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('18.06.02.00', '.');
>   msn  CONSTANT NUMBER := instr('18.06.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('18.06.02.00', '.', msn + 1);
29c29
<                            to_number(substr('18.06.01.00', 1, fsn - 1));
---
>                            to_number(substr('18.06.02.00', 1, fsn - 1));
31c31
<                to_number(substr('18.06.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.06.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.06.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.06.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.06.01.00',  psn + 1));
---
>                              to_number(substr('18.06.02.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (18.7RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '18.07.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '18.07.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('18.07.00.00', '.');
<   msn  CONSTANT NUMBER := instr('18.07.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('18.07.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('18.07.00.00', 1, fsn - 1));
---
>                            to_number(substr('18.07.01.00', 1, fsn - 1));
31c31
<                to_number(substr('18.07.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('18.07.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('18.07.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('18.07.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('18.07.00.00',  psn + 1));
---
>                              to_number(substr('18.07.01.00',  psn + 1));
SYS.DBMS_RCVMAN - PACKAGE (RU):
1262c1262,1264
< -- 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.
1266c1268
< --     tag of the datafile copies to be translated
---
> --     tag of the datafile copies/backup sets to be translated
1267a1270,1271
> --   use_like
> --     input tag parameter to be used similar to LIKE semantics in SQL
1269c1273
< PROCEDURE setTag(tag IN varchar2 DEFAULT NULL);
---
> PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE (RU):
540a541,572
>   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_REGISTRY - PACKAGE (18.6RUR):
13c13
<                                '18.6.1.0.0';
---
>                                '18.6.2.0.0';
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '18.7.0.0.0';
---
>                                '18.8.0.0.0';
SYS.DBMS_REGISTRY - PACKAGE (18.7RUR):
13c13
<                                '18.7.0.0.0';
---
>                                '18.7.1.0.0';
SYS.DBMS_HEAT_MAP_INTERNAL - PACKAGE BODY (RU):
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_RCVMAN - PACKAGE BODY (18.6RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.06.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.06.02.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.07.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.08.00.00'; 
211a212
> TAG_LIKE        NUMBER := 0;
665a667,669
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
688c692
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
947a952,954
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1056a1064
>        AND RESTORETAG IS NULL
1128a1137,1139
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1199a1211,1213
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1333a1348,1350
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1441a1459,1461
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1759a1780,1782
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1882a1906,1908
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
1979a2006,2008
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2107a2137,2139
>            AND (RESTORETAG IS NULL OR
>                 ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                  (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2163a2196,2198
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2300a2336,2338
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2825a2864,2866
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
2914a2956,2958
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3010a3055,3057
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3093a3141,3143
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3220a3271
>       AND RESTORETAG IS NULL
3441a3493,3495
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3659a3714,3716
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3771a3829,3831
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3818a3879,3881
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3840a3904,3906
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3866a3933,3935
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3901a3971,3973
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
3961a4034,4036
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4009a4085,4087
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4059a4138,4140
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
4098a4180,4182
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7274a7359,7361
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7289a7377,7379
>     AND (RESTORETAG IS NULL OR
>          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7423a7514,7516
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7470a7564,7566
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7510a7607,7609
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7594a7694,7696
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7674a7777,7779
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7742a7848,7850
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7817a7926,7928
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7848a7960,7962
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7919a8034,8036
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
7996a8114,8116
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8056a8177,8179
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8109a8233,8235
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8195a8322,8324
>              AND (RESTORETAG IS NULL OR
>                   ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                    (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8269a8399,8401
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8331a8464,8466
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8384a8520,8522
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8476a8615,8617
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8493a8635,8637
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8516c8660,8663
<           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
8546a8694,8696
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XDF.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XDF.TAG = RESTORETAG)))
8572a8723,8725
>             AND (RESTORETAG IS NULL OR
>                  ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                   (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8615a8769,8771
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
8684a8841,8843
>                  AND (RESTORETAG IS NULL OR
>                       ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                        (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8714a8874,8876
>                   AND (RESTORETAG IS NULL OR
>                        ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                         (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8783a8946,8948
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8900a9066,9068
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
8943a9112,9114
>      AND (RESTORETAG IS NULL OR
>           ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>            (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9193a9365,9367
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9437a9612,9614
>               AND (RESTORETAG IS NULL OR
>                    ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                     (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9563a9741,9743
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
9786c9966,9967
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
9902a10084
> 
10000c10182,10183
<            C1REC.TAG_CON = RESTORETAG OR
---
>            ((TAG_LIKE = 1 AND C1REC.TAG_CON LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND C1REC.TAG_CON = RESTORETAG)) OR
11137c11320
<       IF (TAG IS NOT NULL AND NOT TAGMATCHREQUIRED) THEN
---
>       IF (TAG IS NOT NULL AND TAGMATCHREQUIRED) THEN
11142c11325,11326
<          IF (TAG = LOCAL.TAG) THEN
---
>          IF ((TAG_LIKE = 1 AND LOCAL.TAG LIKE TAG) OR 
>              (TAG_LIKE <> 1 AND LOCAL.TAG = TAG)) THEN
11158c11342,11343
<             DEB(DEB_IN, 'tag does not match, continuing search');
---
>             DEB(DEB_IN, 'tag does not match, continuing search:' ||
>                 LOCAL.TAG);
11863,11864c12048,12052
<           (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>'));
12854c13042,13045
<    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
13822a14014,14017
> 
> 
> 
> 
14061,14062c14256,14257
< 
<       IF (RMANCMD != OBSOLETECMD_T) THEN
---
>       IF (RMANCMD != OBSOLETECMD_T OR
>           (RESTORETAG IS NOT NULL AND RMANCMD = OBSOLETECMD_T)) THEN
14210d14404
<    
14212,14213c14406
<        ACTION.TYPE_CON  = BACKUPSET_CON_T AND
<        RMANCMD         != OBSOLETECMD_T ) THEN
---
>        ACTION.TYPE_CON  = BACKUPSET_CON_T) THEN
14222c14415,14416
<       IF (VALIDATIONREC.TAG = RESTORETAG OR
---
>       IF (((TAG_LIKE = 1 AND VALIDATIONREC.TAG LIKE RESTORETAG) OR
>            (TAG_LIKE <> 1 AND VALIDATIONREC.TAG = RESTORETAG)) OR
14282,14287d14475
<    
<    IF (RMANCMD = OBSOLETECMD_T AND NOT ISVALIDACTION(ACTION)) THEN
<       DEB(DEB_EXIT, 'with action_SKIP');
<       RETURN ACTION_SKIP;
<    END IF;
< 
17699c17887,17890
<    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
17995a18187,18189
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18277a18472,18474
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18369a18567
>        AND RESTORETAG IS NULL
18442a18641,18643
>        AND (RESTORETAG IS NULL OR
>             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
18513a18715,18717
>       AND (RESTORETAG IS NULL OR
>            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19082c19286,19287
<             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#));
---
>             AL.FIRST_CHANGE# <  D2.NEXT_RESETLOGS_CHANGE#))
>       AND RESTORETAG IS NULL;
19124c19329,19332
<             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)));
19171a19380
>                       AND RESTORETAG IS NULL
19222a19432,19434
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND XAL.TAG LIKE RESTORETAG) OR
>                             (TAG_LIKE <> 1 AND XAL.TAG = RESTORETAG)))
19288a19501
>                       AND RESTORETAG IS NULL
19323a19537,19539
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19352a19569,19571
>                        AND (RESTORETAG IS NULL OR
>                             ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                              (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19410c19629
< 
---
>                     AND RESTORETAG IS NULL
19441a19661,19663
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19466a19689,19691
>                     AND (RESTORETAG IS NULL OR
>                          ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                           (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19541a19767
>                       AND RESTORETAG IS NULL
19580a19807,19809
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
19612a19842,19844
>                       AND (RESTORETAG IS NULL OR
>                            ((TAG_LIKE = 1 AND TAG LIKE RESTORETAG) OR 
>                             (TAG_LIKE <> 1 AND TAG = RESTORETAG)))
20094c20326,20327
<    TAG IN VARCHAR2 DEFAULT NULL)
---
>    TAG IN VARCHAR2 DEFAULT NULL,
>    USE_LIKE IN NUMBER DEFAULT 0)
20096a20330,20335
>    
>    
>    IF (NVL(TAG, ' ') <> NVL(RESTORETAG, ' ') AND RCVRECCURSOR1_C%ISOPEN) THEN
>       DEB(DEB_PRINT, 'closing cursor rcRecCursor_c');
>       CLOSE RCVRECCURSOR1_C;
>    END IF;
20097a20337,20338
>    TAG_LIKE := USE_LIKE;
>    DEB(DEB_PRINT, 'restoreTag='|| RESTORETAG ||  ',tag_like='|| TAG_LIKE);
25714a25956,25958
> 
>   VALIDATIONREC        VALIDBACKUPSETREC_T;
>   BS_RCVREC            RCVREC_T;
26372a26617,26618
>   <<NEXTROW>>
> 
26599a26846,26881
>     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;
> 
27920c28202
<   ,ATANYSCN        IN   BOOLEAN  DEFAULT FALSE) 
---
>   ,ATANYSCN        IN   BOOLEAN  DEFAULT FALSE)
28537c28819
<             DEB(DEB_IN, 'tag does not match');
---
>             DEB(DEB_IN, 'tag does not match for controlfile proxy copy');
28862c29144
<             DEB(DEB_EXIT, 'tag does not match');
---
>             DEB(DEB_EXIT, 'tag does not match for proxy copy:'||BRLREC.TAG_CON);
29101,29113c29383,29389
<       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);
29130,29139d29405
<          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;
29407a29674
>    DEB(DEB_PRINT, 'getRA_likePattern='|| PATTERN);
SYS.DBMS_RCVMAN - PACKAGE BODY (18.7RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '18.07.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '18.07.01.00'; 
SYS.DBMS_REDEFINITION - PACKAGE BODY (RU):
84a85,86
>   
>   CONS_TS_CHANGED     CONSTANT PLS_INTEGER := 32;
1259,1260c1261,1264
<   USING_INDEX         BOOLEAN :=FALSE;
< 
---
>   USING_INDEX         BOOLEAN := FALSE;
>   IDX_ATT_LOCAL       BOOLEAN := FALSE;     
>   IDX_TMP_CNT         PLS_INTEGER;
>   IDX_INT_PARTITION   BOOLEAN := FALSE;     
1468,1470c1472,1504
<       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;
1527c1561,1586
< 
---
>         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;
1750a1810,1826
>     
>     
>     
>     
>     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;
4614a4691
>       CTX_FLAG := CTX_FLAG + DBMS_REDEFINITION.CONS_TS_CHANGED;
SYS.DBMS_REDEFINITION_INTERNAL - PACKAGE BODY (RU):
1064a1065,1400
>   
>   
>   
>   
>   
>   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;
1075c1411
<   PROCEDURE ADD_DEP_ERRMSG(RID           IN     PLS_INTEGER,
---
>   PROCEDURE ADD_DEP_ERRMSG(RID          IN     PLS_INTEGER,
SYS.PRVT_ILM - PACKAGE BODY (RU):
5960,5961c5960
<            TRACE(ILM_DEBUG_ENTRY_EXIT,
<                   'Exiting execute_ilm_policies ');
---
> 
5963,5967d5961
<           BEGIN
<              PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
<              EXCEPTION
<           WHEN OTHERS THEN
<          
5970,5972c5964,5970
<             NULL;
<           END;
<          
---
>           
>           IF (V_TAB_ILMJOB.COUNT > 0) THEN
>             BEGIN
>                PRVT_ILM.CREATE_TAB_ILMJOB(V_TAB_ILMJOB, EXECUTION_ID);
>                EXCEPTION
>             WHEN OTHERS THEN
>             
5975c5973,5986
<           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;              
> 
7906c7917,7918
<           WHERE V_TABTASKINFO(I).N_UNRESOL = 0;
---
>           WHERE V_TABTASKINFO(I).N_UNRESOL = 0
>             AND EXECUTION_ID = V_TABTASKINFO(I).TASK_ID;
XDB.DBMS_SODA_ADMIN - PACKAGE (RU):
20a21
>   type INTNTAB is table of PLS_INTEGER;
XDB.DBMS_SODA_ADMIN - PACKAGE BODY (RU):
2189c2189
<                              P_MAX_LENGTHS         OUT  NUMNTAB,
---
>                              P_MAX_LENGTHS         OUT  INTNTAB,
2321c2321
<         P_MAX_LENGTHS := NUMNTAB();
---
>         P_MAX_LENGTHS := INTNTAB();
2547c2547
<     V_MAX_LENGTHS               NUMNTAB;
---
>     V_MAX_LENGTHS               INTNTAB;
2551,2553c2551,2553
<     V_NUM_CHAR_COLS             NUMBER := 0;
<     V_NUM_CHAR_COLS_LEN         NUMBER := 0;
<     V_DEFAULT_SIZE              NUMBER := 0;
---
>     V_NUM_CHAR_COLS             PLS_INTEGER := 0;
>     V_NUM_CHAR_COLS_LEN         PLS_INTEGER := 0;
>     V_DEFAULT_SIZE              PLS_INTEGER := 0;

19.0.0.0

DVSYS.DBMS_MACADM - PACKAGE (RU):
1797a1798,1806
>   * set allow common operation status to TRUE or FALSE for the whole CDB
>   *
>   * @param status: The allow common operation status to set for the whole
>   *                CDB.
>   */
>   PROCEDURE allow_common_operation(status IN BOOLEAN DEFAULT TRUE);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(allow_common_operation, AUTO_WITH_COMMIT);
> 
>   /**
DVSYS.DBMS_MACUTL - PACKAGE (RU):
239a240,247
>   * Returns ALLOW COMMON OPERATION status
>   *
>   * @return status string for ALLOW COMMON OPERATION
>   */
>   FUNCTION GET_ACO_STATUS RETURN PLS_INTEGER;
>   PRAGMA SUPPLEMENTAL_LOG_DATA(GET_ACO_STATUS, NONE);
> 
>   /**
DVSYS.DBMS_MACADM - PACKAGE BODY (RU):
2810a2811,2820
>   PROCEDURE ALLOW_COMMON_OPERATION(STATUS IN BOOLEAN DEFAULT TRUE)
>   IS
>     EXTERNAL
>     LANGUAGE C
>     NAME "kzvradmAllowCommOp"
>     LIBRARY DVSYS.KZV$ADM_LIBT
>       WITH CONTEXT PARAMETERS(CONTEXT,
>                               STATUS UB1,
>                               STATUS INDICATOR SB2);
> 
DVSYS.DBMS_MACUTL - PACKAGE BODY (RU):
276a277,286
>   FUNCTION GET_ACO_STATUS RETURN PLS_INTEGER
>   IS
>     LANGUAGE C
>     NAME "kzvutilGetACOStatus"
>     LIBRARY DVSYS.KZV$UTL_LIBT
>     WITH CONTEXT
>     PARAMETERS (CONTEXT,
>                 RETURN  INDICATOR  SB4,
>                 RETURN             SB2);
> 
DVSYS.DBA_DV_COMMON_OPERATION_STATUS - VIEW (RU):
0a1,4
> SELECT 'DV_ALLOW_COMMON_OPERATION' AS NAME,
>          decode(DVSYS.DBMS_MACUTL.GET_ACO_STATUS, 1, 'TRUE', 'FALSE') AS STATUS
>   FROM SYS.DUAL
> 
MDSYS.RDF_APIS_INTERNAL - PACKAGE (RU):
177c177,178
<                               MATCHEDSIG OUT VARCHAR2);
---
>                               MATCHEDSIG OUT VARCHAR2,
>                               OPTIONS        VARCHAR2 DEFAULT NULL);
186c187,188
<                                  RULEBASEIDS    SYS.ODCINUMBERLIST)
---
>                                  RULEBASEIDS    SYS.ODCINUMBERLIST,
>                                  OPTIONS        VARCHAR2 DEFAULT NULL)
188a191,195
>    FUNCTION GET_RDF_SEQUENCE_NEXTVAL (SEQUENCE_NAME VARCHAR2)
>    RETURN NUMBER;
>    FUNCTION W_GET_RDF_SEQUENCE_NEXTVAL (SEQUENCE_NAME VARCHAR2)
>    RETURN NUMBER;
> 
849c856,857
<                               MATCHEDSIG OUT VARCHAR2);
---
>                               MATCHEDSIG OUT VARCHAR2,
>                               OPTIONS        VARCHAR2 DEFAULT NULL);
858c866,867
<                                  RULEBASEIDS    SYS.ODCINUMBERLIST)
---
>                                  RULEBASEIDS    SYS.ODCINUMBERLIST,
>                                  OPTIONS        VARCHAR2 DEFAULT NULL)
MDSYS.SDO_SEM_INFERENCE - PACKAGE (RU):
39c39,77
<   procedure create_rules_index(index_name_in          varchar2,
---
>   -- router version
>   procedure create_rules_index(index_name_in           varchar2,
>                                models_in               mdsys.rdf_models,
>                                rulebases_in            mdsys.rdf_rulebases,
>                                passes                  integer  default 0,
>                                inf_components_in       varchar2 default null,
>                                options                 varchar2 default null,
>                                delta_in                mdsys.rdf_models default null,
>                                include_named_g         sem_graphs       default null,
>                                include_default_g       mdsys.rdf_models default null,
>                                include_all_g           mdsys.rdf_models default null,
>                                inf_ng_name             varchar2         default null,
>                                inf_ext_user_func_name  varchar2         default null,
>                                ols_ladder_inf_lbl_seq  varchar2 default null -- A string a numeric labels
>                                                                              -- delimited by a space
>                                );
> 
>   -- PR stub version
>   procedure create_rules_index_PR(index_name_in           varchar2,
>                                models_in               mdsys.rdf_models,
>                                rulebases_in            mdsys.rdf_rulebases,
>                                passes                  integer  default 0,
>                                inf_components_in       varchar2 default null,
>                                options                 varchar2 default null,
>                                delta_in                mdsys.rdf_models default null,
>                                include_named_g         sem_graphs       default null,
>                                include_default_g       mdsys.rdf_models default null,
>                                include_all_g           mdsys.rdf_models default null,
>                                inf_ng_name             varchar2         default null,
>                                inf_ext_user_func_name  varchar2         default null,
>                                ols_ladder_inf_lbl_seq  varchar2 default null -- A string a numeric labels
>                                                                              -- delimited by a space
>                              , p_network_owner         varchar2 default NULL
>                              , p_network_name          varchar2 default NULL
>                                );
>   PRAGMA SUPPLEMENTAL_LOG_DATA(create_rules_index_PR, AUTO_WITH_COMMIT);
> 
>   -- worker version
>   procedure w_create_rules_index(index_name_in          varchar2,
MDSYS.SEM_RDFCTX - PACKAGE (RU):
18a19
>   PRAGMA SUPPLEMENTAL_LOG_DATA(create_policy, AUTO_WITH_COMMIT);
25a27
>   PRAGMA SUPPLEMENTAL_LOG_DATA(create_policy, AUTO_WITH_COMMIT);
34a37
>   PRAGMA SUPPLEMENTAL_LOG_DATA(create_policy, AUTO_WITH_COMMIT);
44a48
>   PRAGMA SUPPLEMENTAL_LOG_DATA(create_policy, AUTO_WITH_COMMIT);
50a55
>   PRAGMA SUPPLEMENTAL_LOG_DATA(drop_policy, AUTO_WITH_COMMIT);
79a85
>   PRAGMA SUPPLEMENTAL_LOG_DATA(maintain_triples, AUTO_WITH_COMMIT);
MDSYS.SEM_RDFCTX_DR - PACKAGE (RU):
92a93
>   PRAGMA SUPPLEMENTAL_LOG_DATA(CREATE_POLICY, AUTO_WITH_COMMIT);
105a107
>   PRAGMA SUPPLEMENTAL_LOG_DATA(CREATE_DEPEND_POLICY, AUTO_WITH_COMMIT);
112a115
>   PRAGMA SUPPLEMENTAL_LOG_DATA(DROP_POLICY, AUTO_WITH_COMMIT);
283a287,294
>   PROCEDURE W_CREATE_VIRTUAL_RDFCTX_IDX_PR (
>               ROLES_AND_PRIVS  VARCHAR2,
>               P_IDXOWNER       VARCHAR2, 
>               P_IDXNAME        VARCHAR2, 
>               P_IDXPARTNAME    VARCHAR2,
>               P_DEPPLCNM       VARCHAR2,
> 	      L_VMIDX          NUMBER, P_NETWORK_OWNER VARCHAR2, P_NETWORK_NAME VARCHAR2);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(W_CREATE_VIRTUAL_RDFCTX_IDX_PR, AUTO_WITH_COMMIT);
538a550,667
> 
>   PROCEDURE ODCIINDEXCREATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXCREATE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXDROP_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXDROP_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXALTER_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXPARMS    IN OUT VARCHAR2,
>            ALTOPT      NUMBER,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER); 
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXALTER_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXTRUNCATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXTRUNCATE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXMERGEPARTITION_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            PART1_NAME  SYS.ODCIPARTINFO,
>            PART2_NAME  SYS.ODCIPARTINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXMERGEPARTITION_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXSPLITPARTITION_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            PART1_NAME  SYS.ODCIPARTINFO,
>            PART2_NAME  SYS.ODCIPARTINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXSPLITPARTITION_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXEXCHANGEPARTITION_PR (
>            PA_IDXINFO  SYS.ODCIINDEXINFO,
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXEXCHANGEPARTITION_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXINSERT_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            NEWVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXINSERT_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXINSERT_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            NEWVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
>   	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXINSERT_PR, MANUAL);
>  
>   PROCEDURE ODCIINDEXDELETE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXDELETE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXDELETE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXDELETE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXUPDATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      VARCHAR2,
>            NEWVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXUPDATE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXUPDATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      CLOB,
>            NEWVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXUPDATE_PR, MANUAL);
> 
>   PROCEDURE ODCIINDEXSTART_PR (
>            ICTX        IN OUT SEMCONTEXTINDEXMETHODS,
>            IDXINFO     SYS.ODCIINDEXINFO,
>            OPI         SYS.ODCIPREDINFO,
>            OQI         SYS.ODCIQUERYINFO,
>            STRT        NUMBER,
>            STOP        NUMBER,
>            SPARQL      VARCHAR2,
>            POLICY      VARCHAR2,
>            IDX_STATUS  INTEGER,
>            ALIASES     MDSYS.RDF_ALIASES,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER);
>   PRAGMA SUPPLEMENTAL_LOG_DATA(ODCIINDEXSTART_PR, MANUAL);
> 
MDSYS.S_SDO_RDF_INFO - PACKAGE (RU):
1a2,3
>   -- #28103358: MDSYS packages require PRAGMA for DBMS_ROLLING upgrade support
>   PRAGMA SUPPLEMENTAL_LOG_DATA(default, NONE);
MDSYS.S_SDO_RDF_INTERNAL - PACKAGE (RU):
681c681,682
<                              matchedsig OUT varchar2);
---
>                              matchedsig OUT varchar2,
>                              options        varchar2 default NULL);
690c691,692
<                                  RulebaseIDs    SYS.ODCINumberList)
---
>                                  RulebaseIDs    SYS.ODCINumberList,
>                                  options        varchar2 default NULL)
691a694,696
> 
>   FUNCTION get_rdf_sequence_nextval (sequence_name varchar2)
>   RETURN number;
MDSYS.S_SDO_RDF_QUERY - PACKAGE (RU):
3c3
<   --PRAGMA SUPPLEMENTAL_LOG_DATA(default, NONE);
---
>   PRAGMA SUPPLEMENTAL_LOG_DATA(default, NONE);
MDSYS.RDF_APIS_INTERNAL - PACKAGE BODY (RU):
1744c1744,1745
<                               MATCHEDSIG OUT VARCHAR2) IS
---
>                               MATCHEDSIG OUT VARCHAR2,
>                               OPTIONS        VARCHAR2 DEFAULT NULL) IS
1777c1778
<                                            MODELIDS, RULEBASEIDS);
---
>                                            MODELIDS, RULEBASEIDS, OPTIONS);
1889c1890,1891
<                                  RULEBASEIDS    SYS.ODCINUMBERLIST)
---
>                                  RULEBASEIDS    SYS.ODCINUMBERLIST,
>                                  OPTIONS        VARCHAR2 DEFAULT NULL)
1897c1899,1907
<          EXECUTE IMMEDIATE 'select ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model_id_sq.nextval from SYS.DUAL' INTO ISEQ;
---
>          
>          ISEQ := NVL(SDO_SEM_UTL.GET_INT_PARAMETER(NLS_UPPER(',' || REPLACE(OPTIONS, ' ', '') || ','),
>             ',RDFCTX_PRECOMP_ID='),0);
> 
>          IF (ISEQ = 0) THEN
>            EXECUTE IMMEDIATE 'select ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model_id_sq.nextval from SYS.DUAL' INTO ISEQ;
> 
> 
>          END IF;
1931a1942
> 
1934a1946,1956
>   FUNCTION W_GET_RDF_SEQUENCE_NEXTVAL (SEQUENCE_NAME VARCHAR2) RETURN NUMBER IS
>     ISEQ   NUMBER;
>   BEGIN
>     
>     IF NOT(SDO_RDF_INTERNAL.FIND_SUBPROGS_ON_CALL_STACK('MDSYS', SYS.ODCIVARCHAR2LIST('SDO_SEM_INFERENCE.CREATE_RULES_INDEX'))) THEN
>       RAISE_APPLICATION_ERROR(-20000, 'unexpected call stack for this call: ' || CHR(10) || DBMS_UTILITY.FORMAT_CALL_STACK);
>     END IF;
>     EXECUTE IMMEDIATE 'select ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(V_PFX_FOR_RDF_OBJ_NAME || SEQUENCE_NAME) || '.nextval from SYS.DUAL' INTO ISEQ;
>     RETURN ISEQ;
>   END W_GET_RDF_SEQUENCE_NEXTVAL;
> 
8383c8405
<          ' begin :1 := sem_rdfsa.has_triple_level_ols(); end;' USING IN OUT 
---
>          ' begin :1 := MDSYS.sem_rdfsa.has_triple_level_ols(); end;' USING IN OUT 
8390c8412,8415
<       RDF_APIS_INTERNAL.KSDWRF('W_has_triple_level_ols: EXCEPTION from sem_rdfsa_DR.has_triple_level_ols' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK, TRUE);
---
>       RDF_APIS_INTERNAL.KSDWRF('W_has_triple_level_ols: RETURN false [CU=' || SYS_CONTEXT('USERENV','CURRENT_USER') || ']: EXCEPTION from sem_rdfsa_DR.has_triple_level_ols' || 
>         CHR(10) || '[' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK || CHR(10) || ']' ||
>         CHR(10) || DBMS_UTILITY.FORMAT_CALL_STACK
>       , DEBUG_TRACE);
8881c8906,8907
<                              MATCHEDSIG OUT VARCHAR2) IS
---
>                              MATCHEDSIG OUT VARCHAR2,
>                              OPTIONS        VARCHAR2 DEFAULT NULL) IS
8886c8912
<       S_SDO_RDF_INTERNAL.GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG);
---
>       S_SDO_RDF_INTERNAL.GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG, OPTIONS);
8889c8915
<       W_GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG);
---
>       W_GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG, OPTIONS);
8893,8894c8919,8920
<         'S_SDO_RDF_INTERNAL.getPrecompStatus(:owner, :index_name, :precompsig, :ModelIDs, :RulebaseIDs, :precompID, :status, :matchedsig)';
<       EXECUTE IMMEDIATE DYN_SQL_STMT USING OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OUT PRECOMPID, OUT STATUS, OUT MATCHEDSIG;
---
>         'S_SDO_RDF_INTERNAL.getPrecompStatus(:owner, :index_name, :precompsig, :ModelIDs, :RulebaseIDs, :precompID, :status, :matchedsig, :options)';
>       EXECUTE IMMEDIATE DYN_SQL_STMT USING OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OUT PRECOMPID, OUT STATUS, OUT MATCHEDSIG, OPTIONS;
8920c8946,8947
<                                  RULEBASEIDS    SYS.ODCINUMBERLIST)
---
>                                  RULEBASEIDS    SYS.ODCINUMBERLIST,
>                                  OPTIONS        VARCHAR2 DEFAULT NULL)
8927c8954
<       RETURN S_SDO_RDF_INTERNAL.CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS);
---
>       RETURN S_SDO_RDF_INTERNAL.CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OPTIONS);
8930c8957
<       RETURN W_CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS);
---
>       RETURN W_CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OPTIONS);
8934,8935c8961,8962
<         'S_SDO_RDF_INTERNAL.createPrecompStatus(:owner, :index_name, :precompsig, :ModelIDs, :RulebaseIDs); END;';
<       EXECUTE IMMEDIATE DYN_SQL_STMT USING OUT RET_VAL, OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS;
---
>         'S_SDO_RDF_INTERNAL.createPrecompStatus(:owner, :index_name, :precompsig, :ModelIDs, :RulebaseIDs, :options); END;';
>       EXECUTE IMMEDIATE DYN_SQL_STMT USING OUT RET_VAL, OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OPTIONS;
8938a8966,8984
> 
>   FUNCTION GET_RDF_SEQUENCE_NEXTVAL (SEQUENCE_NAME VARCHAR2) RETURN NUMBER IS
>     RET_VAL              NUMBER;
>     CHOSEN_ROUTE         NUMBER := SDO_RDF_INTERNAL.ROUTER();
>   BEGIN
>     IF (CHOSEN_ROUTE = SDO_RDF.ROUTE_MDSYS_DR) THEN
>       
>       RETURN S_SDO_RDF_INTERNAL.GET_RDF_SEQUENCE_NEXTVAL(SEQUENCE_NAME);
>     ELSIF (CHOSEN_ROUTE = SDO_RDF.ROUTE_DIRECT_IR) THEN
>       
>       RETURN W_GET_RDF_SEQUENCE_NEXTVAL(SEQUENCE_NAME);
>     ELSE
>       
>       DYN_SQL_STMT := 'call ' || V_PFX_FOR_RDF_OBJ_NAME ||
>         'S_SDO_RDF_INTERNAL.get_rdf_sequence_nextval(:sequence_name) INTO :ret_val';
>       EXECUTE IMMEDIATE DYN_SQL_STMT USING SEQUENCE_NAME, OUT RET_VAL;
>       RETURN RET_VAL;
>     END IF;
>   END GET_RDF_SEQUENCE_NEXTVAL;
MDSYS.SDO_RDF - PACKAGE BODY (RU):
13602c13602,13603
<                                      matchedsig OUT varchar2);
---
>                                      matchedsig OUT varchar2,
>                                      options        varchar2 default NULL);
13611c13612,13613
<                                          RulebaseIDs    SYS.ODCINumberList)
---
>                                          RulebaseIDs    SYS.ODCINumberList,
>                                          options        varchar2 default NULL)
13613a13616,13618
>           FUNCTION get_rdf_sequence_nextval (sequence_name varchar2)
>           RETURN number;
> 
15116c15121,15122
<                                      matchedsig OUT varchar2) IS
---
>                                      matchedsig OUT varchar2,
>                                      options        varchar2 default NULL) IS
15119c15125
<             MDSYS.RDF_APIS_INTERNAL.W_getPrecompStatus(owner, index_name, precompsig, ModelIDs, RulebaseIDs, precompID, status, matchedsig);
---
>             MDSYS.RDF_APIS_INTERNAL.W_getPrecompStatus(owner, index_name, precompsig, ModelIDs, RulebaseIDs, precompID, status, matchedsig, options);
15133c15139,15140
<                                         RulebaseIDs    SYS.ODCINumberList)
---
>                                         RulebaseIDs    SYS.ODCINumberList,
>                                         options        varchar2 default NULL)
15137c15144
<             RETURN MDSYS.RDF_APIS_INTERNAL.W_createPrecompStatus(owner, index_name, precompsig, ModelIDs, RulebaseIDs);
---
>             RETURN MDSYS.RDF_APIS_INTERNAL.W_createPrecompStatus(owner, index_name, precompsig, ModelIDs, RulebaseIDs, options);
15138a15146,15152
> 
>           FUNCTION get_rdf_sequence_nextval (sequence_name varchar2)
>           RETURN number IS
>           BEGIN
>             mdsys.sdo_rdf_internal.match_package_with_network(orig_v_pfx_for_rdf_obj_name, package_name);
>             RETURN MDSYS.RDF_APIS_INTERNAL.W_get_rdf_sequence_nextval(sequence_name);
>           END get_rdf_sequence_nextval;
MDSYS.SDO_RDF_INTERNAL - PACKAGE BODY (RU):
5112c5112,5116
<     CALLCONTEXT.DUP_DICT := (NETWORK_OWNER != 'MDSYS' AND SDO_SEM_CTX_NETWORK_OWNER IS NOT NULL);
---
>     IF (CALLCONTEXT.DUP_DICT IS NULL) THEN
>       CALLCONTEXT.DUP_DICT := (NETWORK_OWNER != 'MDSYS' AND SDO_SEM_CTX_NETWORK_OWNER IS NOT NULL);
>       
>     END IF;
> 
5124a5129,5130
>     
> 
8198c8204
<  where mdsys.rdf_apis_internal.hashclob(v.long_value) IS NOT NULL
---
>  where mdsys.rdf_apis.hashclob(v.long_value) IS NOT NULL
8217c8223
<        where mdsys.rdf_apis_internal.hashclob(long_value) IS NOT NULL) v
---
>        where mdsys.rdf_apis.hashclob(long_value) IS NOT NULL) v
20125a20132
>     RDFCTX_VM_IDHINT CONSTANT VARCHAR2(13) := 'RDFCTX_VM_ID=';
20131a20139,20140
>     VID_BEG  NUMBER;
>     VID_END  NUMBER;
20637d20645
< 
20661,20662c20669,20676
<     IF (NOT HAVEID) THEN            
<       EXECUTE IMMEDIATE 
---
>     IF (NOT HAVEID) THEN   
>       IF (INSTR(OPTIONS, RDFCTX_VM_IDHINT) > 0) THEN
>         VID_BEG := INSTR(OPTIONS, RDFCTX_VM_IDHINT) + LENGTH(RDFCTX_VM_IDHINT);
>         VID_END := INSTR(OPTIONS,' ', VID_BEG);
> 	VMID := TO_NUMBER(SUBSTR(OPTIONS, VID_BEG, VID_END - VID_BEG));
>         MDSYS.RDF_APIS_INTERNAL.KSDWRF('RDFCTX vmId ='|| VMID || 'vID_beg vID_end:' || VID_BEG || ' ' || VID_END);
>       ELSE
>         EXECUTE IMMEDIATE 
20664c20678,20679
<       INTO VMID;
---
>         INTO VMID;
>       END IF;
27234c27249
<           (CASE NETWORK_OWNER WHEN 'MDSYS' THEN 'MDSYS.RDF_APIS_INTERNAL' ELSE 'SEM_APIS' END ) || '.HASHCLOB(long_value))
---
>           (CASE NETWORK_OWNER WHEN 'MDSYS' THEN 'MDSYS.RDF_APIS' ELSE 'SEM_APIS' END ) || '.HASHCLOB(long_value))
27559c27574
<     IF NOT(INSTR(ROLES_AND_PRIVS,' DBA ') > 0 OR INSTR(ROLES_AND_PRIVS,' PDB_DBA ') > 0 OR NETWORK_OWNER = SYS_CONTEXT('USERENV','CURRENT_USER')) THEN
---
>     IF NOT(INSTR(ROLES_AND_PRIVS,' DBA ') > 0 OR INSTR(ROLES_AND_PRIVS,' PDB_DBA ') > 0 OR (NETWORK_OWNER != 'MDSYS' AND NETWORK_OWNER = SYS_CONTEXT('USERENV','CURRENT_USER'))) THEN
MDSYS.SDO_SEM_INFERENCE - PACKAGE BODY (RU):
342c342
<         VCSTATUS, VCMATCHEDSIG);
---
>         VCSTATUS, VCMATCHEDSIG, OPTIONS);
396a397
>   
397a399,481
>                                MODELS_IN               MDSYS.RDF_MODELS,
>                                RULEBASES_IN            MDSYS.RDF_RULEBASES,
>                                PASSES                  INTEGER  DEFAULT 0,
>                                INF_COMPONENTS_IN       VARCHAR2 DEFAULT NULL,
>                                OPTIONS                 VARCHAR2 DEFAULT NULL,
>                                DELTA_IN                MDSYS.RDF_MODELS DEFAULT NULL,
>                                INCLUDE_NAMED_G         SEM_GRAPHS       DEFAULT NULL,
>                                INCLUDE_DEFAULT_G       MDSYS.RDF_MODELS DEFAULT NULL,
>                                INCLUDE_ALL_G           MDSYS.RDF_MODELS DEFAULT NULL,
>                                INF_NG_NAME             VARCHAR2         DEFAULT NULL,
>                                INF_EXT_USER_FUNC_NAME  VARCHAR2         DEFAULT NULL,
>                                OLS_LADDER_INF_LBL_SEQ  VARCHAR2 DEFAULT NULL 
>                                                                              
>                                )
>   AS
>     CNT NUMBER := 0;
>   BEGIN
> 
>     IF (NETWORK_OWNER IS NULL) THEN
>      SEM_APIS.SET_NETWORK_INFO_CP_TO_PKGS(NULL, NULL);
>     END IF;
> 
>     
>     
>     IF (INSTR(NLS_UPPER(',' || REPLACE(OPTIONS, ' ', '') || ','), ',LOCAL_NG_INF=T') > 0) THEN
>       FOR M IN MODELS_IN.FIRST..MODELS_IN.LAST LOOP
>         EXECUTE IMMEDIATE 
>           'select count(*) from ' || V_PFX_FOR_RDF_OBJ_NAME || 'RDF_MODEL$ ' ||
>           ' where model_type=:rdfctx and model_name=:modname' 
>           INTO CNT USING SDO_RDF_INTERNAL.MODEL_TYPE_RDFCTX, TRIM(MODELS_IN(M));
>         IF (CNT > 0) THEN
>           EXIT;
>         END IF;
>       END LOOP;
>     END IF;
> 
>     IF (CNT > 0) THEN 
>       
>       
>       
>        CREATE_RULES_INDEX_PR(INDEX_NAME_IN,MODELS_IN,RULEBASES_IN,PASSES,INF_COMPONENTS_IN
>          ,OPTIONS
>           || (',RDFCTX_PRECOMP_ID=' || RDF_APIS_INTERNAL.GET_RDF_SEQUENCE_NEXTVAL('RDF_MODEL_ID_SQ') || ' ')
>           || (',RDFCTX_RDF_HIST_ID=' || RDF_APIS_INTERNAL.GET_RDF_SEQUENCE_NEXTVAL('RDF_HIST_ID_SQ') || ' ')
>          ,DELTA_IN,INCLUDE_NAMED_G,INCLUDE_DEFAULT_G,INCLUDE_ALL_G,INF_NG_NAME,INF_EXT_USER_FUNC_NAME
>          ,OLS_LADDER_INF_LBL_SEQ,NETWORK_OWNER,RTRIM(NETWORK_NAME,'#'));
>     ELSE
>        W_CREATE_RULES_INDEX(INDEX_NAME_IN,MODELS_IN,RULEBASES_IN,PASSES,INF_COMPONENTS_IN,OPTIONS
>          ,DELTA_IN,INCLUDE_NAMED_G,INCLUDE_DEFAULT_G,INCLUDE_ALL_G,INF_NG_NAME,INF_EXT_USER_FUNC_NAME
>          ,OLS_LADDER_INF_LBL_SEQ);
>     END IF;
>   END CREATE_RULES_INDEX;
> 
>   
>   PROCEDURE CREATE_RULES_INDEX_PR(INDEX_NAME_IN           VARCHAR2,
>                                MODELS_IN               MDSYS.RDF_MODELS,
>                                RULEBASES_IN            MDSYS.RDF_RULEBASES,
>                                PASSES                  INTEGER  DEFAULT 0,
>                                INF_COMPONENTS_IN       VARCHAR2 DEFAULT NULL,
>                                OPTIONS                 VARCHAR2 DEFAULT NULL,
>                                DELTA_IN                MDSYS.RDF_MODELS DEFAULT NULL,
>                                INCLUDE_NAMED_G         SEM_GRAPHS       DEFAULT NULL,
>                                INCLUDE_DEFAULT_G       MDSYS.RDF_MODELS DEFAULT NULL,
>                                INCLUDE_ALL_G           MDSYS.RDF_MODELS DEFAULT NULL,
>                                INF_NG_NAME             VARCHAR2         DEFAULT NULL,
>                                INF_EXT_USER_FUNC_NAME  VARCHAR2         DEFAULT NULL,
>                                OLS_LADDER_INF_LBL_SEQ  VARCHAR2 DEFAULT NULL 
>                                                                              
>                              , P_NETWORK_OWNER         VARCHAR2 DEFAULT NULL
>                              , P_NETWORK_NAME          VARCHAR2 DEFAULT NULL
>                                )
>   AS
>   BEGIN
>     SEM_APIS.SET_NETWORK_INFO_CP_TO_PKGS(P_NETWORK_OWNER, P_NETWORK_NAME);
> 
>     W_CREATE_RULES_INDEX(INDEX_NAME_IN,MODELS_IN,RULEBASES_IN,PASSES,INF_COMPONENTS_IN,OPTIONS
>       ,DELTA_IN,INCLUDE_NAMED_G,INCLUDE_DEFAULT_G,INCLUDE_ALL_G,INF_NG_NAME,INF_EXT_USER_FUNC_NAME
>       ,OLS_LADDER_INF_LBL_SEQ);
> 
>   END CREATE_RULES_INDEX_PR;
> 
>   
>   PROCEDURE W_CREATE_RULES_INDEX(INDEX_NAME_IN           VARCHAR2,
MDSYS.SDO_SEM_INF_INTERNAL - PACKAGE BODY (RU):
1699c1699
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM);
1710c1710
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')4]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')4]: ' || SQLERRM);
1732c1732
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')6]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')6]: ' || SQLERRM);
1783c1783
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')10]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')10]: ' || SQLERRM);
1795c1795
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')11]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')11]: ' || SQLERRM);
1817c1817
<                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')13]: ' || SQLERRM); RAISE;
---
>                                  'EXCEPTION[sdoseminfb.sql(' || $$PLSQL_LINE || ')13]: ' || SQLERRM);
4327c4327
<   FUNCTION RECORD_INF_START(VCACTION VARCHAR2, VCIDX VARCHAR2)
---
>   FUNCTION RECORD_INF_START(VCACTION VARCHAR2, VCIDX VARCHAR2, OPTIONS VARCHAR2 DEFAULT NULL)
4330a4331
>     ISEQ_IN NUMBER;
4332a4334,4341
> 
>     
>     ISEQ_IN := NVL(SDO_SEM_UTL.GET_INT_PARAMETER(NLS_UPPER(',' || REPLACE(OPTIONS, ' ', '') || ','),',RDFCTX_RDF_HIST_ID='),0);
> 
>     IF (ISEQ_IN = 0) THEN
>       EXECUTE IMMEDIATE 'select ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_hist_id_sq.nextval from SYS.DUAL' INTO ISEQ_IN;
>     END IF;
> 
4335c4344
<      || ' values(:1, ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_hist_id_sq.nextval, :2, :3, sysdate, 0) '
---
>      || ' values(:1, ' || ISEQ_IN || ', :2, :3, sysdate, 0) '
4339a4349
> 
15931c15941
<       VCSTATUS, VCMATCHEDSIG);
---
>       VCSTATUS, VCMATCHEDSIG, OPTIONS);
16498c16508
<     M_IINFACTIONSEQ := RECORD_INF_START(M_VCINFACTIONMSG, NLS_UPPER(VCIDX)); 
---
>     M_IINFACTIONSEQ := RECORD_INF_START(M_VCINFACTIONMSG, NLS_UPPER(VCIDX), OPTIONS); 
MDSYS.SEM_RDFCTX_DR - PACKAGE BODY (RU):
1660a1661,1672
>   BEGIN
>     EXECUTE IMMEDIATE 'select ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model_id_sq.nextval FROM SYS.DUAL' INTO L_VMIDX; 
>     W_CREATE_VIRTUAL_RDFCTX_IDX_PR(ROLES_AND_PRIVS,P_IDXOWNER,P_IDXNAME,P_IDXPARTNAME,P_DEPPLCNM,L_VMIDX,NETWORK_OWNER,RTRIM(NETWORK_NAME,'#'));
>   END W_CREATE_VIRTUAL_RDFCTX_INDEX;
> 
>   PROCEDURE W_CREATE_VIRTUAL_RDFCTX_IDX_PR (
>               ROLES_AND_PRIVS  VARCHAR2,
>               P_IDXOWNER       VARCHAR2, 
>               P_IDXNAME        VARCHAR2, 
>               P_IDXPARTNAME    VARCHAR2,
>               P_DEPPLCNM       VARCHAR2,
> 	      L_VMIDX          NUMBER, P_NETWORK_OWNER VARCHAR2, P_NETWORK_NAME VARCHAR2) IS 
1677,1678d1688
<     EXECUTE IMMEDIATE 'select ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdf_model_id_sq.nextval FROM SYS.DUAL' INTO 
<                          L_VMIDX; 
1680c1690,1693
<     EXECUTE IMMEDIATE 'select mdsys.sem_rdfctx.get_policy_key(policy_owner, policy_name), user_models, rulebases, base_policy 
---
>     SEM_APIS.SET_NETWORK_INFO_CP_TO_PKGS(P_NETWORK_OWNER, P_NETWORK_NAME);
> 
>     
>     DYN_SQL_STMT := 'select mdsys.sem_rdfctx.get_policy_key(policy_owner, policy_name), user_models, rulebases, base_policy 
1682c1695,1696
<     INTO L_POLRID, L_MODLIST, L_RULBLIST, L_DUMNM USING  P_IDXOWNER, P_DEPPLCNM;
---
>      ;
>     EXECUTE IMMEDIATE DYN_SQL_STMT INTO L_POLRID, L_MODLIST, L_RULBLIST, L_DUMNM USING  P_IDXOWNER, P_DEPPLCNM;
1692c1706
<     EXECUTE IMMEDIATE 'insert into ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdfctx_index_policies$
---
>     DYN_SQL_STMT := 'insert into ' || V_PFX_FOR_RDF_OBJ_NAME || 'rdfctx_index_policies$
1694c1708,1709
<          (:1,:2,:3,:4,:5,:6, NULL)' USING P_IDXOWNER, P_IDXNAME, P_IDXPARTNAME,L_POLRID,
---
>          (:1,:2,:3,:4,:5,:6, NULL)';
>     EXECUTE IMMEDIATE DYN_SQL_STMT USING P_IDXOWNER, P_IDXNAME, P_IDXPARTNAME,L_POLRID,
1704c1719
<       EXECUTE IMMEDIATE
---
>       DYN_SQL_STMT :=
1707a1723,1724
>       ;
>       EXECUTE IMMEDIATE DYN_SQL_STMT
1827c1844,1845
<            P_IDXOWNER, ROLES_AND_PRIVS, L_VMMODELSLIST, NULL, NULL,L_VMENTAILLIST);
---
>            P_IDXOWNER, ROLES_AND_PRIVS, L_VMMODELSLIST, NULL, 
> 	   ' RDFCTX_VM_ID=' || L_VMIDX || ' ', L_VMENTAILLIST);
1829c1847
<       EXECUTE IMMEDIATE 'create or replace view ' || V_PFX_FOR_RDF_OBJ_NAME || 'semv_rdfctx_mod_'||
---
>       DYN_SQL_STMT := 'create or replace view ' || V_PFX_FOR_RDF_OBJ_NAME || 'semv_rdfctx_mod_'||
1831a1850
>       EXECUTE IMMEDIATE DYN_SQL_STMT;
1833c1852
<       EXECUTE IMMEDIATE 'grant select on ' || V_PFX_FOR_RDF_OBJ_NAME || 'semv_rdfctx_mod_'||L_VMIDX||  
---
>       DYN_SQL_STMT:= 'grant select on ' || V_PFX_FOR_RDF_OBJ_NAME || 'semv_rdfctx_mod_'||L_VMIDX||  
1834a1854
>       EXECUTE IMMEDIATE DYN_SQL_STMT;
1840a1861,1865
>       RDF_APIS_INTERNAL.KSDWRF('W_create_virtual_rdfctx_idx_PR: ERROR: ' ||
>         CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK || 
>         CHR(10) || '[' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || CHR(10) || ']' ||
>         CHR(10) || DYN_SQL_STMT ||
>         CHR(10) || DBMS_UTILITY.FORMAT_CALL_STACK(), TRUE);
1850c1875
<   END W_CREATE_VIRTUAL_RDFCTX_INDEX; 
---
>   END W_CREATE_VIRTUAL_RDFCTX_IDX_PR; 
3423a3449,6280
> 
>   PROCEDURE ODCIINDEXCREATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     L_POLLST   SYS.ODCIVARCHAR2LIST; 
>     L_BASEPOL  SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
>     L_BATCHPOL SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
>     L_BATCHPOL_COUNT NUMBER := 0; 
>     L_DEPPOL   SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
> 
>     L_DUMVR    VARCHAR2(200); 
>     L_BASETAB_QUERY_BODY VARCHAR2(4000);
>     L_INS_PARA_HINT      VARCHAR2(200);
>     L_INS_DOCURI2RID     VARCHAR2(4000);
> 
>     L_ROWCNT   NUMBER; 
>     L_EXTARR   MDSYS.T_EXTARR := MDSYS.T_EXTARR(); 
>     L_MODARR   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
>     L_ERRCNT   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
>     L_RC       SYS_REFCURSOR; 
>     S_RID      ROWID; 
>     S_CLOB     CLOB;
>     S_XMLRDF   CLOB;
>     DS_CLOB    CLOB; 
>     ERRM       VARCHAR2(4000); 
>     L_DEFPOL   VARCHAR2(130); 
>     L_VMNUM    NUMBER; 
>     L_VMMODS   MDSYS.RDF_MODELS; 
>     L_VMRBS    MDSYS.RDF_RULEBASES; 
>     L_CTXPREF  FN_XMLPREF := FN_XMLPREF();
>     T_EXTARR   FN_EXTARR := FN_EXTARR();
>     FILEDIR    VARCHAR2(512) := NULL; 
>     FILTERPL   VARCHAR2(130) := NULL;
>     STMT       VARCHAR2(32767);
>     CNT NUMBER;  
>     TRIPLE_CNT NUMBER(38);
>     STEP_NUM   NUMBER := 0;
>     L_USEDOPTS SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
>     L_EXTRPARAMS SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
>     USED_OPT   VARCHAR2(100);
>     L_LOAD_METHOD VARCHAR2(128) := 'DML';
>     L_BATCH       BOOLEAN := FALSE; 
>     OBJCNT PLS_INTEGER;
>     L_TBSNM   VARCHAR2(130);
>     IS_GLOBAL_IDX BOOLEAN;
>     IS_IDX_PARTITION  BOOLEAN := FALSE;
>     FIRST_CALL BOOLEAN := FALSE;
>     L_NETWORK_OWNER     VARCHAR2(128) := NULL;
>     L_NETWORK_NAME      VARCHAR2(30) := NULL;
> 
>     ROLES_AND_PRIVS VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
> 
>     POLICY_PARTNAME VARCHAR2(128);
>     
>     CURSOR CUR1(IANAME VARCHAR2) IS
>       SELECT PARTITION_NAME, TABLESPACE_NAME 
>         FROM SYS.USER_IND_PARTITIONS
>        WHERE INDEX_NAME = IANAME 
>     ORDER BY PARTITION_POSITION;
>     
>     CURSOR CUR2(IANAME VARCHAR2) IS
>       SELECT XP.PARTITION_NAME, TP.TABLESPACE_NAME 
>         FROM SYS.USER_IND_PARTITIONS XP, SYS.ALL_TAB_PARTITIONS TP, SYS.USER_INDEXES X
>        WHERE XP.INDEX_NAME = IANAME AND XP.PARTITION_NAME = TP.PARTITION_NAME
>          AND X.TABLE_NAME = TP.TABLE_NAME AND XP.INDEX_NAME = X.INDEX_NAME 
>     ORDER BY XP.PARTITION_POSITION;
>     
>     PARTI_DETAILS VARCHAR2(3000);
>     CR_STAGTAB_STMT  VARCHAR2(4000);
>     IDX_OBJNUM  NUMBER;
>     STAGTAB_NAME   VARCHAR2(270);
>     STAGTAB_SUFFIX VARCHAR2(128);
>     STAGTAB        VARCHAR2(128);
>     STAGVIEW_NAME  VARCHAR2(270);
>     STAGVIEW       VARCHAR2(128);
>     STAGTAB_VIEW_NAME      VARCHAR2(128);
>     STAGTAB_PART_VIEW_NAME VARCHAR2(128) := NULL;
>     XINFOTAB_NAME   VARCHAR2(270);
>     XINFOTAB        VARCHAR2(128);
>     XINFOTAB_SUFFIX VARCHAR2(128);
> 
>     BATCH_INTERFACE_OPTION CONSTANT VARCHAR2(100) := 'INTERFACE=BATCH';
>     DBUSER_ATTRIBUTE_NAME  CONSTANT VARCHAR2(100) := 'DBUSER';
>     XUSER                           VARCHAR2(128); 
> 
>     LOOPVAR_I      NUMBER;
>     STATUS         NUMBER;
> 
>     PARTI_CLAUSE       VARCHAR2(1000) := NULL;
>     INS_INTO_DOCVID    VARCHAR2(4000);
> 
>     
>     DOCURI2RID           VARCHAR2(128); 
>     DOCVID2RID           VARCHAR2(128); 
> 
>     DOCURI2RID_NAME      VARCHAR2(270);
>     DOCURI2RID_DEBUG     VARCHAR2(270);
>     DOCVID2RID_NAME      VARCHAR2(270);
> 
>     DOCURI2RID_NAMESQ    VARCHAR2(270);   
>     DOCVID2RID_NAMESQ    VARCHAR2(270);
>     
>     KEEP_STAGING_TABLES        VARCHAR2(128) := 'KEEP_RDFCTX_STAGING_TABLES';
>     KEEP_RDFCTX_STAGING_TABLES BOOLEAN := FALSE;
>     IS_PARTN_TBL        NUMBER;
>     IS_ADD_PARTITION    BOOLEAN := FALSE;
> 
>     L_DOCURIPFX         VARCHAR2(4000);
>     L_DOCURISHORTPFX    VARCHAR2(500);
>     ROWS_APPENDED       NUMBER;
> 
>     SNAP_TIME           TIMESTAMP;
>     UNAME               VARCHAR2(128);
> 
>     DEBUG_TRACE         BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     BEGIN
>       L_POLLST := SEM_RDFCTX_DR.PRVT_PARAMS_PARSER(IDXPARMS, L_USEDOPTS, L_EXTRPARAMS); 
>     EXCEPTION 
>       WHEN OTHERS THEN 
>         EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
>                                ''invalid or empty parameters passed to the index'')';
>         RETURNVAL :=  SYS.ODCICONST.FATAL;
> 	RETURN;
>         
>         
>     END; 
> 
>     SELECT COUNT(DISTINCT(COLUMN_VALUE)) INTO L_ROWCNT
>        FROM TABLE(L_POLLST); 
> 
>     IF (L_ROWCNT != L_POLLST.COUNT OR L_POLLST.COUNT > 5) THEN 
>         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>           'duplicate or too many policies specified for the index'); 
>     END IF; 
> 
>     
>     FOR OPT IN (SELECT DISTINCT COLUMN_VALUE FROM TABLE(L_USEDOPTS))
>     LOOP
>         USED_OPT := TRIM(OPT.COLUMN_VALUE);
>         RDF_APIS_INTERNAL.KSDWRF('CreateIndex option=' || USED_OPT || '*', DEBUG_TRACE);
>         IF (USED_OPT = 'LOAD_METHOD=BULK') THEN 
>           L_LOAD_METHOD := 'BULKLOAD'; 
>           RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
>         ELSIF (USED_OPT = BATCH_INTERFACE_OPTION) THEN
>           L_LOAD_METHOD := 'BULKLOAD';
>           L_BATCH := TRUE;
>           RDF_APIS_INTERNAL.KSDWRF('interface=BATCH', DEBUG_TRACE);
>           RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
>         ELSIF (USED_OPT = KEEP_STAGING_TABLES) THEN
>           KEEP_RDFCTX_STAGING_TABLES := TRUE;
> 	ELSIF (INSTR(USED_OPT, 'NETWORK_OWNER=') > 0) THEN 
> 	  BEGIN
> 	    IF (INSTR(USED_OPT, '"', 15) > 0) THEN
> 	      L_NETWORK_OWNER := SUBSTR(USED_OPT, 15);
> 	    ELSE
> 	      L_NETWORK_OWNER := NLS_UPPER(SUBSTR(USED_OPT, 15));
> 	    END IF;
>           END;
> 	ELSIF (INSTR(USED_OPT, 'NETWORK_NAME=') > 0) THEN
> 	  BEGIN
> 	    IF (INSTR(USED_OPT, '"', 14) > 0) THEN
> 	      L_NETWORK_NAME := SUBSTR(USED_OPT, 15, LENGTH(USED_OPT)-15);
> 	    ELSE
> 	      L_NETWORK_NAME := NLS_UPPER(SUBSTR(USED_OPT, 14));
> 	    END IF;
>           END;
>         END IF;
>     END LOOP;
> 
>     SEM_APIS.SET_NETWORK_INFO_CP_TO_PKGS(L_NETWORK_OWNER, L_NETWORK_NAME);
>     SEM_RDFCTX_DR.COPY_NETWORK_INFO_TO_PKG_VARS;
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     COMMIT; 
> 
> 
> 
> 
>     
>     SEM_RDFCTX_IR.PURGE_TEMP_STAGING_TABLES;
> 
>     
>     IF (IDXPARMS IS NULL OR LENGTH(IDXPARMS) = 0) THEN 
>       EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
>                                ''invalid or empty parameters passed to the index'')';
>       RETURNVAL:= SYS.ODCICONST.FATAL;
>       RETURN;
>       
>       
>     END IF; 
>     BEGIN
>       L_DUMVR := SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXNAME, FALSE);
>     EXCEPTION
>       WHEN OTHERS THEN
>         EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
>                                ''invalid name for the index'')';
>         RETURNVAL:= SYS.ODCICONST.FATAL;
> 	RETURN;
>     END;
> 
>     
>     IF (NOT(IDXINFO.INDEXCOLS(1).COLTYPENAME IN ('CLOB','VARCHAR2'))) THEN
>       INSERT INTO SYS.ODCI_WARNINGS$ VALUES (1,'unsupported data type '||
>                                     IDXINFO.INDEXCOLS(1).COLTYPENAME ||' for the indextype');
>        RETURNVAL:= SYS.ODCICONST.FATAL;
>        RETURN;
>     END IF; 
> 
>     IF ((IDXENV.CALLPROPERTY IS NULL) AND (IDXINFO.INDEXPARTITION IS NULL)) THEN 
>       IS_GLOBAL_IDX := TRUE;
>       POLICY_PARTNAME := IDXINFO.INDEXNAME;
> 
>       
>       
>       
>       
>     ELSE
>       IF((IDXENV.CALLPROPERTY IS NULL) AND (IDXINFO.INDEXPARTITION IS NOT NULL)) THEN
>         
>         IS_GLOBAL_IDX := FALSE;
>         IS_ADD_PARTITION := TRUE;
>         POLICY_PARTNAME := IDXINFO.INDEXPARTITION;
>       ELSE
>         IS_GLOBAL_IDX := FALSE; 
>         IF (IDXENV.CALLPROPERTY = SYS.ODCICONST.FIRSTCALL) THEN
>           FIRST_CALL := TRUE;
>  
>           
>           
>           PARTI_DETAILS := '';
>           LOOPVAR_I := 1;
> 
>           FOR C1 IN CUR2(IDXINFO.INDEXNAME) LOOP
>             IF (LOOPVAR_I >1) THEN
>               PARTI_DETAILS := PARTI_DETAILS || SDO_SEM_LOG.NEWLINE || ',';
>             END IF;
>             PARTI_DETAILS := PARTI_DETAILS
>                 || 'partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(C1.PARTITION_NAME, FALSE)
>                 || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(C1.TABLESPACE_NAME, FALSE);
>             LOOPVAR_I := LOOPVAR_I+1;
>          END LOOP;
>          RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: partition_details=' || PARTI_DETAILS, DEBUG_TRACE);
> 
>         ELSE
>           IF ((IDXENV.CALLPROPERTY = SYS.ODCICONST.INTERMEDIATECALL) AND 
>                   (IDXINFO.INDEXPARTITION IS NOT NULL))  THEN
>             IS_IDX_PARTITION := TRUE;
>             POLICY_PARTNAME := IDXINFO.INDEXPARTITION;
>           END IF;
>         END IF;
>       END IF;
>     END IF;
> 
>     BEGIN
>       L_DEFPOL := L_POLLST(1); 
> 
>       STEP_NUM := 3.5;
>       
>       
>       SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME,STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
>       MDSYS.RDF_APIS_INTERNAL.KSDWRF('step 3.5: xinfotab_name=' || XINFOTAB_NAME, DEBUG_TRACE);
>       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>       
>       DOCURI2RID_NAMESQ := DOCURI2RID_NAME;
>       DOCVID2RID_NAMESQ := DOCVID2RID_NAME;
> 
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       
>       IF (NOT(IS_ADD_PARTITION)) THEN
>         IF (DEBUG_TRACE AND XINFOTAB_NAME IS NOT NULL) THEN
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF('step 3.5 before creating staging table: (note: xinfotab_name=' 
>             || XINFOTAB_NAME || ' NOT created', DEBUG_TRACE);
>         END IF;
>         IF (IS_GLOBAL_IDX) THEN
>           
>           UNAME := SYS_CONTEXT('USERENV','CURRENT_USER');
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF('user is odciindexcreate is :' ||UNAME, DEBUG_TRACE);
>           SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,NULL,NULL,TRUE,NULL);
>         ELSIF (FIRST_CALL) THEN
>           
>           SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,NULL,PARTI_DETAILS,FALSE,NULL);
>         END IF;
>       END IF;
> 
>       STEP_NUM := 4;
>       RDF_APIS_INTERNAL.KSDWRF('starting step 4', DEBUG_TRACE);
> 
>       
>       SEM_RDFCTX_DR.SPLIT_POLICY_LIST (IDXINFO.INDEXSCHEMA, L_POLLST, 
>                                      L_BASEPOL, L_DEPPOL); 
> 
>       STEP_NUM := 4.5;
>       FOR PIDX IN 1 .. L_BASEPOL.COUNT LOOP
>         L_EXTARR.EXTEND; 
>         L_MODARR.EXTEND; 
>         L_POLRIDS.EXTEND; 
>         L_BATCHPOL.EXTEND; 
>         L_CTXPREF.EXTEND;
>         T_EXTARR.EXTEND;
>         L_ERRCNT.EXTEND;
>         L_ERRCNT(PIDX) := 0;
> 
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: policy name=' || L_BASEPOL(PIDX), DEBUG_TRACE);
> 
>          
>          STEP_NUM := 4.52;
>          SEM_RDFCTX_DR.GET_POLICY_INFO (
>                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(PIDX)),
>                       L_POLRIDS(PIDX), L_EXTARR(PIDX), L_CTXPREF(PIDX));
> 
>          
>          IF (L_BATCH) THEN
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('BATCH interface: check if the extractor for this base-policy supports batch interface', DEBUG_TRACE);
>            IF NLS_UPPER(L_EXTARR(PIDX).GETCONTEXT(BATCH_INTERFACE_OPTION)) IN ('YES','Y') THEN
>              L_BATCHPOL(PIDX) := 1;
>              L_BATCHPOL_COUNT := L_BATCHPOL_COUNT + 1;
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: batch capable policy:' 
>                || L_BASEPOL(PIDX) || ' [count so far: ' || L_BATCHPOL_COUNT || ' batch capable policies '
>                || ' (out of ' || L_BASEPOL.COUNT || ')]', DEBUG_TRACE);
>            ELSE
>              L_BATCHPOL(PIDX) := 0;
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: NOT batch capable policy:' || L_BASEPOL(PIDX), DEBUG_TRACE);
>            END IF;
>          END IF;
> 
>          IF (NOT(IS_ADD_PARTITION)) THEN
>            IF (PIDX > 1) THEN 
>              IF (SEM_RDFCTX_DR.ARE_MATCHING_DATASTORES(L_CTXPREF(1),
>                                              L_CTXPREF(PIDX)) != 1) THEN 
>              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                'mismatched datastore specifications for base policies'); 
>              END IF; 
>            ELSIF (L_BATCH AND L_CTXPREF(1) IS NOT NULL) THEN
>              
>              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                'for BATCH interface, no support yet for files or web content');
>            ELSIF (L_CTXPREF(1) IS NOT NULL AND 
>                 L_CTXPREF(1).EXTRACT('//Datastore') IS NULL) THEN 
>              L_CTXPREF(1) := NULL; 
>            ELSIF (L_CTXPREF(1) IS NOT NULL AND 
>                NLS_UPPER(L_CTXPREF(1).EXTRACT('//Datastore/@type').GETSTRINGVAL())
>                                                             = 'FILE') THEN 
>              FILEDIR := TRIM(L_CTXPREF(1).EXTRACT(
>                           '//Datastore/Path/text()').GETSTRINGVAL());
>              SELECT COUNT(*) INTO L_ROWCNT FROM SYS.ALL_DIRECTORIES WHERE 
>                 DIRECTORY_NAME = FILEDIR; 
>              IF (L_ROWCNT = 0) THEN 
>                 MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                'directory object '||FILEDIR||' does not exist or is inaccessible'); 
>              END IF; 
>            END IF; 
>          END IF;
> 
>          STEP_NUM := 4.58;
>          RDF_APIS_INTERNAL.KSDWRF('starting step 4.58', DEBUG_TRACE);
>          
>          IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION OR IS_ADD_PARTITION) THEN 
>            
>            
>            
>            
>            
>            
>            
>            
>            SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
>               WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
> 
>            
>            IF (L_TBSNM IS NULL) THEN
>              RDF_APIS_INTERNAL.KSDWRF('Could not determine tablespace_name for use in creating RDF model', DEBUG_TRACE);
>              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                'Could not determine tablespace_name for use in creating RDF model'
>              ||(CASE IS_IDX_PARTITION 
>                 WHEN TRUE THEN ' (partition: ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
>                 ELSE '' 
>                 END));
>              RETURNVAL := SYS.ODCICONST.FATAL;
> 	     RETURN;
>            ELSE
>              RDF_APIS_INTERNAL.KSDWRF('step 4.58: l_tbsnm=' || L_TBSNM, DEBUG_TRACE);
>            END IF;
> 
>            
>            
>              RDF_APIS_INTERNAL.KSDWRF('ODCI index create: model_internal$');
>            L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
>                             IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                             POLICY_PARTNAME, L_POLRIDS(PIDX), 
>                             SEM_RDFCTX_DR.INDST_INPROGRESS, L_TBSNM,
>                             L_EXTRPARAMS(PIDX));
>          END IF;
> 
>          
>          
>          
>          
>          IF (L_LOAD_METHOD='BULKLOAD' AND (IS_GLOBAL_IDX OR FIRST_CALL)) THEN 
>            STAGTAB_SUFFIX := 
>              SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(PIDX)),L_POLRIDS(PIDX));
>            IF (IS_GLOBAL_IDX) THEN
>              SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,L_TBSNM,STAGTAB_SUFFIX,NULL,FALSE,XINFOTAB_NAME);
>            ELSIF (FIRST_CALL) THEN
>              SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,STAGTAB_SUFFIX,PARTI_DETAILS,FALSE,XINFOTAB_NAME);
>            END IF;
> 
>            IF (XINFOTAB_NAME IS NOT NULL AND L_BATCHPOL(PIDX)=1) THEN
>              
>              
>              XUSER := L_EXTARR(PIDX).GETCONTEXT(DBUSER_ATTRIBUTE_NAME);
>              STMT := 'grant select, insert, update, delete on '
>                || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(XINFOTAB_NAME || STAGTAB_SUFFIX) 
>                || ' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SYS.DBMS_ASSERT.SCHEMA_NAME(XUSER), FALSE);
>              EXECUTE IMMEDIATE STMT;
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('granted DML privs to DBUSER of extractor: ' || XUSER, DEBUG_TRACE);
>            END IF;
>          END IF;
> 
>          T_EXTARR(PIDX) := L_EXTARR(PIDX);
>       END LOOP; 
> 
>       STEP_NUM := 4.9;
>       IF (NOT(IS_ADD_PARTITION) AND L_CTXPREF(1) IS NOT NULL) THEN 
>         IF (IDXINFO.INDEXCOLS(1).COLTYPENAME != 'VARCHAR2') THEN 
>           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>              'FILE/URL datastores only allowed with VARCHAR2 columns'); 
>         END IF; 
>         IF (L_CTXPREF(1).EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
>           FILTERPL := NLS_UPPER(L_CTXPREF(1).EXTRACT(
>                                     '//Datastore/@filter').GETSTRINGVAL()); 
>         END IF; 
>       END IF; 
>     END;
> 
>    IF (IS_GLOBAL_IDX OR FIRST_CALL) THEN
>      
>      
>      
>      
>      SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME,DOCVID2RID_NAME,
>                                          L_TBSNM,PARTI_DETAILS);
> 
>      
>      FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>         L_EXTARR(EI).STARTDRIVER(); 
>      END LOOP;
>    END IF;
> 
> 
>     STEP_NUM := 5;
>     RDF_APIS_INTERNAL.KSDWRF('starting step 5', DEBUG_TRACE);
> 
>    MDSYS.RDF_APIS_INTERNAL.KSDWRF('initial setup done for creating index', DEBUG_TRACE);
> 
>    IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION) THEN
>      IF (DEBUG_TRACE) THEN              
>        RDF_APIS_INTERNAL.KSDWRF('step 5 before invoking pxs: exceptions-count=' 
>          || SEM_RDFCTX_DR.GET_EXCEPTIONS_COUNT, DEBUG_TRACE);
>      END IF;
> 
>      SEM_RDFCTX_IR.POPULATE_INDEX_SEGMENT(
>        IDXINFO, FILEDIR, FILTERPL, L_BASEPOL, L_EXTRPARAMS, L_CTXPREF, T_EXTARR, L_MODARR, L_POLRIDS
>      , L_LOAD_METHOD, STAGTAB_NAME, DOCURI2RID_NAME, DOCVID2RID_NAME, XINFOTAB_NAME
>      , L_BATCHPOL, L_BATCHPOL_COUNT);
> 
>      IF (DEBUG_TRACE) THEN              
>        RDF_APIS_INTERNAL.KSDWRF('step 5 after returning from pxs: exceptions-count=' 
>          || SEM_RDFCTX_DR.GET_EXCEPTIONS_COUNT, DEBUG_TRACE);
>      END IF;
>    END IF;
> 
>     
>     
>     
>     FOR EI IN 1..L_BASEPOL.COUNT LOOP
>        SEM_RDFCTX_DR.SET_RDFCTX_INDEX_STATUS_VALID(
>               IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>               POLICY_PARTNAME, L_MODARR(EI));
>     END LOOP;
> 
>     
>     IF (IS_GLOBAL_IDX OR IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL) THEN
>       RDF_APIS_INTERNAL.KSDWRF('closing all the extraction drivers', DEBUG_TRACE);
>       FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>         L_EXTARR(EI).CLOSEDRIVER(); 
>       END LOOP;
>     END IF;
> 
>     STEP_NUM := 9;
>     RDF_APIS_INTERNAL.KSDWRF('starting step 9', DEBUG_TRACE);
>     IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION) THEN 
>       
>       IF (L_LOAD_METHOD = 'BULKLOAD') THEN
>         BEGIN
>         FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: step_num='||STEP_NUM, DEBUG_TRACE);
>           SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, FALSE, STAGTAB, STAGVIEW, XINFOTAB, L_BATCH);
>           STAGTAB_SUFFIX := 
>             SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
> 
>           
>           IF (IS_IDX_PARTITION) THEN
>             PARTI_CLAUSE := ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
> 
>             SEM_RDFCTX_DR.GET_STAGTAB_PART_VIEW_NAME(
>               IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, FALSE,
>               STAGTAB, FALSE, STAGTAB_PART_VIEW_NAME);
>             STAGTAB_VIEW_NAME := STAGTAB_PART_VIEW_NAME;
>           ELSE
>             STAGTAB_VIEW_NAME := STAGVIEW || STAGTAB_SUFFIX;
>           END IF;
> 
> 
> 
> 
> 
> 
> 
> 
> 
>           EXECUTE IMMEDIATE 
>             'CREATE or REPLACE VIEW ' 
>             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE) 
>             ||' AS SELECT RDF$STC_GRAPH,RDF$STC_SUB,RDF$STC_PRED,RDF$STC_OBJ FROM ' 
>             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB || STAGTAB_SUFFIX, FALSE) 
>             || PARTI_CLAUSE
>             ||' WHERE RDF$STC_OBJ IS NOT NULL'
>              ;
>           EXECUTE IMMEDIATE 
>               'GRANT SELECT ON ' 
>  
>            || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
>             ||' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(), FALSE);
> 
>           SEM_RDFCTX_DR.BULK_LOAD_INTO_MODEL(L_MODARR(EI),L_USEDOPTS, 
>             IDXINFO.INDEXSCHEMA, STAGTAB || STAGTAB_SUFFIX, IDXINFO.INDEXPARTITION,
>             DOCURI2RID_NAMESQ, DOCVID2RID_NAMESQ, STAGTAB_VIEW_NAME, SYS_CONTEXT('USERENV','CURRENT_USER'), ROLES_AND_PRIVS);
> 
>           EXECUTE IMMEDIATE 
>               'DROP VIEW ' 
> 
>             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
>              ;
> 
>         END LOOP;
> 
>         EXCEPTION WHEN OTHERS THEN
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: step_num='||STEP_NUM||' SQLERRM='||SQLERRM, DEBUG_TRACE);
>         END;
> 
>       END IF;
> 
>       STEP_NUM := 9.5;
>       
>       
>       IF (IS_IDX_PARTITION) THEN
>         PARTI_CLAUSE := ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
>       END IF;
> 
>       INS_INTO_DOCVID := 
>       'INSERT /*+ append */ INTO ' || 
>       SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAMESQ) || PARTI_CLAUSE || ' (docVid, docRid) ' ||
>       ' select v.value_id,u2r.docrid ' || 
>       ' from ' || MDSYS.SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'rdf_value$ v, ' || 
>       SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAMESQ) || PARTI_CLAUSE || ' u2r ' ||
>       ' where v.vname_prefix = ' || 
>       '        sem_apis.value_name_prefix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'') ' || 
>       '   and v.value_type=''UR'' ' || 
>       '   and v.vname_suffix = ' || 
>       '        sem_apis.value_name_suffix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'')'
>       ;
>       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for IndexCreate: ins_into_docVid=' || INS_INTO_DOCVID, DEBUG_TRACE);
> 
>       EXECUTE IMMEDIATE INS_INTO_DOCVID;
> 
>       ROWS_APPENDED := SQL%ROWCOUNT;
>       COMMIT;        
> 
>       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for IndexCreate: inserted into ' || DOCVID2RID_NAME || ': rowcount=' || ROWS_APPENDED, DEBUG_TRACE);
> 
>       STEP_NUM := 9.8;
>       
>       IF (L_LOAD_METHOD != 'BULKLOAD' AND NOT(KEEP_RDFCTX_STAGING_TABLES)) THEN
>         SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
>         IF (IS_IDX_PARTITION) THEN
>           EXECUTE IMMEDIATE 
>             'ALTER TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' TRUNCATE PARTITION ' 
>           ||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE);
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'non-bulk-load: TRUNCATEd staging table ' || STAGTAB_NAME 
>           ||' partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE), DEBUG_TRACE);
>         ELSE 
>           EXECUTE IMMEDIATE 'delete from '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME);
>           COMMIT;
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF('non-bulk-load: DELETEd from staging table ' || STAGTAB_NAME, DEBUG_TRACE);
>         END IF;
>       END IF;
> 
>       STEP_NUM := 10;
>       RDF_APIS_INTERNAL.KSDWRF('starting step 10', DEBUG_TRACE);
>       
>       FOR PIDX IN 1 .. L_DEPPOL.COUNT LOOP
>         
>         
> 
>       RDF_APIS_INTERNAL.KSDWRF('** ODCI virtual model_internal$');
>         SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
>             ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>             POLICY_PARTNAME, NLS_UPPER(L_DEPPOL(PIDX))); 
>       END LOOP; 
> 
>       STEP_NUM := 11;
>       RDF_APIS_INTERNAL.KSDWRF('starting step 11', DEBUG_TRACE);
>       
>       SEM_RDFCTX_DR.SET_DEFAULT_POLICY(
>                    IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                    POLICY_PARTNAME, NLS_UPPER(L_DEFPOL)); 
>       COMMIT;
>     END IF;
> 
>     STEP_NUM := 12;
>     RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>     IF (IS_GLOBAL_IDX OR IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL) THEN
> 
>       STEP_NUM := 12.1;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>       
>       IF (NOT(KEEP_RDFCTX_STAGING_TABLES)) THEN
>         SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
>         MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: dropping staging table(s): ' || STAGTAB_NAME || '*', DEBUG_TRACE);
> 
>         
>         IF (L_LOAD_METHOD='BULKLOAD') THEN
>           FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>             STAGTAB_SUFFIX := 
>               SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
>             EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
>             MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>               'ODCIIndexCreate: dropped BULKLOAD staging table: '
>               || '(policy=' || NLS_UPPER(L_BASEPOL(EI) || ') ')
>               || STAGTAB_NAME || STAGTAB_SUFFIX, DEBUG_TRACE);
>             IF (XINFOTAB_NAME IS NOT NULL) THEN
>               EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(XINFOTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
>               MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>                 'ODCIIndexCreate: dropped xinfotab table: '
>                 || '(policy=' || NLS_UPPER(L_BASEPOL(EI) || ') ')
>                 || XINFOTAB_NAME || STAGTAB_SUFFIX, DEBUG_TRACE);
>             END IF;
>           END LOOP;
>         
>         ELSE
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'ODCIIndexCreate: non-bulk-load case: SKIPPED dropping the staging table: ' 
>           || STAGTAB_NAME, DEBUG_TRACE);
>         END IF;
>       END IF;
> 
>       STEP_NUM := 12.2;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>       
>       
>       IF (KEEP_RDFCTX_STAGING_TABLES) THEN
>         
>         
>         BEGIN
>           
>           IF (L_TBSNM IS NULL) THEN
>            SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
>             WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
>           END IF;
> 
>           DOCURI2RID_DEBUG := SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(SEM_RDFCTX_DR.GET_DOCURI2RID_DEBUG_NAME(IDXINFO.INDEXSCHEMA,DOCURI2RID_NAME));
>           STMT := 'CREATE TABLE ' || DOCURI2RID_DEBUG ||
>             ' (command VARCHAR2(100), partition VARCHAR2(128), snap_time TIMESTAMP, docUri VARCHAR2(4000), docRid ROWID) '
>             || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(L_TBSNM, FALSE);
>           RDF_APIS_INTERNAL.KSDWRF('creating debug table: stmt=' || STMT, DEBUG_TRACE);
> 
>           EXECUTE IMMEDIATE STMT;
>           EXCEPTION WHEN OTHERS THEN 
>             IF (SQLCODE != -942) THEN 
>               RDF_APIS_INTERNAL.KSDWRF('[Ignoring] SQLERRM=' || SQLERRM || ' [stmt=' || STMT || ']');
>             END IF;
>         END;
>         BEGIN
>           SNAP_TIME := SYSTIMESTAMP;
>           STMT := 
>             'INSERT INTO ' || DOCURI2RID_DEBUG || ' (command, partition, snap_time, docUri, docRid) ' ||
>             ' SELECT :cmd, :parti, :snap_time, docUri, docRid ' ||
>             ' FROM ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || PARTI_CLAUSE
>             ;
>           RDF_APIS_INTERNAL.KSDWRF('inserting into debug table: (' || SNAP_TIME || ') stmt=' || STMT, DEBUG_TRACE);
> 
>           EXECUTE IMMEDIATE STMT USING 'CREATE INDEX', IDXINFO.INDEXPARTITION, SNAP_TIME;
>           EXCEPTION WHEN OTHERS THEN 
>             RDF_APIS_INTERNAL.KSDWRF('[Ignoring] SQLERRM=' || SQLERRM || ' [stmt=' || STMT || ']');
>         END;
>       END IF;
>       EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' PURGE';
> 
>       
>       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, DOCURI2RID, DOCVID2RID);
>       SEM_RDFCTX_IR.CREATE_MAPTABLE_INDEXES(IDXINFO.INDEXSCHEMA, DOCVID2RID, NOT(IS_GLOBAL_IDX));
>                                             
>     END IF; 
> 
>     STEP_NUM := 13;
>     RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>     IF (IS_ADD_PARTITION) THEN
>       STEP_NUM := 13.1;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>      
>       SEM_RDFCTX_DR.SET_DEFAULT_POLICY(
>                    IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                    POLICY_PARTNAME, NLS_UPPER(L_DEFPOL));
> 
>       STEP_NUM := 13.2;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>       
>       EXECUTE IMMEDIATE 'alter table ' || 
>                          SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAMESQ) ||
>                         ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE);
>       STEP_NUM := 13.3;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>       EXECUTE IMMEDIATE 'alter table ' || 
>                          SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) ||
>                         ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE);
>       STEP_NUM := 13.4;
>       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
>       COMMIT; 
>     END IF;
> 
>     RDF_APIS_INTERNAL.KSDWRF('returning from ODCIIndexCreate', DEBUG_TRACE);
>     RETURNVAL:= ODCICONST.SUCCESS;
>     RETURN;
>   EXCEPTION WHEN OTHERS THEN 
>     MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: RAISING: step_num=' || STEP_NUM ||
>       CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK ||
>       CHR(10) || '[' || CHR(10)|| DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || CHR(10) || ']' || 
>       CHR(10) || 'stmt=' || CHR(10) || STMT
>     );
>     RAISE; 
>   END ODCIINDEXCREATE_PR; 
> 
>   PROCEDURE ODCIINDEXDROP_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     STAGTAB_NAME    VARCHAR2(270);
>     STAGVIEW_NAME   VARCHAR2(270);
>     DUMMY_XINFOTAB_NAME   VARCHAR2(270);
>     
>     DOCURI2RID_NAME    VARCHAR2(270);
>     DOCVID2RID_NAME    VARCHAR2(270);
>     ROLES_AND_PRIVS    VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
> 
>     COMMIT; 
> 
> 
> 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, 
>                        DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>     
>     IF (IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) THEN
>       SEM_RDFCTX_DR.DROP_RDFCTX_INDEX (ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,   
>                                      IDXINFO.INDEXNAME, IDXINFO.INDEXNAME);
>     ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>        SEM_RDFCTX_DR.DROP_RDFCTX_INDEX (ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,   
>                                      IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION);
>        BEGIN
>        EXECUTE IMMEDIATE 'alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                    || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
>                    || ' update indexes';
>        EXCEPTION
>          WHEN OTHERS THEN
>            IF (SQLCODE = -14083) THEN
>              EXECUTE IMMEDIATE 
>                'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || ' purge';
>            ELSE
>              RAISE;
>            END IF;
>        END;
>        
>     END IF;
>     COMMIT;
> 
>     
>     IF ((IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) OR
>          (IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL)) THEN
>       SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                                      NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
>       BEGIN
>          COMMIT;
>          EXECUTE IMMEDIATE 
>            'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' purge';
>          COMMIT;
>       EXCEPTION WHEN OTHERS THEN
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>            'error dropping staging table: ' || STAGTAB_NAME
>          ||': ' || SQLERRM
>          ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
>       END;
> 
>       
>       BEGIN
>         EXECUTE IMMEDIATE 
>           'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' purge';
>         EXCEPTION WHEN OTHERS THEN 
>         IF (SQLCODE != -942) THEN
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'error dropping docUri2Rid mapping table:' || DOCURI2RID_NAME
>           ||': ' || SQLERRM
>           ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
>         END IF;
>       END;
> 
>       BEGIN
>         EXECUTE IMMEDIATE 
>           'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || ' purge';
>         EXCEPTION WHEN OTHERS THEN 
>         IF (SQLCODE != -942) THEN
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'error dropping docVid2Rid mapping table:' || DOCVID2RID_NAME
>           ||': ' || SQLERRM
>           ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
>         END IF;
>       END;
> 
>     END IF;
>     RETURNVAL := ODCICONST.SUCCESS;
>   END ODCIINDEXDROP_PR; 
> 
> 
>   PROCEDURE ODCIINDEXALTER_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXPARMS    IN OUT VARCHAR2,
>            ALTOPT      NUMBER,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_DUMVR          VARCHAR2(300);
>     L_POLLST         SYS.ODCIVARCHAR2LIST;
>     L_USEDOPTS       SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
>     L_EXTRPARAMS     SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
>     L_ROWCNT         NUMBER;
>     L_LOAD_METHOD    VARCHAR2(128) := 'DML';
>     L_DEFPOL         VARCHAR2(130);
>     L_BASEPOL        SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
>     L_BATCHPOL       SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
>     L_BATCHPOL_COUNT PLS_INTEGER;
>     L_DEPPOL         SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
>     L_FLAGS          SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_TBSNM          VARCHAR2(130);
>     STAGTAB_NAME     VARCHAR2(270);
>     STAGVIEW_NAME    VARCHAR2(270);
>     XINFOTAB_NAME    VARCHAR2(270);
>     STAGTAB_SUFFIX   VARCHAR2(128);
>     DOCURI2RID_NAME  VARCHAR2(270);
>     DOCURI2RID       VARCHAR2(128);
>     DOCVID2RID_NAME  VARCHAR2(270);
>     DOCVID2RID       VARCHAR2(128);
>     L_MODARR         SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_EXTARR         MDSYS.T_EXTARR := MDSYS.T_EXTARR();
>     L_POLRIDS        SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
>     L_CTXPREF        FN_XMLPREF := FN_XMLPREF();
>     L_ERRCNT         SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     T_EXTARR         FN_EXTARR := FN_EXTARR();
>     FILTERPL         VARCHAR2(130) := NULL;
>     FILEDIR          VARCHAR2(512) := NULL;
>     STATUS           NUMBER;
>     PARTI_CLAUSE     VARCHAR2(1000) := NULL;
>     INS_INTO_DOCVID  VARCHAR2(4000);
>     PARTI_DETAILS    VARCHAR2(1000);
>     STAGTAB          VARCHAR2(130);
>     STAGVIEW         VARCHAR2(130);
>     XINFOTAB         VARCHAR2(130);
>     STAGTAB_VIEW_NAME        VARCHAR2(128);
>     STAGTAB_PART_VIEW_NAME   VARCHAR2(128) := NULL;
>     IS_PARTITION_REBLD   BOOLEAN := FALSE;
>     ADD_POLICY       BOOLEAN := FALSE;
>     DROP_POLICY      BOOLEAN := FALSE;
>     PLAIN_REBUILD    BOOLEAN := FALSE;
>     REBUILD_POLICY   BOOLEAN := FALSE;
>     PARTITION_NAME   VARCHAR2(130);
>     STMT             VARCHAR2(32767);
>     CNT              NUMBER;
>     IS_PARTN_TBL     NUMBER;
>     IS_DEP_POLICY    BOOLEAN := FALSE;
>     POLICY_EXISTS    BOOLEAN := FALSE;
> 
>     ROLES_AND_PRIVS  VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
> 
>     L_BATCH          BOOLEAN := FALSE;
>     BATCH_INTERFACE_OPTION CONSTANT VARCHAR2(100) := 'INTERFACE=BATCH';
> 
>     STEP_NUM         NUMBER := 0;
>     ROWS_APPENDED    NUMBER;
>     POL_OPTIONS      NUMBER := 0;
> 
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     COMMIT; 
>     
>     
>     
> 
> 
>     
>     
>     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>     
> 
>     IF (ALTOPT = SYS.ODCICONST.ALTERINDEXREBUILD) THEN
> 
>       
>       
>       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, 
>                                      DOCURI2RID, DOCVID2RID);
> 
>       SELECT COUNT(*) INTO CNT FROM SYS.USER_TABLES WHERE TABLE_NAME=DOCVID2RID;
>       RDF_APIS_INTERNAL.KSDWRF('count(*)=' || CNT || ' for table=' || DOCVID2RID, DEBUG_TRACE);
>       IF (CNT=0) THEN SEM_RDFCTX_IR.CREATE_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID); END IF;
> 
>       
>       IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>          IS_PARTITION_REBLD := TRUE;
>          PARTITION_NAME := IDXINFO.INDEXPARTITION;
>       ELSE
>          PARTITION_NAME := IDXINFO.INDEXNAME;
>       END IF;
>         
>       
>       BEGIN
>         L_DUMVR := SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXNAME,FALSE);
>       EXCEPTION
>         WHEN OTHERS THEN
>           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                   'invalid name for the index');
>        
>       END;
> 
>       
>       IF (IDXPARMS IS NOT NULL) THEN
>         BEGIN
>           L_POLLST := SEM_RDFCTX_DR.PRVT_PARAMS_PARSER(IDXPARMS, L_USEDOPTS, L_EXTRPARAMS); 
>         EXCEPTION 
>           WHEN OTHERS THEN 
>             EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
>                                ''invalid or empty parameters passed to the index'')';
>             RETURNVAL := SYS.ODCICONST.WARNING;
>             RETURN;
>         END; 
> 
>         SELECT COUNT(DISTINCT(COLUMN_VALUE)) INTO L_ROWCNT FROM TABLE(L_POLLST); 
>  
>         
>         FOR OPT IN (SELECT DISTINCT COLUMN_VALUE FROM TABLE(L_USEDOPTS)) LOOP
>           RDF_APIS_INTERNAL.KSDWRF('AlterIndexRebuild option=' || OPT.COLUMN_VALUE || '*', DEBUG_TRACE);
>           IF (TRIM(OPT.COLUMN_VALUE) = 'LOAD_METHOD=BULK') THEN 
>             L_LOAD_METHOD := 'BULKLOAD'; 
>             RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
>           ELSIF (TRIM(OPT.COLUMN_VALUE) = BATCH_INTERFACE_OPTION) THEN
>             L_LOAD_METHOD := 'BULKLOAD';
>             L_BATCH := TRUE;
>             RDF_APIS_INTERNAL.KSDWRF('rebuild: interface=BATCH', DEBUG_TRACE);
>             RDF_APIS_INTERNAL.KSDWRF('rebuild: l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
>           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'ADD_POLICY') THEN
>             ADD_POLICY := TRUE;
>             POL_OPTIONS := POL_OPTIONS + 1;
>           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'DROP_POLICY') THEN
>             DROP_POLICY := TRUE;
>             POL_OPTIONS := POL_OPTIONS + 1;
>           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'REBUILD_POLICY') THEN
>             REBUILD_POLICY := TRUE;
>             POL_OPTIONS := POL_OPTIONS + 1;
>           END IF;
>         END LOOP;
> 
>         
>         IF (POL_OPTIONS > 1) THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>             ''cannot ADD/DROP/REBUILD policies for the index at the same time'')';
>           RETURNVAL:= SYS.ODCICONST.WARNING;
>           RETURN;
>         END IF;
> 
>         
>         IF ((ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY) AND (L_POLLST.COUNT > 1)) THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>             '' cannot ADD OR DROP OR REBUILD multiple policies for the index at the same time'')';
>           RETURNVAL := SYS.ODCICONST.WARNING;
> 	  RETURN;
>         END IF;
> 
>         
>         IF ((ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY) AND (L_POLLST.COUNT = 0 )) THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>             '' policy name needs to be specified for  ADD OR DROP OR REBUILD policy'')';
>           RETURNVAL:= SYS.ODCICONST.WARNING;
>    	  RETURN;
>         END IF;
> 
>         
>         IF (NOT(ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY)) THEN
>           IF (L_POLLST.COUNT > 0) THEN
>             EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>               ''Cannot specify new policies during rebuild'')';
>             RETURNVAL:= SYS.ODCICONST.WARNING;
> 	    RETURN;
>           ELSE
>             PLAIN_REBUILD := TRUE;
>           END IF;
>         END IF;
>       ELSE
>         
>         PLAIN_REBUILD := TRUE;  
>       END IF;
> 
>       IF (PLAIN_REBUILD) THEN
>           
>           L_CTXPREF.EXTEND;
>           SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                          PARTITION_NAME, L_POLRIDS, L_MODARR,
>                                          L_EXTARR, L_CTXPREF(1), L_BASEPOL,
>                                          L_EXTRPARAMS, L_FLAGS);
>  
>           
>           SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                               PARTITION_NAME);
>       END IF;
> 
>       
>       IF (REBUILD_POLICY) THEN
>         
>         L_EXTARR.EXTEND;
>         L_POLRIDS.EXTEND; 
>         L_CTXPREF.EXTEND;
>         L_MODARR.EXTEND;
>         L_BASEPOL.EXTEND;
>        
>         
>         BEGIN
>           L_MODARR(1) := SEM_RDFCTX_DR.GET_MODEL_ID(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, PARTITION_NAME, NLS_UPPER(L_POLLST(1)));
>         EXCEPTION
>           WHEN OTHERS THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>                   ''the specified index-policy combination does not exist'')';
> 
>           RETURNVAL:= SYS.ODCICONST.WARNING;
> 	  RETURN;
>         END;
> 
>         
>         IF (L_MODARR(1) < 0) THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>                   ''cannot REBUILD a dependent policy for the index with the rebuild_policy option'')';
> 
>           RETURNVAL:= SYS.ODCICONST.WARNING;
> 	  RETURN;
>         END IF;
>         
>         L_BASEPOL(1) := L_POLLST(1);
>         SEM_RDFCTX_DR.GET_POLICY_INFO (
>                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(1)),
>                       L_POLRIDS(1), L_EXTARR(1), L_CTXPREF(1));
> 
>         
>         SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                               PARTITION_NAME, L_POLRIDS(1));
>         
>       END IF;
>  
>       
>       IF (DROP_POLICY) THEN
>         SEM_RDFCTX_DR.DROP_INDEX_POLICY(SDO_RDF.GET_ROLES_AND_PRIVS(), IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                         PARTITION_NAME, NLS_UPPER(L_POLLST(1)), STATUS);
>         IF (STATUS != 0) THEN
>           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>               ''Specified policy could not be dropped for the index'')';
>             RETURNVAL:= SYS.ODCICONST.WARNING;
> 	    RETURN;
>         END IF;
>       ELSE      
>          SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                                         IDXINFO.INDEXPARTITION, TRUE, STAGTAB_NAME, STAGVIEW_NAME
>                                        ,XINFOTAB_NAME,L_BATCH
>                                         );
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Staging table during rebuild : '||STAGTAB_NAME, DEBUG_TRACE);
>          
>          SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, 
>                                         DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('DocUri2Rid table during rebuild: ' || DOCURI2RID_NAME, DEBUG_TRACE);
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('DocVid2Rid table during rebuild: ' || DOCVID2RID_NAME, DEBUG_TRACE);
>          
>          IF (IDXINFO.INDEXPARTITION IS NULL) THEN
>            EXECUTE IMMEDIATE 'truncate table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME);
>          ELSE
>            EXECUTE IMMEDIATE 
>                     ' alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                     || ' truncate partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
>                     || ' update indexes';
>          END IF;
>          
>          
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>          SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
>               WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
> 
>          IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>            PARTI_DETAILS := 'partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(L_TBSNM, FALSE);
>          END IF;
> 
>          
>          
>          IF ((L_LOAD_METHOD != 'BULKLOAD') AND (IDXINFO.INDEXPARTITION IS NOT NULL)) THEN
>            SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME, NULL, NULL, PARTI_DETAILS, FALSE);
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('rebuild: created staging table ' || STAGTAB_NAME || PARTI_DETAILS, DEBUG_TRACE);
>          END IF;
>         
>          IF (ADD_POLICY) THEN
>            
>            L_EXTARR.EXTEND;
>            L_POLRIDS.EXTEND; 
>            L_CTXPREF.EXTEND;
>            L_MODARR.EXTEND;
> 
>            BEGIN
>              SEM_RDFCTX_DR.SPLIT_POLICY_LIST(IDXINFO.INDEXSCHEMA, L_POLLST,
>                             L_BASEPOL, L_DEPPOL);
>            EXCEPTION
>              WHEN OTHERS THEN
>                IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>                  EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
>                END IF;
>                EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>                     ''cannot add a non-existent policy to the index'')';
>                RETURNVAL:= SYS.ODCICONST.WARNING;
> 	       RETURN;
>            END;
> 
>            
>            POLICY_EXISTS := SEM_RDFCTX_DR.IS_INDEX_POLICY(IDXINFO.INDEXSCHEMA, 
>                                IDXINFO.INDEXNAME,PARTITION_NAME, L_BASEPOL(1));
> 
>            IF (ADD_POLICY AND POLICY_EXISTS AND (L_DEPPOL.COUNT = 0)) THEN
>              
>              
>              EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
>                   ''cannot ADD an already existing policy to the index'')';
> 
>              IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>                EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
>              END IF;
>              RETURNVAL:= SYS.ODCICONST.WARNING;
> 	     RETURN;
>            END IF;
> 
>            
>            
>            IF (NOT POLICY_EXISTS) THEN
>              SEM_RDFCTX_DR.GET_POLICY_INFO (
>                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(1)),
>                       L_POLRIDS(1), L_EXTARR(1), L_CTXPREF(1));
> 
>              L_MODARR(1) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA,
>                              IDXINFO.INDEXNAME, PARTITION_NAME, L_POLRIDS(1),
>                              SEM_RDFCTX_DR.INDST_INPROGRESS, L_TBSNM, L_EXTRPARAMS(1));
>            END IF;
>          END IF;
> 
>          IF (L_CTXPREF(1) IS NOT NULL AND 
>                  L_CTXPREF(1).EXTRACT('//Datastore') IS NULL) THEN 
>            L_CTXPREF(1) := NULL; 
>          ELSIF (L_CTXPREF(1) IS NOT NULL AND 
>                  NLS_UPPER(L_CTXPREF(1).EXTRACT('//Datastore/@type').GETSTRINGVAL())
>                                                             = 'FILE') THEN 
>            FILEDIR := TRIM(L_CTXPREF(1).EXTRACT(
>                           '//Datastore/Path/text()').GETSTRINGVAL());
>            SELECT COUNT(*) INTO L_ROWCNT FROM SYS.ALL_DIRECTORIES WHERE 
>                DIRECTORY_NAME = FILEDIR; 
>            IF (L_ROWCNT = 0) THEN 
>              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                 'directory object '||FILEDIR||' does not exist or is inaccessible'); 
>            END IF; 
>          END IF; 
> 
>          
>          IF (NOT POLICY_EXISTS) THEN
>          L_BATCHPOL_COUNT := 0;
>          FOR PIDX IN 1..L_EXTARR.COUNT LOOP
>            T_EXTARR.EXTEND;
>            L_ERRCNT.EXTEND;
>            L_ERRCNT(PIDX) := 0;
>            L_BATCHPOL.EXTEND; 
>            L_BATCHPOL(PIDX) := 0;
> 
>            
>            IF (XINFOTAB_NAME IS NOT NULL) THEN
>              IF NLS_UPPER(L_EXTARR(PIDX).GETCONTEXT(BATCH_INTERFACE_OPTION)) IN ('YES','Y') THEN
>                L_BATCHPOL(PIDX) := 1;
>                L_BATCHPOL_COUNT := L_BATCHPOL_COUNT + 1;
>              END IF;
>            END IF;
> 
>            
>            IF (L_LOAD_METHOD = 'BULKLOAD') THEN
>              STAGTAB_SUFFIX := 
>                SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(PIDX)),L_POLRIDS(PIDX));
>              IF (IDXINFO.INDEXPARTITION IS NULL) THEN
>                SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,L_TBSNM,STAGTAB_SUFFIX, NULL,FALSE, XINFOTAB_NAME);
>              ELSE
>                SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,STAGTAB_SUFFIX, PARTI_DETAILS,FALSE, XINFOTAB_NAME);
>              END IF;
>            END IF;  
> 
>            T_EXTARR(PIDX) := L_EXTARR(PIDX);
> 
>            
>            L_EXTARR(PIDX).STARTDRIVER();       
>          
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Extraction driver started in Alter', DEBUG_TRACE);
>          END LOOP;  
> 
>          IF (L_CTXPREF(1) IS NOT NULL) THEN 
>            IF (IDXINFO.INDEXCOLS(1).COLTYPENAME != 'VARCHAR2') THEN 
>              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                'FILE/URL datastores only allowed with VARCHAR2 columns'); 
>            END IF; 
>            IF (L_CTXPREF(1).EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
>              FILTERPL := NLS_UPPER(L_CTXPREF(1).EXTRACT(
>                                     '//Datastore/@filter').GETSTRINGVAL()); 
>            END IF; 
>          END IF;
> 
>          
>          
>            IF (IDXINFO.INDEXPARTITION IS NULL) THEN
>              SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME, NULL, L_TBSNM, NULL);
>            ELSE
>              SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME, NULL, NULL, PARTI_DETAILS);
>            END IF;
>          
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('initial setup done for rebuilding index', DEBUG_TRACE);
> 
>          SEM_RDFCTX_IR.POPULATE_INDEX_SEGMENT(
>            IDXINFO, FILEDIR, FILTERPL, L_BASEPOL, L_EXTRPARAMS, L_CTXPREF, T_EXTARR, L_MODARR, L_POLRIDS
>          , L_LOAD_METHOD, STAGTAB_NAME, DOCURI2RID_NAME, DOCVID2RID_NAME
>          , XINFOTAB_NAME, L_BATCHPOL, L_BATCHPOL_COUNT);
> 
>          FOR EI IN 1..L_BASEPOL.COUNT LOOP
>            
>            SEM_RDFCTX_DR.SET_RDFCTX_INDEX_STATUS_VALID(
>                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                  PARTITION_NAME, L_MODARR(EI));
>  
>            
>            L_EXTARR(EI).CLOSEDRIVER();      
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Extraction driver closed in Alter', DEBUG_TRACE);
>          END LOOP;
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter', DEBUG_TRACE);
>          IF (L_LOAD_METHOD = 'BULKLOAD') THEN
>            BEGIN
>              SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                                             IDXINFO.INDEXPARTITION, FALSE, STAGTAB, STAGVIEW
>                                            ,XINFOTAB, L_BATCH);
> 
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('staging table for bulkload during index rebuild : ' ||STAGTAB, DEBUG_TRACE);
>              FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>                MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing during index rebuild', DEBUG_TRACE);
>                STAGTAB_SUFFIX := SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
>                MDSYS.RDF_APIS_INTERNAL.KSDWRF('staging table suffix for bulkload during index rebuild : ' ||STAGTAB_SUFFIX, DEBUG_TRACE);
> 
>                IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>                  PARTI_CLAUSE :=  ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
>                  
>                  SEM_RDFCTX_DR.GET_STAGTAB_PART_VIEW_NAME(
>                      IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, FALSE,
>                       STAGTAB, TRUE, STAGTAB_PART_VIEW_NAME);
>                  STAGTAB_VIEW_NAME := STAGTAB_PART_VIEW_NAME;
>                ELSE
>                  STAGTAB_VIEW_NAME := STAGVIEW || STAGTAB_SUFFIX;
>                END IF;
> 
>                EXECUTE IMMEDIATE 
>                     'CREATE or REPLACE VIEW ' 
>                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME , FALSE)
>                   ||' AS SELECT RDF$STC_GRAPH,RDF$STC_SUB,RDF$STC_PRED,RDF$STC_OBJ FROM ' 
>                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB || STAGTAB_SUFFIX, FALSE) 
>                   || PARTI_CLAUSE
>                   ||' WHERE RDF$STC_OBJ IS NOT NULL'
>                    ;
>                EXECUTE IMMEDIATE 
>                     'GRANT SELECT ON ' 
>                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
>                   ||' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(), FALSE);
> 
>                MDSYS.RDF_APIS_INTERNAL.KSDWRF('About to start BULKLOAD in Alter', DEBUG_TRACE);
>                SEM_RDFCTX_DR.BULK_LOAD_INTO_MODEL(L_MODARR(EI),L_USEDOPTS, 
>                     IDXINFO.INDEXSCHEMA, STAGTAB || STAGTAB_SUFFIX, IDXINFO.INDEXPARTITION,
>                     DOCURI2RID_NAME, DOCVID2RID_NAME, STAGTAB_VIEW_NAME, SYS_CONTEXT('USERENV','CURRENT_USER'), ROLES_AND_PRIVS);
> 
>                  EXECUTE IMMEDIATE 
>                     'DROP VIEW ' 
>                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
>                  ;
> 
>              END LOOP;
> 
>              EXCEPTION WHEN OTHERS THEN
>               MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: SQLERRM='||SQLERRM);
>            END;
>          END IF; 
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: populate docVid2Rid table: ' || DOCVID2RID_NAME, DEBUG_TRACE);
>          BEGIN
>          
>          IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>            PARTI_CLAUSE :=  ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
>          END IF;
> 
>          INS_INTO_DOCVID := 
>            'INSERT /*+ append */ INTO ' || 
>             SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || PARTI_CLAUSE || ' (docVid, docRid) ' ||
>             ' select v.value_id,u2r.docrid ' || 
>             ' from ' || MDSYS.SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'rdf_value$ v, ' || 
>             SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || PARTI_CLAUSE || ' u2r ' ||
>             ' where v.vname_prefix = ' || 
>             '        sem_apis.value_name_prefix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'') ' || 
>             '   and v.value_type=''UR'' ' || 
>             '   and v.vname_suffix = ' || 
>             '        sem_apis.value_name_suffix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'')'
>             ;
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: ins_into_docVid=' || INS_INTO_DOCVID, DEBUG_TRACE);
> 
>          EXECUTE IMMEDIATE INS_INTO_DOCVID;
> 
>          ROWS_APPENDED := SQL%ROWCOUNT;
>          COMMIT;        
> 
>          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: inserted into ' || DOCVID2RID_NAME 
>            || ': rowcount=' || ROWS_APPENDED, DEBUG_TRACE);
> 
>          EXCEPTION WHEN OTHERS THEN
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('IndexAlter postprocessing: issuing: ins_into_docVid=' 
>              || INS_INTO_DOCVID
>              || ' SQLERRM='||SQLERRM);
>          END;
> 
>          END IF; 
> 
>          IF (ADD_POLICY AND L_DEPPOL.COUNT != 0) THEN
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Adding the dependent policy during Alter', DEBUG_TRACE);
>            SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
>                   ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                   PARTITION_NAME, NLS_UPPER(L_DEPPOL(1)));
>          END IF;
> 
>          
>          IF (PLAIN_REBUILD) THEN
>            SEM_RDFCTX_DR.GET_DEP_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                               PARTITION_NAME, L_DEPPOL);
>            IF (L_DEPPOL IS NOT NULL AND L_DEPPOL.COUNT > 0) THEN
>              FOR PIDX IN 1 .. L_DEPPOL.COUNT LOOP
>                
>                
>                MDSYS.RDF_APIS_INTERNAL.KSDWRF('Adding the dependent policy during Rebuild', DEBUG_TRACE);
>                SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
>                   ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                   PARTITION_NAME, NLS_UPPER(L_DEPPOL(PIDX))); 
>              END LOOP;
>            END IF;
>          END IF;
> 
>          COMMIT;
> 
>          STEP_NUM := 9;
>          
>          IF (L_LOAD_METHOD = 'BULKLOAD' AND (NOT POLICY_EXISTS)) THEN
>            FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
>              STAGTAB_SUFFIX := SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
>              EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexAlter: dropped BULKLOAD staging table: ' 
>              || 'DROP TABLE ' || STAGTAB_NAME || STAGTAB_SUFFIX || ' PURGE', DEBUG_TRACE);
>            END LOOP;
>          ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
>            EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
>          END IF;
> 
>          STEP_NUM := 10;
>          
>          STMT :=  'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' PURGE';
>          BEGIN
>            EXECUTE IMMEDIATE STMT;
>            EXCEPTION WHEN OTHERS THEN
>              MDSYS.RDF_APIS_INTERNAL.KSDWRF('Failed during ODCIIndexAlter: step_num=' || STEP_NUM || ' stmt=' || STMT);
>          END;
> 
>       END IF; 
>     ELSE
>       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>           'ALTER INDEX (other than rebuild partition not supported for RDFCTX indexes'); 
>     END IF; 
>     RETURNVAL:= ODCICONST.SUCCESS;
>     RETURN;
> 
>     EXCEPTION WHEN OTHERS THEN
>       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Failed during ODCIIndexAlter: step_num=' 
>         || STEP_NUM || ' stmt=' || STMT || ' SQLERRM=' || SQLERRM);
>       RETURNVAL:= ODCICONST.SUCCESS;
>       RETURN;
>   END ODCIINDEXALTER_PR; 
> 
> 
>   PROCEDURE ODCIINDEXTRUNCATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     DOCURI2RID_NAME    VARCHAR2(270);
>     DOCVID2RID_NAME    VARCHAR2(270);
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN 
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     COMMIT; 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
>                                    DOCVID2RID_NAME);
> 
>     IF (IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) THEN
>       SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX (IDXINFO.INDEXSCHEMA,   
>                                          IDXINFO.INDEXNAME, IDXINFO.INDEXNAME);
>       EXECUTE IMMEDIATE 'truncate table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME);
>     ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN 
>       SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX (IDXINFO.INDEXSCHEMA,   
>                                          IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION);
>    
>       EXECUTE IMMEDIATE ' alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                          || ' truncate partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) 
>                          || ' update indexes';
>     END IF;
> 
>     COMMIT; 
>     RETURNVAL:= ODCICONST.SUCCESS;
>   END ODCIINDEXTRUNCATE_PR; 
> 
> 
>   PROCEDURE ODCIINDEXMERGEPARTITION_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            PART1_NAME  SYS.ODCIPARTINFO,
>            PART2_NAME  SYS.ODCIPARTINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
>     L_MODIDX   SYS.ODCINUMBERLIST;
>     L_EXTARR   MDSYS.T_EXTARR;
>     L_EXTPREF  SYS.XMLTYPE;
>     L_TBSNM    VARCHAR2(128);
>     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     L_MODARR   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_FLAGS    SYS.ODCINUMBERLIST;
>     DOCURI2RID_NAME    VARCHAR2(270);
>     DOCVID2RID_NAME    VARCHAR2(270);
>     STAGTAB_NAME       VARCHAR2(270);
>     STAGVIEW_NAME      VARCHAR2(270);
>     L_POLNAMES SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     ROLES_AND_PRIVS     VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE,
>                                     STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
>                                      DOCVID2RID_NAME);
>     IF (PART2_NAME IS NOT NULL) AND (IDXINFO.INDEXPARTITION IS NOT NULL) AND
>        (PART1_NAME IS NOT NULL) THEN
>       
>       
>       L_TBSNM := SDO_RDF_INTERNAL.GET_CALLCONTEXT_VC_ATTR('VALUES_TABLESPACE');
> 
>       
>       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                        IDXINFO.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
>                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
> 
>       FOR EI IN 1..L_EXTARR.COUNT LOOP
>         L_MODARR.EXTEND;
>         
>         L_MODARR(EI) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
>                           IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                           PART2_NAME.INDEXPARTITION, L_POLRIDS(EI), 
>                           L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
> 
>          
>          SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
>                                       IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, L_POLRIDS(EI));
> 
>       END LOOP;
> 
>       
>       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                        PART1_NAME.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
>                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
> 
>       FOR EI IN 1..L_EXTARR.COUNT LOOP     
>          
>          
>          SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
>                                      IDXINFO.INDEXNAME, PART1_NAME.INDEXPARTITION, L_POLRIDS(EI));
>       END LOOP;
> 
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                         || ' merge partitions ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ',' 
>                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE) || ' into partition ' 
>                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE) || ' update indexes';
> 
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
>                         || ' merge partitions ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ',' 
>                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE) || ' into partition ' 
>                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE) || ' update indexes';
>     END IF;
>     RETURNVAL := SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXMERGEPARTITION_PR;
> 
> 
>   PROCEDURE ODCIINDEXSPLITPARTITION_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            PART1_NAME  SYS.ODCIPARTINFO,
>            PART2_NAME  SYS.ODCIPARTINFO,
>            IDXPARMS    VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     L_POLRIDS   SYS.ODCIVARCHAR2LIST;
>     L_MODIDX    SYS.ODCINUMBERLIST;
>     L_EXTARR    MDSYS.T_EXTARR;
>     L_EXTPREF   SYS.XMLTYPE;
>     L_TBSNM     VARCHAR2(128);
>     L_MODARR    SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     L_FLAGS      SYS.ODCINUMBERLIST;
>     PIDX        NUMBER := 0;
>     DOCURI2RID_NAME    VARCHAR2(270);
>     DOCVID2RID_NAME    VARCHAR2(270);
>     STAGTAB_NAME       VARCHAR2(270);
>     STAGVIEW_NAME      VARCHAR2(270);
>     L_POLNAMES SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     ROLES_AND_PRIVS     VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE,
>                                     STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
>                                      DOCVID2RID_NAME);
> 
>     IF (PART1_NAME IS NOT NULL AND PART2_NAME IS NOT NULL ) THEN
>       
>       
>       L_TBSNM := SDO_RDF_INTERNAL.GET_CALLCONTEXT_VC_ATTR('VALUES_TABLESPACE');
> 
>       
>       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                        IDXINFO.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
>                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
> 
>       FOR EI IN 1..L_EXTARR.COUNT LOOP
>         L_MODARR.EXTEND;
>         PIDX := PIDX + 1;
>         
>         L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
>                                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                                  PART1_NAME.INDEXPARTITION, L_POLRIDS(EI), 
>                                  L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
> 
>         L_MODARR.EXTEND;
>         PIDX := PIDX + 1;
>         L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
>                                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
>                                  PART2_NAME.INDEXPARTITION, L_POLRIDS(EI), 
>                                  L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
> 
>         
>         SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
>                                       IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, L_POLRIDS(EI));
>       END LOOP;
>       COMMIT;
> 
>       
>       
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE);
>       COMMIT;
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
>                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE);
>       COMMIT;
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE);
>       COMMIT;
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
>                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE);
>       COMMIT;
> 
>       
>       
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                          || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' update indexes';
>       COMMIT;
>       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
>                          || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' update indexes';
>       COMMIT;
>     END IF;
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXSPLITPARTITION_PR;
> 
> 
>   PROCEDURE ODCIINDEXEXCHANGEPARTITION_PR (
>            PA_IDXINFO  SYS.ODCIINDEXINFO,
>            IDXINFO     SYS.ODCIINDEXINFO,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     PL_POLRIDS   SYS.ODCIVARCHAR2LIST;
>     PL_MODIDX    SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     PL_EXTARR    MDSYS.T_EXTARR;
>     PL_EXTPREF   SYS.XMLTYPE;
>     PL_FLAGS     SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_POLRIDS    SYS.ODCIVARCHAR2LIST;
>     L_MODIDX     SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     L_EXTARR     MDSYS.T_EXTARR;
>     L_EXTPREF    SYS.XMLTYPE;
>     L_FLAGS      SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     DOCURI2RID_PNAME    VARCHAR2(270);
>     DOCVID2RID_PNAME    VARCHAR2(270);
>     DOCURI2RID_NAME     VARCHAR2(270);
>     DOCVID2RID_NAME     VARCHAR2(270);
>     PL_POLNAMES SYS.ODCIVARCHAR2LIST;
>     L_POLNAMES  SYS.ODCIVARCHAR2LIST;
>     PL_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS   SYS.ODCIVARCHAR2LIST;
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,TRUE,
>                                    DOCURI2RID_PNAME, DOCVID2RID_PNAME);
> 
>     
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
>                                    DOCVID2RID_NAME);
> 
>     
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,
>                                      PA_IDXINFO.INDEXPARTITION, PL_POLRIDS, PL_MODIDX,
>                                      PL_EXTARR, PL_EXTPREF, PL_POLNAMES, PL_EXTRPARAMS, PL_FLAGS);
> 
>     
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                      IDXINFO.INDEXNAME, L_POLRIDS, L_MODIDX,
>                                      L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
> 
>     
>     IF (PL_POLRIDS.COUNT != L_POLRIDS.COUNT) THEN
>       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>         'EXCHANGE INDEX PARTITION not supported for different number of index policies');  
>     ELSE
>       FOR I IN 1..PL_EXTARR.COUNT LOOP
>         FOR J IN 1..L_EXTARR.COUNT LOOP
>           IF (L_POLRIDS(J) = PL_POLRIDS(I)) THEN
>              EXIT;
>           ELSE
>             IF (L_POLRIDS(J) > PL_POLRIDS(I)) THEN
>               MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>                   'EXCHANGE INDEX PARTITION not supported for incompatible index policies'); 
>             END IF; 
>           END IF;
>         END LOOP;
>       END LOOP; 
>     END IF;
> 
>     
>     
>     
>     FOR I IN 1..PL_EXTARR.COUNT LOOP
> 
> 
> 
>       SEM_RDFCTX_DR.EXCHANGE_INDEX_POLICIES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,
>                                             PA_IDXINFO.INDEXPARTITION, PL_MODIDX(I),
>                                             IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
>                                             L_MODIDX(I));
>     END LOOP;
> 
>     
>     EXECUTE IMMEDIATE 'alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_PNAME)
>                       || ' exchange partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PA_IDXINFO.INDEXPARTITION, FALSE)
>                       || ' with table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                       || ' including indexes';
>     COMMIT;
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXEXCHANGEPARTITION_PR;
> 
> 
>   PROCEDURE ODCIINDEXINSERT_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            NEWVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
>     L_MODIDX   SYS.ODCINUMBERLIST; 
>     L_EXTARR   MDSYS.T_EXTARR; 
>     S_XMLRDF   CLOB; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     FILEDIR    VARCHAR2(4000) := NULL; 
>     L_NEWDOC   CLOB := NEWVAL; 
>     L_DUMN     NUMBER; 
>     FILTERPL   VARCHAR2(130) := NULL; 
>     STAGTAB    VARCHAR2(270);
>     STAGVIEW   VARCHAR2(270);
>     L_DOCURIPFX   VARCHAR2(4000);
>     L_DOCURISHORTPFX   VARCHAR2(500);
>     L_DOCURI      VARCHAR2(4000);
>     DOCVID2RID_NAME  VARCHAR2(270);
>     DOCURI2RID_NAME  VARCHAR2(270);
>     L_ROWCNT       CONSTANT NUMBER := 0;
>     L_ROWDESC VARCHAR2(50); 
>     L_POLNAMES SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     L_FLAGS      SYS.ODCINUMBERLIST;
> 
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     
> 
>     
>     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>     
> 
>     
>     IF (NEWVAL IS NULL) THEN 
>       RETURNVAL:= SYS.ODCICONST.SUCCESS;
>       RETURN;
>     END IF; 
> 
>     
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>     
>     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
>                       IDXINFO.INDEXSCHEMA
>                     , IDXINFO.INDEXNAME
>                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
>     RDF_APIS_INTERNAL.KSDWRF('index insert: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
> 
>     
>     
> 
>     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
>     L_DOCURI := '<' || 
>                       L_DOCURIPFX || 
>                       L_ROWDESC ||
>                       '>';
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,   
>                                      IDXINFO.INDEXNAME, 
>                                 (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS); 
> 
>     IF (L_EXTPREF IS NOT NULL) THEN 
>       IF (NLS_UPPER(L_EXTPREF.EXTRACT('//Datastore/@type').GETSTRINGVAL())
>                                                             = 'FILE') THEN
>         FILEDIR := TRIM(L_EXTPREF.EXTRACT(
>                    '//Datastore/Path/text()').GETSTRINGVAL());
>       END IF; 
>       IF (L_EXTPREF.EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
>         FILTERPL := NLS_UPPER(L_EXTPREF.EXTRACT(
>                                     '//Datastore/@filter').GETSTRINGVAL()); 
>       END IF; 
>       IF (FILEDIR IS NOT NULL) THEN 
>         
>         SEM_RDFCTX_IR.READ_FROM_FILE(FILEDIR, NEWVAL, L_NEWDOC, FILTERPL); 
>       ELSE 
>         SEM_RDFCTX_IR.READ_FROM_NTWRK(NEWVAL, L_NEWDOC, FILTERPL);
>       END IF; 
>     END IF; 
> 
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
>                                   ,DUMMY_XINFOTAB_NAME);
> 
>     
>     
>     
>     
> 
>     MDSYS.RDF_APIS_INTERNAL.KSDWRF('Staging table for indexInsert is ' || STAGTAB, DEBUG_TRACE);
>     
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>     BEGIN
>       L_EXTARR(EI).STARTDRIVER();
>       
>       IF (L_EXTRPARAMS(EI) IS NULL) THEN 
>         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC);
>       ELSE
>         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC,
>                                             L_EXTRPARAMS(EI));
>       END IF;
> 
>       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Done extracting data for the new document', DEBUG_TRACE);
>       L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(), 
>               S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
>               IDXINFO.INDEXPARTITION, RID); 
>       L_EXTARR(EI).CLOSEDRIVER();
> 
>       
>       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'INS');
>     EXCEPTION 
>        WHEN OTHERS THEN 
>         L_EXTARR(EI).CLOSEDRIVER();
>         IF (SQLCODE != -13199) THEN 
>           SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
>                                       SQLCODE, SQLERRM);
>         END IF; 
>         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>            'unable to maintain index. See exceptions table' ||
>            CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK ||
>            CHR(10) || '[' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || CHR(10) || ']'
>         ); 
>     END; 
>     END LOOP; 
> 
>     
>     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXINSERT_PR; 
> 
> 
>   PROCEDURE ODCIINDEXINSERT_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            NEWVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
>   	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
>     L_MODIDX   SYS.ODCINUMBERLIST; 
>     L_EXTARR   MDSYS.T_EXTARR; 
>     S_XMLRDF   CLOB; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     L_DUMN     NUMBER;
>     STAGTAB    VARCHAR2(270);
>     STAGVIEW   VARCHAR2(270);
>     L_DOCURIPFX   VARCHAR2(4000);
>     L_DOCURISHORTPFX   VARCHAR2(500);
>     L_DOCURI      VARCHAR2(4000);
>     DOCVID2RID_NAME  VARCHAR2(270);
>     DOCURI2RID_NAME  VARCHAR2(270);
>     L_ROWCNT       CONSTANT NUMBER := 0;
>     L_ROWDESC VARCHAR2(50); 
>     L_POLNAMES SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     L_FLAGS       SYS.ODCINUMBERLIST;
> 
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     
>     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>     
> 
>     
>     IF (NEWVAL IS NULL) THEN 
>       RETURNVAL:= SYS.ODCICONST.SUCCESS;
>       RETURN;
>     END IF; 
> 
>     
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>     
>     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
>                       IDXINFO.INDEXSCHEMA
>                     , IDXINFO.INDEXNAME
>                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
>     RDF_APIS_INTERNAL.KSDWRF('index insert: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
> 
>     
>     
> 
>     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
>     L_DOCURI := '<' || 
>                       L_DOCURIPFX || 
>                       L_ROWDESC ||
>                       '>';
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,   
>                                      IDXINFO.INDEXNAME, 
>                                      (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS); 
> 
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
>                                   ,DUMMY_XINFOTAB_NAME);
> 
>     
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>     BEGIN
>       L_EXTARR(EI).STARTDRIVER(); 
> 
>       IF (L_EXTRPARAMS(EI) IS NULL) THEN
>         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC); 
>       ELSE
>        S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC, 
>                                            L_EXTRPARAMS(EI));
>       END IF;
> 
>       L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(), 
>               S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
>               IDXINFO.INDEXPARTITION, RID); 
>       L_EXTARR(EI).CLOSEDRIVER();
> 
>       
>       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'INS');
>     EXCEPTION 
>        WHEN OTHERS THEN 
>         L_EXTARR(EI).CLOSEDRIVER();
>         IF (SQLCODE != -13199) THEN 
>           SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
>                                       SQLCODE, SQLERRM);
>         END IF; 
>         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>            'unable to maintain index. See exceptions table'); 
>     END; 
>     END LOOP; 
> 
>     
>     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXINSERT_PR; 
> 
> 
>   PROCEDURE ODCIINDEXDELETE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
>     L_MODIDX   SYS.ODCINUMBERLIST; 
>     L_EXTARR   MDSYS.T_EXTARR; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     DOCVID2RID_NAME   VARCHAR2(270);
>     DOCURI2RID_NAME   VARCHAR2(270);
>     L_POLNAMES SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     L_DOCVID          NUMBER;
>     L_FLAGS        SYS.ODCINUMBERLIST;
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
>                                      IDXINFO.INDEXNAME, 
>                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
>  
>     
>     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                       || ' where docRid = :1' INTO L_DOCVID USING RID;
> 
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
> 
>       
>       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'DEL');
>     END LOOP; 
> 
>     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                     || ' where docRid = :1' USING RID;
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXDELETE_PR; 
> 
> 
>   PROCEDURE ODCIINDEXDELETE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
>     L_MODIDX   SYS.ODCINUMBERLIST; 
>     L_EXTARR   MDSYS.T_EXTARR; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     DOCVID2RID_NAME   VARCHAR2(270);
>     DOCURI2RID_NAME   VARCHAR2(270);
>     L_POLNAMES    SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
>     L_DOCVID          NUMBER;
>     L_FLAGS           SYS.ODCINUMBERLIST;
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
>                                      IDXINFO.INDEXNAME, 
>                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
>  
>     
>     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                       || ' where docRid = :1' INTO L_DOCVID USING RID;
> 
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
> 
>       
>       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'DEL');
>     END LOOP; 
> 
>     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                     || ' where docRid = :1' USING RID;
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>   END ODCIINDEXDELETE_PR; 
> 
> 
>   PROCEDURE ODCIINDEXUPDATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      VARCHAR2,
>            NEWVAL      VARCHAR2,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
>     L_MODIDX   SYS.ODCINUMBERLIST;
>     L_EXTARR   MDSYS.T_EXTARR;
>     S_XMLRDF   CLOB; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     FILEDIR    VARCHAR2(4000) := NULL; 
>     L_NEWDOC   CLOB := NEWVAL; 
>     L_DUMN     NUMBER; 
>     FILTERPL   VARCHAR2(130); 
>     STAGTAB    VARCHAR2(270);
>     STAGVIEW   VARCHAR2(270);
>     DOCVID2RID_NAME   VARCHAR2(270);
>     DOCURI2RID_NAME   VARCHAR2(270);
>     L_ROWCNT       CONSTANT NUMBER := 0;
>     L_ROWDESC VARCHAR2(50); 
>     L_DOCURIPFX       VARCHAR2(4000);
>     L_DOCURISHORTPFX   VARCHAR2(500);
>     L_DOCURI          VARCHAR2(4000);
>     L_POLNAMES        SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS      SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     L_DOCVID          NUMBER;
>     L_FLAGS           SYS.ODCINUMBERLIST;
> 
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     
>     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>     
> 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
>  
>     
>     
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
>                                      IDXINFO.INDEXNAME, 
>                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),  
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
> 
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
>                                   ,DUMMY_XINFOTAB_NAME);
> 
>     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                       || ' where docRid = :1' INTO L_DOCVID USING RID;
> 
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID); 
>     END LOOP; 
> 
>     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                     || ' where docRid = :1' USING RID;
> 
>     IF (NEWVAL IS NULL) THEN 
>       RETURNVAL:= ODCICONST.SUCCESS;
>       RETURN;
>     END IF; 
> 
>     
>     
>     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
>                       IDXINFO.INDEXSCHEMA
>                     , IDXINFO.INDEXNAME
>                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
>     RDF_APIS_INTERNAL.KSDWRF('index update: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
> 
>     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
>     L_DOCURI := '<' || 
>                       L_DOCURIPFX || 
>                       L_ROWDESC ||
>                       '>';
> 
>     IF (L_EXTPREF IS NOT NULL) THEN 
>       IF (NLS_UPPER(L_EXTPREF.EXTRACT('//Datastore/@type').GETSTRINGVAL())
>                                                             = 'FILE') THEN
>         FILEDIR := TRIM(L_EXTPREF.EXTRACT(
>                    '//Datastore/Path/text()').GETSTRINGVAL());
>       END IF; 
>       IF (L_EXTPREF.EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
>         FILTERPL := NLS_UPPER(L_EXTPREF.EXTRACT(
>                                     '//Datastore/@filter').GETSTRINGVAL()); 
>       END IF; 
>       IF (FILEDIR IS NOT NULL) THEN 
>         
>         SEM_RDFCTX_IR.READ_FROM_FILE(FILEDIR, NEWVAL, L_NEWDOC, FILTERPL); 
>       ELSE 
>         SEM_RDFCTX_IR.READ_FROM_NTWRK(NEWVAL, L_NEWDOC, FILTERPL);
>       END IF; 
>     END IF; 
> 
>     
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       BEGIN
>         L_EXTARR(EI).STARTDRIVER();
> 
>         IF (L_EXTRPARAMS(EI) IS NULL) THEN
>           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC);
>         ELSE
>           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC,
>                                               L_EXTRPARAMS(EI));
>         END IF;
> 
>         L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(),
>                S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
>                IDXINFO.INDEXPARTITION, RID); 
>         L_EXTARR(EI).CLOSEDRIVER();
>    
>         
>         MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'UPD');
>       EXCEPTION
>          WHEN OTHERS THEN
>           L_EXTARR(EI).CLOSEDRIVER();
>           IF (SQLCODE != -13199) THEN 
>             SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
>                                         SQLCODE, SQLERRM);
>           END IF; 
>           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>              'unable to maintain index. See exceptions table');
>       END;
>     END LOOP; 
> 
>     
>     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
>     RETURN;
>   END ODCIINDEXUPDATE_PR; 
> 
> 
>   PROCEDURE ODCIINDEXUPDATE_PR (
>            IDXINFO     SYS.ODCIINDEXINFO,
>            RID         VARCHAR2,
>            OLDVAL      CLOB,
>            NEWVAL      CLOB,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS 
>     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
>     L_MODIDX   SYS.ODCINUMBERLIST;
>     L_EXTARR   MDSYS.T_EXTARR;
>     S_XMLRDF   CLOB; 
>     L_EXTPREF  SYS.XMLTYPE; 
>     L_FLAGS    SYS.ODCINUMBERLIST;
>     L_DUMN     NUMBER; 
>     STAGTAB    VARCHAR2(270);
>     STAGVIEW   VARCHAR2(270);
>     DOCVID2RID_NAME   VARCHAR2(270);
>     DOCURI2RID_NAME   VARCHAR2(270);
>     L_ROWCNT       CONSTANT NUMBER := 0;
>     L_ROWDESC VARCHAR2(50); 
>     L_DOCURIPFX       VARCHAR2(4000);
>     L_DOCURISHORTPFX   VARCHAR2(500);
>     L_DOCURI          VARCHAR2(4000);
>     L_POLNAMES        SYS.ODCIVARCHAR2LIST;
>     L_EXTRPARAMS      SYS.ODCIVARCHAR2LIST;
>     DUMMY_XINFOTAB_NAME VARCHAR2(270);
>     L_DOCVID          NUMBER;
> 
>     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     
>     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
>     
> 
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
>                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
>  
>     
>     
> 
>     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
>                                      IDXINFO.INDEXNAME, 
>                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
>                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
>    
>     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
>                                   ,DUMMY_XINFOTAB_NAME);
> 
>     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
>                       || ' where docRid = :1' INTO L_DOCVID USING RID;
> 
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
>     END LOOP; 
> 
>     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
>                     || ' where docRid = :1' USING RID;
> 
>     IF (NEWVAL IS NULL) THEN 
>       RETURNVAL:= ODCICONST.SUCCESS;
>       RETURN;
>     END IF; 
> 
>     
>     
>     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
>                       IDXINFO.INDEXSCHEMA
>                     , IDXINFO.INDEXNAME
>                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
>     RDF_APIS_INTERNAL.KSDWRF('index update: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
> 
>     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
>     L_DOCURI := '<' || 
>                       L_DOCURIPFX || 
>                       L_ROWDESC ||
>                       '>';
> 
>     
>     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
>       BEGIN
>         L_EXTARR(EI).STARTDRIVER();
> 
>         IF (L_EXTRPARAMS(EI) IS NULL) THEN
>           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC);
>         ELSE
>           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC,
>                                               L_EXTRPARAMS(EI));
>         END IF;
> 
>         L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(),
>                 S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
>                 IDXINFO.INDEXPARTITION, RID); 
>         L_EXTARR(EI).CLOSEDRIVER();
>   
>         
>         MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'UPD');
>       EXCEPTION
>          WHEN OTHERS THEN
>           L_EXTARR(EI).CLOSEDRIVER();
>           IF (SQLCODE != -13199) THEN 
>             SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
>                                         SQLCODE, SQLERRM);
>           END IF; 
>           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>              'unable to maintain index. See exceptions table');
>       END;
> 
>     END LOOP; 
> 
>     
>     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
> 
>     RETURNVAL:= SYS.ODCICONST.SUCCESS;
> 
>   END ODCIINDEXUPDATE_PR; 
> 
> 
>   
>   
>   
>   PROCEDURE ODCIINDEXSTART_PR (
>            ICTX        IN OUT SEMCONTEXTINDEXMETHODS,
>            IDXINFO     SYS.ODCIINDEXINFO,
>            OPI         SYS.ODCIPREDINFO,
>            OQI         SYS.ODCIQUERYINFO,
>            STRT        NUMBER,
>            STOP        NUMBER,
>            SPARQL      VARCHAR2,
>            POLICY      VARCHAR2,
>            IDX_STATUS  INTEGER,
>            ALIASES     MDSYS.RDF_ALIASES,
>            IDXENV      SYS.ODCIENV,
> 	   RETURNVAL   OUT NUMBER) IS
>     L_MODID     NUMBER; 
>     L_QRYARR    RDF_LONGVARCHARARRAY;
>     L_COLNAMES  RDF_VARCHARARRAY;
>     L_FLAGS     INTEGER := 0; 
>     PS_NCOLS    INTEGER;
>     STMT        DBMS_SQL.VARCHAR2A;
>     SEL         VARCHAR2(32767);
>     COLNAMES    RDF_VARCHARARRAY;
>     SELLST      SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
>     CURNM       INTEGER; 
>     RID         ROWID; 
>     SPARQLSEL   VARCHAR2(4000) := NULL;
>     SPARQLWHR   VARCHAR2(4000) := SPARQL; 
>     SELCOLS     RDF_VARCHARARRAY := NULL; 
>     WHRCOLS     RDF_VARCHARARRAY := NULL; 
>     IDX         INTEGER;
>     L_CLOB      CLOB;
>     L_NUM       NUMBER; 
>     FLAG_OUT    NUMBER; 
>     DUMNUML     SYS.ODCINUMBERLIST;
>     DUMVARCHAR  VARCHAR2(32767);  
>     VMNAME      VARCHAR(128) := NULL; 
>     SP2SQFLG    NUMBER := 4;
>     DUMMYHINT   VARCHAR2(128);
>     PART_NAME   VARCHAR2(128);
> 
>     DOCGRAPH          CONSTANT VARCHAR2(30) := 'ORARDFGRAPH';
> 
>     DOCGRAPH_SPARQL_VAR        VARCHAR2(128) := '?' || DOCGRAPH;
>     DOCGRAPH$RDFVID_COL        VARCHAR2(128) := DOCGRAPH || '$RDFVID';
> 
>     GRAPH_AUG_AT_HEAD CONSTANT VARCHAR2(100) := '{GRAPH ' || DOCGRAPH_SPARQL_VAR || ' ';
>     GRAPH_AUG_AT_TAIL CONSTANT VARCHAR2(100) := '}';
> 
>     FLAG_MATCH_UNNAMED  CONSTANT PLS_INTEGER := 128; 
> 
>     DUMMY_DOCURI2RID             VARCHAR2(128);
>     DOCVID2RID                   VARCHAR2(128);
>     DOCVID2RID_TAB               VARCHAR2(128);
>     SELECT_DOCVID2RID_CLAUSE     VARCHAR2(100);
>     SELECT_DOCVID2RID_ANC_CLAUSE VARCHAR2(100);
>     SELECT_DOCVID2RID_CNT_CLAUSE VARCHAR2(100);
>     FROM_DOCVID2RID_CLAUSE       VARCHAR2(100);
>     WHERE_DOCVID2RID_CLAUSE      VARCHAR2(100);
>     REQIDXSTATUS                 VARCHAR2(30);
>     DEBUG_TRACE                  BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS); 
> 
>     
>     HINTKEY    CONSTANT VARCHAR2(11)       := 'ORARDF$HINT';
>     
>     
>     
>     HINTSTR             VARCHAR2(4000)     := ' ALLOW_DUP=T ';
>     CLNALIASES          MDSYS.RDF_ALIASES  := MDSYS.RDF_ALIASES();
>     CURRALIAS           MDSYS.RDF_ALIAS;
>     ALIASIDX            PLS_INTEGER        := 0;
> 
>     
>     SELECT_OP CONSTANT VARCHAR2(19) := 'SEM_CONTAINS_SELECT';
>     COUNT_OP  CONSTANT VARCHAR2(18) := 'SEM_CONTAINS_COUNT';
> 
>     
>     L_NETWORK_OWNER     VARCHAR2(128) := 'MDSYS';
>     L_NETWORK_NAME      VARCHAR2(30) := '';
>     S_NETWORK_NAME      VARCHAR2(30) := '';
>   BEGIN
>     
>     
>     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
>     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
> 
>     L_NETWORK_OWNER := SDO_RDF_INTERNAL.GET_NETWORK_OWNER;
>     IF (L_NETWORK_OWNER != 'MDSYS') THEN
>       L_NETWORK_NAME := SDO_RDF_INTERNAL.GET_NETWORK_NAME;
>       S_NETWORK_NAME := SUBSTR(L_NETWORK_NAME,1,LENGTH(L_NETWORK_NAME)-1); 
>     END IF;
> 
> 
> 
> 
>     
>     IF (ALIASES IS NOT NULL) THEN 
>       FOR ALIASIDX IN ALIASES.FIRST..ALIASES.LAST LOOP
>         CURRALIAS := ALIASES(ALIASIDX);
>         IF (NLS_UPPER(CURRALIAS.NAMESPACE_ID) = HINTKEY) THEN
>           HINTSTR := CURRALIAS.NAMESPACE_VAL;
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'extracted hint: [' || HINTSTR || ']', 
>             DEBUG_TRACE);
>         ELSE
>           CLNALIASES.EXTEND(1);
>           CLNALIASES(CLNALIASES.LAST) := CURRALIAS;
>           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>             'keeping alias: [' || CURRALIAS.NAMESPACE_ID || '][' 
>                                || CURRALIAS.NAMESPACE_VAL || ']', 
>             DEBUG_TRACE);
>         END IF; 
>       END LOOP;
>     END IF;
> 
>     
>     IF (ICTX IS NOT NULL) THEN
>       IF (ICTX.SCANCUR IS NOT NULL) THEN
>          IF (DEBUG_TRACE) THEN
>            MDSYS.RDF_APIS_INTERNAL.KSDWRF('closing previous open cursor in ODCIIndexStart');
>          END IF;
>          DBMS_SQL.CLOSE_CURSOR(ICTX.SCANCUR);
>       END IF;
>     END IF;
> 
>     L_MODID := SEM_RDFCTX_DR.GET_MODEL_ID(IDXINFO.INDEXSCHEMA,
>                                           IDXINFO.INDEXNAME,
>                                (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
>                                           NLS_UPPER(POLICY)); 
> 
>     
>     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, DUMMY_DOCURI2RID, DOCVID2RID);
>     DOCVID2RID_TAB := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(DOCVID2RID);
> 
>     
>     REQIDXSTATUS := SEM_RDFCTX_DR.GET_IDXSTATUS_STRING(IDX_STATUS);
> 
>     MDSYS.RDF_APIS_INTERNAL.KSDWRF('requiredidxStatus : ' ||REQIDXSTATUS || ' idx_status=[' || IDX_STATUS || ']' || CHR(10) || DBMS_UTILITY.FORMAT_CALL_STACK, DEBUG_TRACE);
> 
>     IF (REQIDXSTATUS IS NULL) THEN
>       RAISE_APPLICATION_ERROR(-20000, TO_CHAR(IDX_STATUS) ||
>                ' is not a recognized option for status of a rules index');
>     END IF;
> 
>     
>     SELECT_DOCVID2RID_CLAUSE := 'SELECT docRid FROM (';
>     SELECT_DOCVID2RID_CNT_CLAUSE := 'SELECT docRid, abs_cnt FROM (';
>     SELECT_DOCVID2RID_ANC_CLAUSE := 'SELECT docRid, sparqlrslt FROM (';
>     FROM_DOCVID2RID_CLAUSE := '), ' || DOCVID2RID_TAB || ' Vid2Rid';
>     WHERE_DOCVID2RID_CLAUSE := ' and Vid2Rid.docVid = ' || DOCGRAPH$RDFVID_COL || ' ';
> 
>     
>     L_FLAGS := 0;
>     IF (OQI.ANCOPS IS NOT NULL AND OQI.ANCOPS.COUNT > 0) THEN 
>       FOR IDX IN OQI.ANCOPS.FIRST..OQI.ANCOPS.LAST LOOP
>         MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>           'ancop [' || OQI.ANCOPS(IDX).OBJECTNAME || ']', 
>            DEBUG_TRACE);
>         CASE (NLS_UPPER(OQI.ANCOPS(IDX).OBJECTNAME))
>           WHEN SELECT_OP THEN
>             L_FLAGS := L_FLAGS + SEM_RDFCTX_DR.SELECT_ANCOP;
>           WHEN COUNT_OP THEN
>             L_FLAGS := L_FLAGS + SEM_RDFCTX_DR.COUNT_ANCOP;
>           ELSE
>             NULL;
>         END CASE;
>       END LOOP;
>         MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>           'l_flags [' || L_FLAGS || ']', 
>            DEBUG_TRACE);
>     END IF; 
> 
>     IF (L_MODID < 0) THEN 
>       L_MODID := -1*L_MODID; 
>       SP2SQFLG := SP2SQFLG+ FLAG_MATCH_UNNAMED; 
>       VMNAME := SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'SEMV_RDFCTX_MOD_'||L_MODID; 
>       
> 
>       
>       IF (SEM_RDFCTX_DR.IS_ENTAILMENT_COMPAT('RDFCTX_MOD_'||L_MODID, REQIDXSTATUS) = FALSE) THEN
>         IF (REQIDXSTATUS = SDO_RDF_INTERNAL.RIDX_VALID) THEN
>           RAISE_APPLICATION_ERROR(-20000,
>                    'We do not have a valid virtual model  with the specified status ');
>         ELSE
>           RAISE_APPLICATION_ERROR(-20000,
>                    'We do not have a virtual model  with the specified status ');
>         END IF;
>       END IF;
> 
>       
>     ELSE
>       NULL;
>       
>     END IF; 
> 
>     MDSYS.RDF_APIS_INTERNAL.KSDWRF('model_name in ODCIIndexStart : '||VMNAME, DEBUG_TRACE);
>     
>     IF (INSTR(NLS_UPPER(SUBSTR(LTRIM(SPARQL),1, 10)), 'SELECT') = 1) THEN 
>       SELCOLS := SEM_RDFCTX_DR.GETSELECTVARIABLES(SPARQL); 
>       
>       
>       SPARQLWHR := SUBSTR(SPARQL, INSTR(SPARQL,'{'));
>     END IF; 
> 
>     SPARQLWHR := GRAPH_AUG_AT_HEAD || SPARQLWHR || GRAPH_AUG_AT_TAIL;
> 
>     
>     
>     
>     SELLST.EXTEND;
>     SELLST(SELLST.COUNT) := 2;
> 
>     
>     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
>       IF (SELCOLS IS NULL) THEN 
>         SELCOLS := RDF_VARCHARARRAY('*'); 
>       END IF; 
>       WHRCOLS := SEM_RDFCTX_DR.GETWHEREVARIABLES(SPARQLWHR, DUMMYHINT); 
> 
>       
> 
> 
> 
> 
> 
> 
> 
> 
>       
>       IF (SELCOLS.COUNT = 1 AND SELCOLS(1) = '*') THEN 
>         SELCOLS := RDF_VARCHARARRAY(); 
>         FOR WCL IN 1 .. WHRCOLS.COUNT/2 LOOP
>           
>           IF (INSTR(WHRCOLS(WCL*2),'$') = 0 AND WHRCOLS(WCL*2) != NLS_UPPER(DOCGRAPH)) THEN 
>             
>             SELLST.EXTEND; 
>             SELLST(SELLST.COUNT) := WCL; 
>             
>             SELLST.EXTEND; 
>             SELLST(SELLST.COUNT) := WCL+4; 
>             
>             SELCOLS.EXTEND; 
>             SELCOLS(SELCOLS.COUNT) := WHRCOLS(WCL*2); 
>           
> 
> 
> 
> 
>           END IF; 
>         END LOOP;
>       ELSE
>         
>         FOR WCL IN 1 .. WHRCOLS.COUNT/2 LOOP
>           IF (INSTR(WHRCOLS(WCL*2),'$') = 0) THEN
>             
>             FOR SCL IN 1 .. SELCOLS.COUNT LOOP
>               IF (SELCOLS(SCL) = WHRCOLS(WCL*2)) THEN
>                 SELLST.EXTEND;
>                 SELLST(SELLST.COUNT) := WCL;      
>                 
>                 SELLST.EXTEND; 
>                 SELLST(SELLST.COUNT) := WCL+4; 
>               END IF; 
>             END LOOP; 
>           END IF; 
>         END LOOP; 
>       END IF; 
>     END IF; 
> 
>     RDF_APIS_INTERNAL.KSDWRF('sp2sqflg=' || TO_CHAR(SP2SQFLG) || '
> WHR=' || SPARQLWHR || '*
> SELLST=' || SELLST.COUNT || '*', DEBUG_TRACE);
> 
>     MDSYS.RDF_APIS_INTERNAL.KSDWRF(
>       'using sem_match options: [' || HINTSTR || ']', 
>       DEBUG_TRACE);
> 
>     RDF_APIS_INTERNAL.SPARQL_TO_SQL(SELLST,
>                                     SPARQLWHR, 
>                                     RDF_MODELS('RDFCTX_MOD_'||L_MODID), 
>                                     NULL, 
>                                     NULL, 
>                                     REQIDXSTATUS, 
>                                     NULL, 
>                                     NULL, 
>                                     NULL, 
>                                     NULL, 
>                                     ALIASES, 
>                                     SP2SQFLG,    
>                                     L_QRYARR, 
>                                     L_COLNAMES, NULL, VMNAME, 
>                                     FLAG_OUT, DUMNUML, DUMVARCHAR, NULL, 0
>                                   , L_NETWORK_OWNER, S_NETWORK_NAME); 
> 
>     
>     IF (BITAND(FLAG_OUT, 1) = 1) THEN 
>       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>              'filters in optional graph patterns can only reference local or ' ||
>              'parent variables');
>     END IF;
> 
>     IDX := 1;  
> 
>     
>     
>     
>     
>     
> 
>     
>     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
>       
>       
>       
>       STMT(IDX) := SELECT_DOCVID2RID_ANC_CLAUSE 
>                 || ' select ' || DOCGRAPH$RDFVID_COL || ', ''  <result>''||chr(10)||'; 
>       IDX := IDX+1; 
>       FOR SCI IN 1 .. SELCOLS.COUNT LOOP
>         STMT(IDX) := '''    <binding name="'||SELCOLS(SCI)||'">''||chr(10)||'; 
>         IDX := IDX+1; 
>         STMT(IDX) := '   (case '||SELCOLS(SCI)||'$RDFVTYP when ''URI'' then '||
>          '''      <uri>''||replace('||SELCOLS(SCI)||
>                                       ',''&'',''&amp;'')||''</uri>'''; 
>         IDX := IDX+1; 
>         STMT(IDX) := '    when ''LIT'' then '||
>          '''      <literal>''||replace(replace(replace(replace('||SELCOLS(SCI)
>                       ||',''&'',''&amp;''), ''<'',''&lt;''), ''>'',''&gt;'')
>                 ,''"'',''&quot;'')||''</literal>'' end)||chr(10)||'; 
>         IDX := IDX+1; 
>         STMT(IDX) := '''    </binding>''||chr(10)||'; 
>         IDX := IDX+1; 
>       END LOOP; 
>       STMT(IDX) := '''  </result>'' as sparqlrslt from (';         
>       
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     
>     ELSIF (BITAND(L_FLAGS, SEM_RDFCTX_DR.COUNT_ANCOP) = SEM_RDFCTX_DR.COUNT_ANCOP) THEN
>       STMT(IDX) := SELECT_DOCVID2RID_CNT_CLAUSE 
>                 || ' select ' || DOCGRAPH$RDFVID_COL || ', ' || 
>                                 'count(*) abs_cnt from ( ';
>     
>     ELSE 
>       STMT(IDX) := SELECT_DOCVID2RID_CLAUSE 
>                 || ' select ' || DOCGRAPH$RDFVID_COL || ' from ( ';
>     END IF; 
>     IDX := IDX+1; 
>    
>     FOR QIDX IN 1 .. L_QRYARR.COUNT LOOP
>       STMT(IDX) := L_QRYARR(QIDX);
>       IDX := IDX+1; 
>     END LOOP; 
> 
>     STMT(IDX) := ') where 1=1 ';
>     IDX := IDX+1;
> 
>     
>     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
>       STMT(IDX) :=
>          (CASE WHEN BITAND(SP2SQFLG,16) = 16 THEN 
>            ' and ' || DOCGRAPH$RDFVID_COL || ' is not null ' ELSE ' ' END)
>       || FROM_DOCVID2RID_CLAUSE || ' where 1=1 ' || WHERE_DOCVID2RID_CLAUSE
>       ||' order by 1, 2 ';
>     ELSE
>       STMT(IDX) :=
>          (CASE WHEN BITAND(SP2SQFLG,16) = 16 THEN
>              ' and ' || DOCGRAPH$RDFVID_COL || ' is not null ' ELSE ' ' END)
>       || ' group by ' || DOCGRAPH$RDFVID_COL
>       || FROM_DOCVID2RID_CLAUSE || ' where 1=1 ' || WHERE_DOCVID2RID_CLAUSE; 
>     END IF; 
>     
> 
> 
> 
> 
> 
> 
> 
>     
>     RDF_APIS_INTERNAL.KSDWRF('stmt.count=' || STMT.COUNT, DEBUG_TRACE);
>     FOR IDX IN 1..STMT.COUNT LOOP
>       RDF_APIS_INTERNAL.KSDWRF(STMT(IDX), DEBUG_TRACE);
>     END LOOP;
> 
>     CURNM := DBMS_SQL.OPEN_CURSOR;
>     DBMS_SQL.PARSE(CURNM, STMT, 1, STMT.COUNT, FALSE, DBMS_SQL.NATIVE);
>     DBMS_SQL.DEFINE_COLUMN_ROWID(CURNM, 1, RID); 
>     
>     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
>       DBMS_SQL.DEFINE_COLUMN(CURNM, 2, L_CLOB); 
>     
>     ELSIF (BITAND(L_FLAGS, SEM_RDFCTX_DR.COUNT_ANCOP) = SEM_RDFCTX_DR.COUNT_ANCOP) THEN
>       DBMS_SQL.DEFINE_COLUMN(CURNM, 2, L_NUM); 
>     END IF; 
>     L_MODID := DBMS_SQL.EXECUTE(CURNM); 
>     ICTX := SEMCONTEXTINDEXMETHODS(CURNM, L_FLAGS, NULL);
>     RETURNVAL:= ODCICONST.SUCCESS;
>     RETURN;
>   EXCEPTION WHEN OTHERS THEN 
>     MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
>       'Error during ODCIIndexStart. ' 
>     ||': ' 
>     || SDO_SEM_LOG.NEWLINE || SQLERRM
>     || SDO_SEM_LOG.NEWLINE ||' [' 
>     || SDO_SEM_LOG.NEWLINE || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE 
>     || SDO_SEM_LOG.NEWLINE || ']');
>     
>   END ODCIINDEXSTART_PR; 
> 
MDSYS.S_SDO_RDF_INTERNAL - PACKAGE BODY (RU):
1009c1009,1010
<                              MATCHEDSIG OUT VARCHAR2) IS
---
>                              MATCHEDSIG OUT VARCHAR2,
>                              OPTIONS        VARCHAR2 DEFAULT NULL) IS
1011c1012
<     MDSYS.RDF_APIS_INTERNAL.W_GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG);
---
>     MDSYS.RDF_APIS_INTERNAL.W_GETPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, PRECOMPID, STATUS, MATCHEDSIG, OPTIONS);
1024c1025,1026
<                                 RULEBASEIDS    SYS.ODCINUMBERLIST)
---
>                                 RULEBASEIDS    SYS.ODCINUMBERLIST,
>                                 OPTIONS        VARCHAR2 DEFAULT NULL)
1027c1029
<     RETURN MDSYS.RDF_APIS_INTERNAL.W_CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS);
---
>     RETURN MDSYS.RDF_APIS_INTERNAL.W_CREATEPRECOMPSTATUS(OWNER, INDEX_NAME, PRECOMPSIG, MODELIDS, RULEBASEIDS, OPTIONS);
1028a1031,1036
> 
>   FUNCTION GET_RDF_SEQUENCE_NEXTVAL (SEQUENCE_NAME VARCHAR2)
>   RETURN NUMBER IS
>   BEGIN
>     RETURN MDSYS.RDF_APIS_INTERNAL.W_GET_RDF_SEQUENCE_NEXTVAL(SEQUENCE_NAME);
>   END GET_RDF_SEQUENCE_NEXTVAL;
MDSYS.SEMCONTEXTINDEXMETHODS - TYPE BODY (RU):
25,136c25
<     L_POLLST   SYS.ODCIVARCHAR2LIST; 
<     L_BASEPOL  SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
<     L_BATCHPOL SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
<     L_BATCHPOL_COUNT NUMBER := 0; 
<     L_DEPPOL   SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
< 
<     L_DUMVR    VARCHAR2(200); 
<     L_BASETAB_QUERY_BODY VARCHAR2(4000);
<     L_INS_PARA_HINT      VARCHAR2(200);
<     L_INS_DOCURI2RID     VARCHAR2(4000);
< 
<     L_ROWCNT   NUMBER; 
<     L_EXTARR   MDSYS.T_EXTARR := MDSYS.T_EXTARR(); 
<     L_MODARR   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
<     L_ERRCNT   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
<     L_RC       SYS_REFCURSOR; 
<     S_RID      ROWID; 
<     S_CLOB     CLOB;
<     S_XMLRDF   CLOB;
<     DS_CLOB    CLOB; 
<     ERRM       VARCHAR2(4000); 
<     L_DEFPOL   VARCHAR2(130); 
<     L_VMNUM    NUMBER; 
<     L_VMMODS   MDSYS.RDF_MODELS; 
<     L_VMRBS    MDSYS.RDF_RULEBASES; 
<     L_CTXPREF  FN_XMLPREF := FN_XMLPREF();
<     T_EXTARR   FN_EXTARR := FN_EXTARR();
<     FILEDIR    VARCHAR2(512) := NULL; 
<     FILTERPL   VARCHAR2(130) := NULL;
<     STMT       VARCHAR2(32767);
<     CNT NUMBER;  
<     TRIPLE_CNT NUMBER(38);
<     STEP_NUM   NUMBER := 0;
<     L_USEDOPTS SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
<     L_EXTRPARAMS SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
<     USED_OPT   VARCHAR2(100);
<     L_LOAD_METHOD VARCHAR2(128) := 'DML';
<     L_BATCH       BOOLEAN := FALSE; 
<     OBJCNT PLS_INTEGER;
<     L_TBSNM   VARCHAR2(130);
<     IS_GLOBAL_IDX BOOLEAN;
<     IS_IDX_PARTITION  BOOLEAN := FALSE;
<     FIRST_CALL BOOLEAN := FALSE;
<     L_NETWORK_OWNER     VARCHAR2(128) := NULL;
<     L_NETWORK_NAME      VARCHAR2(30) := NULL;
< 
<     ROLES_AND_PRIVS VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
< 
<     POLICY_PARTNAME VARCHAR2(128);
<     
<     CURSOR CUR1(IANAME VARCHAR2) IS
<       SELECT PARTITION_NAME, TABLESPACE_NAME 
<         FROM SYS.USER_IND_PARTITIONS
<        WHERE INDEX_NAME = IANAME 
<     ORDER BY PARTITION_POSITION;
<     
<     CURSOR CUR2(IANAME VARCHAR2) IS
<       SELECT XP.PARTITION_NAME, TP.TABLESPACE_NAME 
<         FROM SYS.USER_IND_PARTITIONS XP, SYS.ALL_TAB_PARTITIONS TP, SYS.USER_INDEXES X
<        WHERE XP.INDEX_NAME = IANAME AND XP.PARTITION_NAME = TP.PARTITION_NAME
<          AND X.TABLE_NAME = TP.TABLE_NAME AND XP.INDEX_NAME = X.INDEX_NAME 
<     ORDER BY XP.PARTITION_POSITION;
<     
<     PARTI_DETAILS VARCHAR2(3000);
<     CR_STAGTAB_STMT  VARCHAR2(4000);
<     IDX_OBJNUM  NUMBER;
<     STAGTAB_NAME   VARCHAR2(270);
<     STAGTAB_SUFFIX VARCHAR2(128);
<     STAGTAB        VARCHAR2(128);
<     STAGVIEW_NAME  VARCHAR2(270);
<     STAGVIEW       VARCHAR2(128);
<     STAGTAB_VIEW_NAME      VARCHAR2(128);
<     STAGTAB_PART_VIEW_NAME VARCHAR2(128) := NULL;
<     XINFOTAB_NAME   VARCHAR2(270);
<     XINFOTAB        VARCHAR2(128);
<     XINFOTAB_SUFFIX VARCHAR2(128);
< 
<     BATCH_INTERFACE_OPTION CONSTANT VARCHAR2(100) := 'INTERFACE=BATCH';
<     DBUSER_ATTRIBUTE_NAME  CONSTANT VARCHAR2(100) := 'DBUSER';
<     XUSER                           VARCHAR2(128); 
< 
<     LOOPVAR_I      NUMBER;
<     STATUS         NUMBER;
< 
<     PARTI_CLAUSE       VARCHAR2(1000) := NULL;
<     INS_INTO_DOCVID    VARCHAR2(4000);
< 
<     
<     DOCURI2RID           VARCHAR2(128); 
<     DOCVID2RID           VARCHAR2(128); 
< 
<     DOCURI2RID_NAME      VARCHAR2(270);
<     DOCURI2RID_DEBUG     VARCHAR2(270);
<     DOCVID2RID_NAME      VARCHAR2(270);
< 
<     DOCURI2RID_NAMESQ    VARCHAR2(270);   
<     DOCVID2RID_NAMESQ    VARCHAR2(270);
<     
<     KEEP_STAGING_TABLES        VARCHAR2(128) := 'KEEP_RDFCTX_STAGING_TABLES';
<     KEEP_RDFCTX_STAGING_TABLES BOOLEAN := FALSE;
<     IS_PARTN_TBL        NUMBER;
<     IS_ADD_PARTITION    BOOLEAN := FALSE;
< 
<     L_DOCURIPFX         VARCHAR2(4000);
<     L_DOCURISHORTPFX    VARCHAR2(500);
<     ROWS_APPENDED       NUMBER;
< 
<     SNAP_TIME           TIMESTAMP;
<     UNAME               VARCHAR2(128);
< 
<     DEBUG_TRACE         BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
138,776c27,29
<     
<     BEGIN
<       L_POLLST := SEM_RDFCTX_DR.PRVT_PARAMS_PARSER(IDXPARMS, L_USEDOPTS, L_EXTRPARAMS); 
<     EXCEPTION 
<       WHEN OTHERS THEN 
<         EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
<                                ''invalid or empty parameters passed to the index'')';
<         RETURN SYS.ODCICONST.FATAL;
<         
<         
<     END; 
< 
<     SELECT COUNT(DISTINCT(COLUMN_VALUE)) INTO L_ROWCNT
<        FROM TABLE(L_POLLST); 
< 
<     IF (L_ROWCNT != L_POLLST.COUNT OR L_POLLST.COUNT > 5) THEN 
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<           'duplicate or too many policies specified for the index'); 
<     END IF; 
< 
<     
<     FOR OPT IN (SELECT DISTINCT COLUMN_VALUE FROM TABLE(L_USEDOPTS))
<     LOOP
<         USED_OPT := TRIM(OPT.COLUMN_VALUE);
<         RDF_APIS_INTERNAL.KSDWRF('CreateIndex option=' || USED_OPT || '*', DEBUG_TRACE);
<         IF (USED_OPT = 'LOAD_METHOD=BULK') THEN 
<           L_LOAD_METHOD := 'BULKLOAD'; 
<           RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
<         ELSIF (USED_OPT = BATCH_INTERFACE_OPTION) THEN
<           L_LOAD_METHOD := 'BULKLOAD';
<           L_BATCH := TRUE;
<           RDF_APIS_INTERNAL.KSDWRF('interface=BATCH', DEBUG_TRACE);
<           RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
<         ELSIF (USED_OPT = KEEP_STAGING_TABLES) THEN
<           KEEP_RDFCTX_STAGING_TABLES := TRUE;
< 	ELSIF (INSTR(USED_OPT, 'NETWORK_OWNER=') > 0) THEN 
< 	  BEGIN
< 	    IF (INSTR(USED_OPT, '"', 15) > 0) THEN
< 	      L_NETWORK_OWNER := SUBSTR(USED_OPT, 15);
< 	    ELSE
< 	      L_NETWORK_OWNER := NLS_UPPER(SUBSTR(USED_OPT, 15));
< 	    END IF;
<           END;
< 	ELSIF (INSTR(USED_OPT, 'NETWORK_NAME=') > 0) THEN
< 	  BEGIN
< 	    IF (INSTR(USED_OPT, '"', 14) > 0) THEN
< 	      L_NETWORK_NAME := SUBSTR(USED_OPT, 15, LENGTH(USED_OPT)-15);
< 	    ELSE
< 	      L_NETWORK_NAME := NLS_UPPER(SUBSTR(USED_OPT, 14));
< 	    END IF;
<           END;
<         END IF;
<     END LOOP;
< 
<     SEM_APIS.SET_NETWORK_INFO_CP_TO_PKGS(L_NETWORK_OWNER, L_NETWORK_NAME);
<     SEM_RDFCTX_DR.COPY_NETWORK_INFO_TO_PKG_VARS;
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     COMMIT; 
< 
< 
< 
< 
<     
<     SEM_RDFCTX_IR.PURGE_TEMP_STAGING_TABLES;
< 
<     
<     IF (IDXPARMS IS NULL OR LENGTH(IDXPARMS) = 0) THEN 
<       EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
<                                ''invalid or empty parameters passed to the index'')';
<       RETURN SYS.ODCICONST.FATAL;
<       
<       
<     END IF; 
<     BEGIN
<       L_DUMVR := SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXNAME, FALSE);
<     EXCEPTION
<       WHEN OTHERS THEN
<         EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
<                                ''invalid name for the index'')';
<         RETURN SYS.ODCICONST.FATAL;
<     END;
< 
<     
<     IF (NOT(IDXINFO.INDEXCOLS(1).COLTYPENAME IN ('CLOB','VARCHAR2'))) THEN
<       INSERT INTO SYS.ODCI_WARNINGS$ VALUES (1,'unsupported data type '||
<                                     IDXINFO.INDEXCOLS(1).COLTYPENAME ||' for the indextype');
<        RETURN SYS.ODCICONST.FATAL;
<     END IF; 
< 
<     IF ((IDXENV.CALLPROPERTY IS NULL) AND (IDXINFO.INDEXPARTITION IS NULL)) THEN 
<       IS_GLOBAL_IDX := TRUE;
<       POLICY_PARTNAME := IDXINFO.INDEXNAME;
< 
<       
<       
<       
<       
<     ELSE
<       IF((IDXENV.CALLPROPERTY IS NULL) AND (IDXINFO.INDEXPARTITION IS NOT NULL)) THEN
<         
<         IS_GLOBAL_IDX := FALSE;
<         IS_ADD_PARTITION := TRUE;
<         POLICY_PARTNAME := IDXINFO.INDEXPARTITION;
<       ELSE
<         IS_GLOBAL_IDX := FALSE; 
<         IF (IDXENV.CALLPROPERTY = SYS.ODCICONST.FIRSTCALL) THEN
<           FIRST_CALL := TRUE;
<  
<           
<           
<           PARTI_DETAILS := '';
<           LOOPVAR_I := 1;
< 
<           FOR C1 IN CUR2(IDXINFO.INDEXNAME) LOOP
<             IF (LOOPVAR_I >1) THEN
<               PARTI_DETAILS := PARTI_DETAILS || SDO_SEM_LOG.NEWLINE || ',';
<             END IF;
<             PARTI_DETAILS := PARTI_DETAILS
<                 || 'partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(C1.PARTITION_NAME, FALSE)
<                 || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(C1.TABLESPACE_NAME, FALSE);
<             LOOPVAR_I := LOOPVAR_I+1;
<          END LOOP;
<          RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: partition_details=' || PARTI_DETAILS, DEBUG_TRACE);
< 
<         ELSE
<           IF ((IDXENV.CALLPROPERTY = SYS.ODCICONST.INTERMEDIATECALL) AND 
<                   (IDXINFO.INDEXPARTITION IS NOT NULL))  THEN
<             IS_IDX_PARTITION := TRUE;
<             POLICY_PARTNAME := IDXINFO.INDEXPARTITION;
<           END IF;
<         END IF;
<       END IF;
<     END IF;
< 
<     BEGIN
<       L_DEFPOL := L_POLLST(1); 
< 
<       STEP_NUM := 3.5;
<       
<       
<       SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME,STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
<       MDSYS.RDF_APIS_INTERNAL.KSDWRF('step 3.5: xinfotab_name=' || XINFOTAB_NAME, DEBUG_TRACE);
<       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<       
<       DOCURI2RID_NAMESQ := DOCURI2RID_NAME;
<       DOCVID2RID_NAMESQ := DOCVID2RID_NAME;
< 
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       
<       IF (NOT(IS_ADD_PARTITION)) THEN
<         IF (DEBUG_TRACE AND XINFOTAB_NAME IS NOT NULL) THEN
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF('step 3.5 before creating staging table: (note: xinfotab_name=' 
<             || XINFOTAB_NAME || ' NOT created', DEBUG_TRACE);
<         END IF;
<         IF (IS_GLOBAL_IDX) THEN
<           
<           UNAME := SYS_CONTEXT('USERENV','CURRENT_USER');
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF('user is odciindexcreate is :' ||UNAME, DEBUG_TRACE);
<           SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,NULL,NULL,TRUE,NULL);
<         ELSIF (FIRST_CALL) THEN
<           
<           SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,NULL,PARTI_DETAILS,FALSE,NULL);
<         END IF;
<       END IF;
< 
<       STEP_NUM := 4;
<       RDF_APIS_INTERNAL.KSDWRF('starting step 4', DEBUG_TRACE);
< 
<       
<       SEM_RDFCTX_DR.SPLIT_POLICY_LIST (IDXINFO.INDEXSCHEMA, L_POLLST, 
<                                      L_BASEPOL, L_DEPPOL); 
< 
<       STEP_NUM := 4.5;
<       FOR PIDX IN 1 .. L_BASEPOL.COUNT LOOP
<         L_EXTARR.EXTEND; 
<         L_MODARR.EXTEND; 
<         L_POLRIDS.EXTEND; 
<         L_BATCHPOL.EXTEND; 
<         L_CTXPREF.EXTEND;
<         T_EXTARR.EXTEND;
<         L_ERRCNT.EXTEND;
<         L_ERRCNT(PIDX) := 0;
< 
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: policy name=' || L_BASEPOL(PIDX), DEBUG_TRACE);
< 
<          
<          STEP_NUM := 4.52;
<          SEM_RDFCTX_DR.GET_POLICY_INFO (
<                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(PIDX)),
<                       L_POLRIDS(PIDX), L_EXTARR(PIDX), L_CTXPREF(PIDX));
< 
<          
<          IF (L_BATCH) THEN
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('BATCH interface: check if the extractor for this base-policy supports batch interface', DEBUG_TRACE);
<            IF NLS_UPPER(L_EXTARR(PIDX).GETCONTEXT(BATCH_INTERFACE_OPTION)) IN ('YES','Y') THEN
<              L_BATCHPOL(PIDX) := 1;
<              L_BATCHPOL_COUNT := L_BATCHPOL_COUNT + 1;
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: batch capable policy:' 
<                || L_BASEPOL(PIDX) || ' [count so far: ' || L_BATCHPOL_COUNT || ' batch capable policies '
<                || ' (out of ' || L_BASEPOL.COUNT || ')]', DEBUG_TRACE);
<            ELSE
<              L_BATCHPOL(PIDX) := 0;
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: NOT batch capable policy:' || L_BASEPOL(PIDX), DEBUG_TRACE);
<            END IF;
<          END IF;
< 
<          IF (NOT(IS_ADD_PARTITION)) THEN
<            IF (PIDX > 1) THEN 
<              IF (SEM_RDFCTX_DR.ARE_MATCHING_DATASTORES(L_CTXPREF(1),
<                                              L_CTXPREF(PIDX)) != 1) THEN 
<              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                'mismatched datastore specifications for base policies'); 
<              END IF; 
<            ELSIF (L_BATCH AND L_CTXPREF(1) IS NOT NULL) THEN
<              
<              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                'for BATCH interface, no support yet for files or web content');
<            ELSIF (L_CTXPREF(1) IS NOT NULL AND 
<                 L_CTXPREF(1).EXTRACT('//Datastore') IS NULL) THEN 
<              L_CTXPREF(1) := NULL; 
<            ELSIF (L_CTXPREF(1) IS NOT NULL AND 
<                NLS_UPPER(L_CTXPREF(1).EXTRACT('//Datastore/@type').GETSTRINGVAL())
<                                                             = 'FILE') THEN 
<              FILEDIR := TRIM(L_CTXPREF(1).EXTRACT(
<                           '//Datastore/Path/text()').GETSTRINGVAL());
<              SELECT COUNT(*) INTO L_ROWCNT FROM SYS.ALL_DIRECTORIES WHERE 
<                 DIRECTORY_NAME = FILEDIR; 
<              IF (L_ROWCNT = 0) THEN 
<                 MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                'directory object '||FILEDIR||' does not exist or is inaccessible'); 
<              END IF; 
<            END IF; 
<          END IF;
< 
<          STEP_NUM := 4.58;
<          RDF_APIS_INTERNAL.KSDWRF('starting step 4.58', DEBUG_TRACE);
<          
<          IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION OR IS_ADD_PARTITION) THEN 
<            
<            
<            
<            
<            
<            
<            
<            
<            SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
<               WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
< 
<            
<            IF (L_TBSNM IS NULL) THEN
<              RDF_APIS_INTERNAL.KSDWRF('Could not determine tablespace_name for use in creating RDF model', DEBUG_TRACE);
<              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                'Could not determine tablespace_name for use in creating RDF model'
<              ||(CASE IS_IDX_PARTITION 
<                 WHEN TRUE THEN ' (partition: ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
<                 ELSE '' 
<                 END));
<              RETURN SYS.ODCICONST.FATAL;
<            ELSE
<              RDF_APIS_INTERNAL.KSDWRF('step 4.58: l_tbsnm=' || L_TBSNM, DEBUG_TRACE);
<            END IF;
< 
<            
<            
<            L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
<                             IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                             POLICY_PARTNAME, L_POLRIDS(PIDX), 
<                             SEM_RDFCTX_DR.INDST_INPROGRESS, L_TBSNM,
<                             L_EXTRPARAMS(PIDX));
<          END IF;
< 
<          
<          
<          
<          
<          IF (L_LOAD_METHOD='BULKLOAD' AND (IS_GLOBAL_IDX OR FIRST_CALL)) THEN 
<            STAGTAB_SUFFIX := 
<              SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(PIDX)),L_POLRIDS(PIDX));
<            IF (IS_GLOBAL_IDX) THEN
<              SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,L_TBSNM,STAGTAB_SUFFIX,NULL,FALSE,XINFOTAB_NAME);
<            ELSIF (FIRST_CALL) THEN
<              SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,STAGTAB_SUFFIX,PARTI_DETAILS,FALSE,XINFOTAB_NAME);
<            END IF;
< 
<            IF (XINFOTAB_NAME IS NOT NULL AND L_BATCHPOL(PIDX)=1) THEN
<              
<              
<              XUSER := L_EXTARR(PIDX).GETCONTEXT(DBUSER_ATTRIBUTE_NAME);
<              STMT := 'grant select, insert, update, delete on '
<                || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(XINFOTAB_NAME || STAGTAB_SUFFIX) 
<                || ' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SYS.DBMS_ASSERT.SCHEMA_NAME(XUSER), FALSE);
<              EXECUTE IMMEDIATE STMT;
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('granted DML privs to DBUSER of extractor: ' || XUSER, DEBUG_TRACE);
<            END IF;
<          END IF;
< 
<          T_EXTARR(PIDX) := L_EXTARR(PIDX);
<       END LOOP; 
< 
<       STEP_NUM := 4.9;
<       IF (NOT(IS_ADD_PARTITION) AND L_CTXPREF(1) IS NOT NULL) THEN 
<         IF (IDXINFO.INDEXCOLS(1).COLTYPENAME != 'VARCHAR2') THEN 
<           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<              'FILE/URL datastores only allowed with VARCHAR2 columns'); 
<         END IF; 
<         IF (L_CTXPREF(1).EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
<           FILTERPL := NLS_UPPER(L_CTXPREF(1).EXTRACT(
<                                     '//Datastore/@filter').GETSTRINGVAL()); 
<         END IF; 
<       END IF; 
<     END;
< 
<    IF (IS_GLOBAL_IDX OR FIRST_CALL) THEN
<      
<      
<      
<      
<      SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME,DOCVID2RID_NAME,
<                                          L_TBSNM,PARTI_DETAILS);
< 
<      
<      FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<         L_EXTARR(EI).STARTDRIVER(); 
<      END LOOP;
<    END IF;
< 
< 
<     STEP_NUM := 5;
<     RDF_APIS_INTERNAL.KSDWRF('starting step 5', DEBUG_TRACE);
< 
<    MDSYS.RDF_APIS_INTERNAL.KSDWRF('initial setup done for creating index', DEBUG_TRACE);
< 
<    IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION) THEN
<      IF (DEBUG_TRACE) THEN              
<        RDF_APIS_INTERNAL.KSDWRF('step 5 before invoking pxs: exceptions-count=' 
<          || SEM_RDFCTX_DR.GET_EXCEPTIONS_COUNT, DEBUG_TRACE);
<      END IF;
< 
<      SEM_RDFCTX_IR.POPULATE_INDEX_SEGMENT(
<        IDXINFO, FILEDIR, FILTERPL, L_BASEPOL, L_EXTRPARAMS, L_CTXPREF, T_EXTARR, L_MODARR, L_POLRIDS
<      , L_LOAD_METHOD, STAGTAB_NAME, DOCURI2RID_NAME, DOCVID2RID_NAME, XINFOTAB_NAME
<      , L_BATCHPOL, L_BATCHPOL_COUNT);
< 
<      IF (DEBUG_TRACE) THEN              
<        RDF_APIS_INTERNAL.KSDWRF('step 5 after returning from pxs: exceptions-count=' 
<          || SEM_RDFCTX_DR.GET_EXCEPTIONS_COUNT, DEBUG_TRACE);
<      END IF;
<    END IF;
< 
<     
<     
<     
<     FOR EI IN 1..L_BASEPOL.COUNT LOOP
<        SEM_RDFCTX_DR.SET_RDFCTX_INDEX_STATUS_VALID(
<               IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<               POLICY_PARTNAME, L_MODARR(EI));
<     END LOOP;
< 
<     
<     IF (IS_GLOBAL_IDX OR IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL) THEN
<       RDF_APIS_INTERNAL.KSDWRF('closing all the extraction drivers', DEBUG_TRACE);
<       FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<         L_EXTARR(EI).CLOSEDRIVER(); 
<       END LOOP;
<     END IF;
< 
<     STEP_NUM := 9;
<     RDF_APIS_INTERNAL.KSDWRF('starting step 9', DEBUG_TRACE);
<     IF (IS_GLOBAL_IDX OR IS_IDX_PARTITION) THEN 
<       
<       IF (L_LOAD_METHOD = 'BULKLOAD') THEN
<         BEGIN
<         FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: step_num='||STEP_NUM, DEBUG_TRACE);
<           SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, FALSE, STAGTAB, STAGVIEW, XINFOTAB, L_BATCH);
<           STAGTAB_SUFFIX := 
<             SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
< 
<           
<           IF (IS_IDX_PARTITION) THEN
<             PARTI_CLAUSE := ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
< 
<             SEM_RDFCTX_DR.GET_STAGTAB_PART_VIEW_NAME(
<               IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, FALSE,
<               STAGTAB, FALSE, STAGTAB_PART_VIEW_NAME);
<             STAGTAB_VIEW_NAME := STAGTAB_PART_VIEW_NAME;
<           ELSE
<             STAGTAB_VIEW_NAME := STAGVIEW || STAGTAB_SUFFIX;
<           END IF;
< 
< 
< 
< 
< 
< 
< 
< 
< 
<           EXECUTE IMMEDIATE 
<             'CREATE or REPLACE VIEW ' 
<             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE) 
<             ||' AS SELECT RDF$STC_GRAPH,RDF$STC_SUB,RDF$STC_PRED,RDF$STC_OBJ FROM ' 
<             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB || STAGTAB_SUFFIX, FALSE) 
<             || PARTI_CLAUSE
<             ||' WHERE RDF$STC_OBJ IS NOT NULL'
<              ;
<           EXECUTE IMMEDIATE 
<               'GRANT SELECT ON ' 
<  
<            || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
<             ||' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(), FALSE);
< 
<           SEM_RDFCTX_DR.BULK_LOAD_INTO_MODEL(L_MODARR(EI),L_USEDOPTS, 
<             IDXINFO.INDEXSCHEMA, STAGTAB || STAGTAB_SUFFIX, IDXINFO.INDEXPARTITION,
<             DOCURI2RID_NAMESQ, DOCVID2RID_NAMESQ, STAGTAB_VIEW_NAME, SYS_CONTEXT('USERENV','CURRENT_USER'), ROLES_AND_PRIVS);
< 
<           EXECUTE IMMEDIATE 
<               'DROP VIEW ' 
< 
<             || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
<              ;
< 
<         END LOOP;
< 
<         EXCEPTION WHEN OTHERS THEN
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: step_num='||STEP_NUM||' SQLERRM='||SQLERRM, DEBUG_TRACE);
<         END;
< 
<       END IF;
< 
<       STEP_NUM := 9.5;
<       
<       
<       IF (IS_IDX_PARTITION) THEN
<         PARTI_CLAUSE := ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
<       END IF;
< 
<       INS_INTO_DOCVID := 
<       'INSERT /*+ append */ INTO ' || 
<       SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAMESQ) || PARTI_CLAUSE || ' (docVid, docRid) ' ||
<       ' select v.value_id,u2r.docrid ' || 
<       ' from ' || MDSYS.SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'rdf_value$ v, ' || 
<       SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAMESQ) || PARTI_CLAUSE || ' u2r ' ||
<       ' where v.vname_prefix = ' || 
<       '        sem_apis.value_name_prefix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'') ' || 
<       '   and v.value_type=''UR'' ' || 
<       '   and v.vname_suffix = ' || 
<       '        sem_apis.value_name_suffix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'')'
<       ;
<       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for IndexCreate: ins_into_docVid=' || INS_INTO_DOCVID, DEBUG_TRACE);
< 
<       EXECUTE IMMEDIATE INS_INTO_DOCVID;
< 
<       ROWS_APPENDED := SQL%ROWCOUNT;
<       COMMIT;        
< 
<       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for IndexCreate: inserted into ' || DOCVID2RID_NAME || ': rowcount=' || ROWS_APPENDED, DEBUG_TRACE);
< 
<       STEP_NUM := 9.8;
<       
<       IF (L_LOAD_METHOD != 'BULKLOAD' AND NOT(KEEP_RDFCTX_STAGING_TABLES)) THEN
<         SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
<         IF (IS_IDX_PARTITION) THEN
<           EXECUTE IMMEDIATE 
<             'ALTER TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' TRUNCATE PARTITION ' 
<           ||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE);
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'non-bulk-load: TRUNCATEd staging table ' || STAGTAB_NAME 
<           ||' partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE), DEBUG_TRACE);
<         ELSE 
<           EXECUTE IMMEDIATE 'delete from '|| SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME);
<           COMMIT;
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF('non-bulk-load: DELETEd from staging table ' || STAGTAB_NAME, DEBUG_TRACE);
<         END IF;
<       END IF;
< 
<       STEP_NUM := 10;
<       RDF_APIS_INTERNAL.KSDWRF('starting step 10', DEBUG_TRACE);
<       
<       FOR PIDX IN 1 .. L_DEPPOL.COUNT LOOP
<         
<         
< 
<         SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
<             ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<             POLICY_PARTNAME, NLS_UPPER(L_DEPPOL(PIDX))); 
<       END LOOP; 
< 
<       STEP_NUM := 11;
<       RDF_APIS_INTERNAL.KSDWRF('starting step 11', DEBUG_TRACE);
<       
<       SEM_RDFCTX_DR.SET_DEFAULT_POLICY(
<                    IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                    POLICY_PARTNAME, NLS_UPPER(L_DEFPOL)); 
<       COMMIT;
<     END IF;
< 
<     STEP_NUM := 12;
<     RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<     IF (IS_GLOBAL_IDX OR IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL) THEN
< 
<       STEP_NUM := 12.1;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<       
<       IF (NOT(KEEP_RDFCTX_STAGING_TABLES)) THEN
<         SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME,XINFOTAB_NAME,L_BATCH);
<         MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: dropping staging table(s): ' || STAGTAB_NAME || '*', DEBUG_TRACE);
< 
<         
<         IF (L_LOAD_METHOD='BULKLOAD') THEN
<           FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<             STAGTAB_SUFFIX := 
<               SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
<             EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
<             MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<               'ODCIIndexCreate: dropped BULKLOAD staging table: '
<               || '(policy=' || NLS_UPPER(L_BASEPOL(EI) || ') ')
<               || STAGTAB_NAME || STAGTAB_SUFFIX, DEBUG_TRACE);
<             IF (XINFOTAB_NAME IS NOT NULL) THEN
<               EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(XINFOTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
<               MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<                 'ODCIIndexCreate: dropped xinfotab table: '
<                 || '(policy=' || NLS_UPPER(L_BASEPOL(EI) || ') ')
<                 || XINFOTAB_NAME || STAGTAB_SUFFIX, DEBUG_TRACE);
<             END IF;
<           END LOOP;
<         
<         ELSE
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'ODCIIndexCreate: non-bulk-load case: SKIPPED dropping the staging table: ' 
<           || STAGTAB_NAME, DEBUG_TRACE);
<         END IF;
<       END IF;
< 
<       STEP_NUM := 12.2;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<       
<       
<       IF (KEEP_RDFCTX_STAGING_TABLES) THEN
<         
<         
<         BEGIN
<           
<           IF (L_TBSNM IS NULL) THEN
<            SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
<             WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
<           END IF;
< 
<           DOCURI2RID_DEBUG := SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(SEM_RDFCTX_DR.GET_DOCURI2RID_DEBUG_NAME(IDXINFO.INDEXSCHEMA,DOCURI2RID_NAME));
<           STMT := 'CREATE TABLE ' || DOCURI2RID_DEBUG ||
<             ' (command VARCHAR2(100), partition VARCHAR2(128), snap_time TIMESTAMP, docUri VARCHAR2(4000), docRid ROWID) '
<             || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(L_TBSNM, FALSE);
<           RDF_APIS_INTERNAL.KSDWRF('creating debug table: stmt=' || STMT, DEBUG_TRACE);
< 
<           EXECUTE IMMEDIATE STMT;
<           EXCEPTION WHEN OTHERS THEN 
<             IF (SQLCODE != -942) THEN 
<               RDF_APIS_INTERNAL.KSDWRF('[Ignoring] SQLERRM=' || SQLERRM || ' [stmt=' || STMT || ']');
<             END IF;
<         END;
<         BEGIN
<           SNAP_TIME := SYSTIMESTAMP;
<           STMT := 
<             'INSERT INTO ' || DOCURI2RID_DEBUG || ' (command, partition, snap_time, docUri, docRid) ' ||
<             ' SELECT :cmd, :parti, :snap_time, docUri, docRid ' ||
<             ' FROM ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || PARTI_CLAUSE
<             ;
<           RDF_APIS_INTERNAL.KSDWRF('inserting into debug table: (' || SNAP_TIME || ') stmt=' || STMT, DEBUG_TRACE);
< 
<           EXECUTE IMMEDIATE STMT USING 'CREATE INDEX', IDXINFO.INDEXPARTITION, SNAP_TIME;
<           EXCEPTION WHEN OTHERS THEN 
<             RDF_APIS_INTERNAL.KSDWRF('[Ignoring] SQLERRM=' || SQLERRM || ' [stmt=' || STMT || ']');
<         END;
<       END IF;
<       EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' PURGE';
< 
<       
<       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, DOCURI2RID, DOCVID2RID);
<       SEM_RDFCTX_IR.CREATE_MAPTABLE_INDEXES(IDXINFO.INDEXSCHEMA, DOCVID2RID, NOT(IS_GLOBAL_IDX));
<                                             
<     END IF; 
< 
<     STEP_NUM := 13;
<     RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<     IF (IS_ADD_PARTITION) THEN
<       STEP_NUM := 13.1;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<      
<       SEM_RDFCTX_DR.SET_DEFAULT_POLICY(
<                    IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                    POLICY_PARTNAME, NLS_UPPER(L_DEFPOL));
< 
<       STEP_NUM := 13.2;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<       
<       EXECUTE IMMEDIATE 'alter table ' || 
<                          SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAMESQ) ||
<                         ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE);
<       STEP_NUM := 13.3;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<       EXECUTE IMMEDIATE 'alter table ' || 
<                          SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) ||
<                         ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE);
<       STEP_NUM := 13.4;
<       RDF_APIS_INTERNAL.KSDWRF('starting step ' || STEP_NUM, DEBUG_TRACE);
<       COMMIT; 
<     END IF;
< 
<     RDF_APIS_INTERNAL.KSDWRF('returning from ODCIIndexCreate', DEBUG_TRACE);
<     RETURN ODCICONST.SUCCESS;
< 
<   EXCEPTION WHEN OTHERS THEN 
<     MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexCreate: RAISING: step_num=' || STEP_NUM ||
<       CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK ||
<       CHR(10) || '[' || CHR(10)|| DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || CHR(10) || ']' || 
<       CHR(10) || 'stmt=' || CHR(10) || STMT
<     );
<     RAISE; 
<   END ODCIINDEXCREATE; 
---
>     SEM_RDFCTX_DR.ODCIINDEXCREATE_PR(IDXINFO, IDXPARMS, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXCREATE;
784,791c37
<     STAGTAB_NAME    VARCHAR2(270);
<     STAGVIEW_NAME   VARCHAR2(270);
<     DUMMY_XINFOTAB_NAME   VARCHAR2(270);
<     
<     DOCURI2RID_NAME    VARCHAR2(270);
<     DOCVID2RID_NAME    VARCHAR2(270);
<     ROLES_AND_PRIVS    VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
793,873c39,41
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
< 
<     COMMIT; 
< 
< 
< 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, 
<                        DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<     
<     IF (IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) THEN
<       SEM_RDFCTX_DR.DROP_RDFCTX_INDEX (ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,   
<                                      IDXINFO.INDEXNAME, IDXINFO.INDEXNAME);
<     ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<        SEM_RDFCTX_DR.DROP_RDFCTX_INDEX (ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,   
<                                      IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION);
<        BEGIN
<        EXECUTE IMMEDIATE 'alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                    || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
<                    || ' update indexes';
<        EXCEPTION
<          WHEN OTHERS THEN
<            IF (SQLCODE = -14083) THEN
<              EXECUTE IMMEDIATE 
<                'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || ' purge';
<            ELSE
<              RAISE;
<            END IF;
<        END;
<        
<     END IF;
<     COMMIT;
< 
<     
<     IF ((IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) OR
<          (IDXENV.CALLPROPERTY = SYS.ODCICONST.FINALCALL)) THEN
<       SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                                      NULL, TRUE, STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
<       BEGIN
<          COMMIT;
<          EXECUTE IMMEDIATE 
<            'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' purge';
<          COMMIT;
<       EXCEPTION WHEN OTHERS THEN
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<            'error dropping staging table: ' || STAGTAB_NAME
<          ||': ' || SQLERRM
<          ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
<       END;
< 
<       
<       BEGIN
<         EXECUTE IMMEDIATE 
<           'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' purge';
<         EXCEPTION WHEN OTHERS THEN 
<         IF (SQLCODE != -942) THEN
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'error dropping docUri2Rid mapping table:' || DOCURI2RID_NAME
<           ||': ' || SQLERRM
<           ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
<         END IF;
<       END;
< 
<       BEGIN
<         EXECUTE IMMEDIATE 
<           'drop table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || ' purge';
<         EXCEPTION WHEN OTHERS THEN 
<         IF (SQLCODE != -942) THEN
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'error dropping docVid2Rid mapping table:' || DOCVID2RID_NAME
<           ||': ' || SQLERRM
<           ||' [' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || ']');
<         END IF;
<       END;
< 
<     END IF;
<     RETURN ODCICONST.SUCCESS;
<   END ODCIINDEXDROP; 
---
>     SEM_RDFCTX_DR.ODCIINDEXDROP_PR(IDXINFO, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXDROP;
883,942c51
<     L_DUMVR          VARCHAR2(300);
<     L_POLLST         SYS.ODCIVARCHAR2LIST;
<     L_USEDOPTS       SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
<     L_EXTRPARAMS     SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); 
<     L_ROWCNT         NUMBER;
<     L_LOAD_METHOD    VARCHAR2(128) := 'DML';
<     L_DEFPOL         VARCHAR2(130);
<     L_BASEPOL        SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
<     L_BATCHPOL       SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST(); 
<     L_BATCHPOL_COUNT PLS_INTEGER;
<     L_DEPPOL         SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
<     L_FLAGS          SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_TBSNM          VARCHAR2(130);
<     STAGTAB_NAME     VARCHAR2(270);
<     STAGVIEW_NAME    VARCHAR2(270);
<     XINFOTAB_NAME    VARCHAR2(270);
<     STAGTAB_SUFFIX   VARCHAR2(128);
<     DOCURI2RID_NAME  VARCHAR2(270);
<     DOCURI2RID       VARCHAR2(128);
<     DOCVID2RID_NAME  VARCHAR2(270);
<     DOCVID2RID       VARCHAR2(128);
<     L_MODARR         SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_EXTARR         MDSYS.T_EXTARR := MDSYS.T_EXTARR();
<     L_POLRIDS        SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST();
<     L_CTXPREF        FN_XMLPREF := FN_XMLPREF();
<     L_ERRCNT         SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     T_EXTARR         FN_EXTARR := FN_EXTARR();
<     FILTERPL         VARCHAR2(130) := NULL;
<     FILEDIR          VARCHAR2(512) := NULL;
<     STATUS           NUMBER;
<     PARTI_CLAUSE     VARCHAR2(1000) := NULL;
<     INS_INTO_DOCVID  VARCHAR2(4000);
<     PARTI_DETAILS    VARCHAR2(1000);
<     STAGTAB          VARCHAR2(130);
<     STAGVIEW         VARCHAR2(130);
<     XINFOTAB         VARCHAR2(130);
<     STAGTAB_VIEW_NAME        VARCHAR2(128);
<     STAGTAB_PART_VIEW_NAME   VARCHAR2(128) := NULL;
<     IS_PARTITION_REBLD   BOOLEAN := FALSE;
<     ADD_POLICY       BOOLEAN := FALSE;
<     DROP_POLICY      BOOLEAN := FALSE;
<     PLAIN_REBUILD    BOOLEAN := FALSE;
<     REBUILD_POLICY   BOOLEAN := FALSE;
<     PARTITION_NAME   VARCHAR2(130);
<     STMT             VARCHAR2(32767);
<     CNT              NUMBER;
<     IS_PARTN_TBL     NUMBER;
<     IS_DEP_POLICY    BOOLEAN := FALSE;
<     POLICY_EXISTS    BOOLEAN := FALSE;
< 
<     ROLES_AND_PRIVS  VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
< 
<     L_BATCH          BOOLEAN := FALSE;
<     BATCH_INTERFACE_OPTION CONSTANT VARCHAR2(100) := 'INTERFACE=BATCH';
< 
<     STEP_NUM         NUMBER := 0;
<     ROWS_APPENDED    NUMBER;
<     POL_OPTIONS      NUMBER := 0;
< 
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
944,1320c53,55
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     COMMIT; 
<     
<     
<     
< 
< 
<     
<     
<     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<     
< 
<     IF (ALTOPT = SYS.ODCICONST.ALTERINDEXREBUILD) THEN
< 
<       
<       
<       SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, 
<                                      DOCURI2RID, DOCVID2RID);
< 
<       SELECT COUNT(*) INTO CNT FROM SYS.USER_TABLES WHERE TABLE_NAME=DOCVID2RID;
<       RDF_APIS_INTERNAL.KSDWRF('count(*)=' || CNT || ' for table=' || DOCVID2RID, DEBUG_TRACE);
<       IF (CNT=0) THEN SEM_RDFCTX_IR.CREATE_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID); END IF;
< 
<       
<       IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<          IS_PARTITION_REBLD := TRUE;
<          PARTITION_NAME := IDXINFO.INDEXPARTITION;
<       ELSE
<          PARTITION_NAME := IDXINFO.INDEXNAME;
<       END IF;
<         
<       
<       BEGIN
<         L_DUMVR := SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXNAME,FALSE);
<       EXCEPTION
<         WHEN OTHERS THEN
<           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                   'invalid name for the index');
<        
<       END;
< 
<       
<       IF (IDXPARMS IS NOT NULL) THEN
<         BEGIN
<           L_POLLST := SEM_RDFCTX_DR.PRVT_PARAMS_PARSER(IDXPARMS, L_USEDOPTS, L_EXTRPARAMS); 
<         EXCEPTION 
<           WHEN OTHERS THEN 
<             EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values (1, 
<                                ''invalid or empty parameters passed to the index'')';
<             RETURN SYS.ODCICONST.WARNING;
<         END; 
< 
<         SELECT COUNT(DISTINCT(COLUMN_VALUE)) INTO L_ROWCNT FROM TABLE(L_POLLST); 
<  
<         
<         FOR OPT IN (SELECT DISTINCT COLUMN_VALUE FROM TABLE(L_USEDOPTS)) LOOP
<           RDF_APIS_INTERNAL.KSDWRF('AlterIndexRebuild option=' || OPT.COLUMN_VALUE || '*', DEBUG_TRACE);
<           IF (TRIM(OPT.COLUMN_VALUE) = 'LOAD_METHOD=BULK') THEN 
<             L_LOAD_METHOD := 'BULKLOAD'; 
<             RDF_APIS_INTERNAL.KSDWRF('l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
<           ELSIF (TRIM(OPT.COLUMN_VALUE) = BATCH_INTERFACE_OPTION) THEN
<             L_LOAD_METHOD := 'BULKLOAD';
<             L_BATCH := TRUE;
<             RDF_APIS_INTERNAL.KSDWRF('rebuild: interface=BATCH', DEBUG_TRACE);
<             RDF_APIS_INTERNAL.KSDWRF('rebuild: l_load_method set to: ' || L_LOAD_METHOD, DEBUG_TRACE);
<           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'ADD_POLICY') THEN
<             ADD_POLICY := TRUE;
<             POL_OPTIONS := POL_OPTIONS + 1;
<           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'DROP_POLICY') THEN
<             DROP_POLICY := TRUE;
<             POL_OPTIONS := POL_OPTIONS + 1;
<           ELSIF (TRIM(OPT.COLUMN_VALUE) = 'REBUILD_POLICY') THEN
<             REBUILD_POLICY := TRUE;
<             POL_OPTIONS := POL_OPTIONS + 1;
<           END IF;
<         END LOOP;
< 
<         
<         IF (POL_OPTIONS > 1) THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<             ''cannot ADD/DROP/REBUILD policies for the index at the same time'')';
<           RETURN SYS.ODCICONST.WARNING;
<         END IF;
< 
<         
<         IF ((ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY) AND (L_POLLST.COUNT > 1)) THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<             '' cannot ADD OR DROP OR REBUILD multiple policies for the index at the same time'')';
<           RETURN SYS.ODCICONST.WARNING;
<         END IF;
< 
<         
<         IF ((ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY) AND (L_POLLST.COUNT = 0 )) THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<             '' policy name needs to be specified for  ADD OR DROP OR REBUILD policy'')';
<           RETURN SYS.ODCICONST.WARNING;
<         END IF;
< 
<         
<         IF (NOT(ADD_POLICY OR DROP_POLICY OR REBUILD_POLICY)) THEN
<           IF (L_POLLST.COUNT > 0) THEN
<             EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<               ''Cannot specify new policies during rebuild'')';
<             RETURN SYS.ODCICONST.WARNING;
<           ELSE
<             PLAIN_REBUILD := TRUE;
<           END IF;
<         END IF;
<       ELSE
<         
<         PLAIN_REBUILD := TRUE;  
<       END IF;
< 
<       IF (PLAIN_REBUILD) THEN
<           
<           L_CTXPREF.EXTEND;
<           SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                          PARTITION_NAME, L_POLRIDS, L_MODARR,
<                                          L_EXTARR, L_CTXPREF(1), L_BASEPOL,
<                                          L_EXTRPARAMS, L_FLAGS);
<  
<           
<           SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                               PARTITION_NAME);
<       END IF;
< 
<       
<       IF (REBUILD_POLICY) THEN
<         
<         L_EXTARR.EXTEND;
<         L_POLRIDS.EXTEND; 
<         L_CTXPREF.EXTEND;
<         L_MODARR.EXTEND;
<         L_BASEPOL.EXTEND;
<        
<         
<         BEGIN
<           L_MODARR(1) := SEM_RDFCTX_DR.GET_MODEL_ID(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, PARTITION_NAME, NLS_UPPER(L_POLLST(1)));
<         EXCEPTION
<           WHEN OTHERS THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<                   ''the specified index-policy combination does not exist'')';
< 
<           RETURN SYS.ODCICONST.WARNING;
<         END;
< 
<         
<         IF (L_MODARR(1) < 0) THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<                   ''cannot REBUILD a dependent policy for the index with the rebuild_policy option'')';
< 
<           RETURN SYS.ODCICONST.WARNING;
<         END IF;
<         
<         L_BASEPOL(1) := L_POLLST(1);
<         SEM_RDFCTX_DR.GET_POLICY_INFO (
<                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(1)),
<                       L_POLRIDS(1), L_EXTARR(1), L_CTXPREF(1));
< 
<         
<         SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                               PARTITION_NAME, L_POLRIDS(1));
<         
<       END IF;
<  
<       
<       IF (DROP_POLICY) THEN
<         SEM_RDFCTX_DR.DROP_INDEX_POLICY(SDO_RDF.GET_ROLES_AND_PRIVS(), IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                         PARTITION_NAME, NLS_UPPER(L_POLLST(1)), STATUS);
<         IF (STATUS != 0) THEN
<           EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<               ''Specified policy could not be dropped for the index'')';
<             RETURN SYS.ODCICONST.WARNING;
<         END IF;
<       ELSE      
<          SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                                         IDXINFO.INDEXPARTITION, TRUE, STAGTAB_NAME, STAGVIEW_NAME
<                                        ,XINFOTAB_NAME,L_BATCH
<                                         );
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Staging table during rebuild : '||STAGTAB_NAME, DEBUG_TRACE);
<          
<          SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE, 
<                                         DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('DocUri2Rid table during rebuild: ' || DOCURI2RID_NAME, DEBUG_TRACE);
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('DocVid2Rid table during rebuild: ' || DOCVID2RID_NAME, DEBUG_TRACE);
<          
<          IF (IDXINFO.INDEXPARTITION IS NULL) THEN
<            EXECUTE IMMEDIATE 'truncate table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME);
<          ELSE
<            EXECUTE IMMEDIATE 
<                     ' alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                     || ' truncate partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE)
<                     || ' update indexes';
<          END IF;
<          
<          
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
<          SELECT UU.DEFAULT_TABLESPACE INTO L_TBSNM FROM SYS.USER_USERS UU 
<               WHERE UU.USERNAME=IDXINFO.INDEXSCHEMA;
< 
<          IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<            PARTI_DETAILS := 'partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' tablespace ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(L_TBSNM, FALSE);
<          END IF;
< 
<          
<          
<          IF ((L_LOAD_METHOD != 'BULKLOAD') AND (IDXINFO.INDEXPARTITION IS NOT NULL)) THEN
<            SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME, NULL, NULL, PARTI_DETAILS, FALSE);
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('rebuild: created staging table ' || STAGTAB_NAME || PARTI_DETAILS, DEBUG_TRACE);
<          END IF;
<         
<          IF (ADD_POLICY) THEN
<            
<            L_EXTARR.EXTEND;
<            L_POLRIDS.EXTEND; 
<            L_CTXPREF.EXTEND;
<            L_MODARR.EXTEND;
< 
<            BEGIN
<              SEM_RDFCTX_DR.SPLIT_POLICY_LIST(IDXINFO.INDEXSCHEMA, L_POLLST,
<                             L_BASEPOL, L_DEPPOL);
<            EXCEPTION
<              WHEN OTHERS THEN
<                IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<                  EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
<                END IF;
<                EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<                     ''cannot add a non-existent policy to the index'')';
<                RETURN SYS.ODCICONST.WARNING;
<            END;
< 
<            
<            POLICY_EXISTS := SEM_RDFCTX_DR.IS_INDEX_POLICY(IDXINFO.INDEXSCHEMA, 
<                                IDXINFO.INDEXNAME,PARTITION_NAME, L_BASEPOL(1));
< 
<            IF (ADD_POLICY AND POLICY_EXISTS AND (L_DEPPOL.COUNT = 0)) THEN
<              
<              
<              EXECUTE IMMEDIATE 'insert into sys.odci_warnings$ values(1,
<                   ''cannot ADD an already existing policy to the index'')';
< 
<              IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<                EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
<              END IF;
<              RETURN SYS.ODCICONST.WARNING;
<            END IF;
< 
<            
<            
<            IF (NOT POLICY_EXISTS) THEN
<              SEM_RDFCTX_DR.GET_POLICY_INFO (
<                       IDXINFO.INDEXSCHEMA, NLS_UPPER(L_BASEPOL(1)),
<                       L_POLRIDS(1), L_EXTARR(1), L_CTXPREF(1));
< 
<              L_MODARR(1) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX(IDXINFO.INDEXSCHEMA,
<                              IDXINFO.INDEXNAME, PARTITION_NAME, L_POLRIDS(1),
<                              SEM_RDFCTX_DR.INDST_INPROGRESS, L_TBSNM, L_EXTRPARAMS(1));
<            END IF;
<          END IF;
< 
<          IF (L_CTXPREF(1) IS NOT NULL AND 
<                  L_CTXPREF(1).EXTRACT('//Datastore') IS NULL) THEN 
<            L_CTXPREF(1) := NULL; 
<          ELSIF (L_CTXPREF(1) IS NOT NULL AND 
<                  NLS_UPPER(L_CTXPREF(1).EXTRACT('//Datastore/@type').GETSTRINGVAL())
<                                                             = 'FILE') THEN 
<            FILEDIR := TRIM(L_CTXPREF(1).EXTRACT(
<                           '//Datastore/Path/text()').GETSTRINGVAL());
<            SELECT COUNT(*) INTO L_ROWCNT FROM SYS.ALL_DIRECTORIES WHERE 
<                DIRECTORY_NAME = FILEDIR; 
<            IF (L_ROWCNT = 0) THEN 
<              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                 'directory object '||FILEDIR||' does not exist or is inaccessible'); 
<            END IF; 
<          END IF; 
< 
<          
<          IF (NOT POLICY_EXISTS) THEN
<          L_BATCHPOL_COUNT := 0;
<          FOR PIDX IN 1..L_EXTARR.COUNT LOOP
<            T_EXTARR.EXTEND;
<            L_ERRCNT.EXTEND;
<            L_ERRCNT(PIDX) := 0;
<            L_BATCHPOL.EXTEND; 
<            L_BATCHPOL(PIDX) := 0;
< 
<            
<            IF (XINFOTAB_NAME IS NOT NULL) THEN
<              IF NLS_UPPER(L_EXTARR(PIDX).GETCONTEXT(BATCH_INTERFACE_OPTION)) IN ('YES','Y') THEN
<                L_BATCHPOL(PIDX) := 1;
<                L_BATCHPOL_COUNT := L_BATCHPOL_COUNT + 1;
<              END IF;
<            END IF;
< 
<            
<            IF (L_LOAD_METHOD = 'BULKLOAD') THEN
<              STAGTAB_SUFFIX := 
<                SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(PIDX)),L_POLRIDS(PIDX));
<              IF (IDXINFO.INDEXPARTITION IS NULL) THEN
<                SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,L_TBSNM,STAGTAB_SUFFIX, NULL,FALSE, XINFOTAB_NAME);
<              ELSE
<                SEM_RDFCTX_IR.CREATE_STAGING_TABLE(STAGTAB_NAME,NULL,STAGTAB_SUFFIX, PARTI_DETAILS,FALSE, XINFOTAB_NAME);
<              END IF;
<            END IF;  
< 
<            T_EXTARR(PIDX) := L_EXTARR(PIDX);
< 
<            
<            L_EXTARR(PIDX).STARTDRIVER();       
<          
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Extraction driver started in Alter', DEBUG_TRACE);
<          END LOOP;  
< 
<          IF (L_CTXPREF(1) IS NOT NULL) THEN 
<            IF (IDXINFO.INDEXCOLS(1).COLTYPENAME != 'VARCHAR2') THEN 
<              MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                'FILE/URL datastores only allowed with VARCHAR2 columns'); 
<            END IF; 
<            IF (L_CTXPREF(1).EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
<              FILTERPL := NLS_UPPER(L_CTXPREF(1).EXTRACT(
<                                     '//Datastore/@filter').GETSTRINGVAL()); 
<            END IF; 
<          END IF;
< 
<          
<          
<            IF (IDXINFO.INDEXPARTITION IS NULL) THEN
<              SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME, NULL, L_TBSNM, NULL);
<            ELSE
<              SEM_RDFCTX_IR.CREATE_MAPPING_TABLES(NULL, DOCURI2RID_NAME, NULL, NULL, PARTI_DETAILS);
<            END IF;
<          
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('initial setup done for rebuilding index', DEBUG_TRACE);
< 
<          SEM_RDFCTX_IR.POPULATE_INDEX_SEGMENT(
<            IDXINFO, FILEDIR, FILTERPL, L_BASEPOL, L_EXTRPARAMS, L_CTXPREF, T_EXTARR, L_MODARR, L_POLRIDS
<          , L_LOAD_METHOD, STAGTAB_NAME, DOCURI2RID_NAME, DOCVID2RID_NAME
<          , XINFOTAB_NAME, L_BATCHPOL, L_BATCHPOL_COUNT);
< 
<          FOR EI IN 1..L_BASEPOL.COUNT LOOP
<            
<            SEM_RDFCTX_DR.SET_RDFCTX_INDEX_STATUS_VALID(
<                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                  PARTITION_NAME, L_MODARR(EI));
---
>     SEM_RDFCTX_DR.ODCIINDEXALTER_PR(IDXINFO, IDXPARMS, ALTOPT, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXALTER;
1322,1477d56
<            
<            L_EXTARR(EI).CLOSEDRIVER();      
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Extraction driver closed in Alter', DEBUG_TRACE);
<          END LOOP;
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter', DEBUG_TRACE);
<          IF (L_LOAD_METHOD = 'BULKLOAD') THEN
<            BEGIN
<              SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                                             IDXINFO.INDEXPARTITION, FALSE, STAGTAB, STAGVIEW
<                                            ,XINFOTAB, L_BATCH);
< 
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('staging table for bulkload during index rebuild : ' ||STAGTAB, DEBUG_TRACE);
<              FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<                MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing during index rebuild', DEBUG_TRACE);
<                STAGTAB_SUFFIX := SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
<                MDSYS.RDF_APIS_INTERNAL.KSDWRF('staging table suffix for bulkload during index rebuild : ' ||STAGTAB_SUFFIX, DEBUG_TRACE);
< 
<                IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<                  PARTI_CLAUSE :=  ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
<                  
<                  SEM_RDFCTX_DR.GET_STAGTAB_PART_VIEW_NAME(
<                      IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, FALSE,
<                       STAGTAB, TRUE, STAGTAB_PART_VIEW_NAME);
<                  STAGTAB_VIEW_NAME := STAGTAB_PART_VIEW_NAME;
<                ELSE
<                  STAGTAB_VIEW_NAME := STAGVIEW || STAGTAB_SUFFIX;
<                END IF;
< 
<                EXECUTE IMMEDIATE 
<                     'CREATE or REPLACE VIEW ' 
<                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME , FALSE)
<                   ||' AS SELECT RDF$STC_GRAPH,RDF$STC_SUB,RDF$STC_PRED,RDF$STC_OBJ FROM ' 
<                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB || STAGTAB_SUFFIX, FALSE) 
<                   || PARTI_CLAUSE
<                   ||' WHERE RDF$STC_OBJ IS NOT NULL'
<                    ;
<                EXECUTE IMMEDIATE 
<                     'GRANT SELECT ON ' 
<                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
<                   ||' to ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(SDO_RDF_INTERNAL.GET_NETWORK_OWNER(), FALSE);
< 
<                MDSYS.RDF_APIS_INTERNAL.KSDWRF('About to start BULKLOAD in Alter', DEBUG_TRACE);
<                SEM_RDFCTX_DR.BULK_LOAD_INTO_MODEL(L_MODARR(EI),L_USEDOPTS, 
<                     IDXINFO.INDEXSCHEMA, STAGTAB || STAGTAB_SUFFIX, IDXINFO.INDEXPARTITION,
<                     DOCURI2RID_NAME, DOCVID2RID_NAME, STAGTAB_VIEW_NAME, SYS_CONTEXT('USERENV','CURRENT_USER'), ROLES_AND_PRIVS);
< 
<                  EXECUTE IMMEDIATE 
<                     'DROP VIEW ' 
<                   || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXSCHEMA, FALSE) || '.' || SYS.DBMS_ASSERT.ENQUOTE_NAME(STAGTAB_VIEW_NAME, FALSE)
<                  ;
< 
<              END LOOP;
< 
<              EXCEPTION WHEN OTHERS THEN
<               MDSYS.RDF_APIS_INTERNAL.KSDWRF('bulk-load issuing: SQLERRM='||SQLERRM);
<            END;
<          END IF; 
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: populate docVid2Rid table: ' || DOCVID2RID_NAME, DEBUG_TRACE);
<          BEGIN
<          
<          IF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<            PARTI_CLAUSE :=  ' partition('||SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION,FALSE)||')';
<          END IF;
< 
<          INS_INTO_DOCVID := 
<            'INSERT /*+ append */ INTO ' || 
<             SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) || PARTI_CLAUSE || ' (docVid, docRid) ' ||
<             ' select v.value_id,u2r.docrid ' || 
<             ' from ' || MDSYS.SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'rdf_value$ v, ' || 
<             SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || PARTI_CLAUSE || ' u2r ' ||
<             ' where v.vname_prefix = ' || 
<             '        sem_apis.value_name_prefix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'') ' || 
<             '   and v.value_type=''UR'' ' || 
<             '   and v.vname_suffix = ' || 
<             '        sem_apis.value_name_suffix(substr(u2r.docUri,2,length(u2r.docUri)-2),''UR'')'
<             ;
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: ins_into_docVid=' || INS_INTO_DOCVID, DEBUG_TRACE);
< 
<          EXECUTE IMMEDIATE INS_INTO_DOCVID;
< 
<          ROWS_APPENDED := SQL%ROWCOUNT;
<          COMMIT;        
< 
<          MDSYS.RDF_APIS_INTERNAL.KSDWRF('Postprocessing for Alter: inserted into ' || DOCVID2RID_NAME 
<            || ': rowcount=' || ROWS_APPENDED, DEBUG_TRACE);
< 
<          EXCEPTION WHEN OTHERS THEN
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('IndexAlter postprocessing: issuing: ins_into_docVid=' 
<              || INS_INTO_DOCVID
<              || ' SQLERRM='||SQLERRM);
<          END;
< 
<          END IF; 
< 
<          IF (ADD_POLICY AND L_DEPPOL.COUNT != 0) THEN
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('Adding the dependent policy during Alter', DEBUG_TRACE);
<            SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
<                   ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                   PARTITION_NAME, NLS_UPPER(L_DEPPOL(1)));
<          END IF;
< 
<          
<          IF (PLAIN_REBUILD) THEN
<            SEM_RDFCTX_DR.GET_DEP_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                               PARTITION_NAME, L_DEPPOL);
<            IF (L_DEPPOL IS NOT NULL AND L_DEPPOL.COUNT > 0) THEN
<              FOR PIDX IN 1 .. L_DEPPOL.COUNT LOOP
<                
<                
<                MDSYS.RDF_APIS_INTERNAL.KSDWRF('Adding the dependent policy during Rebuild', DEBUG_TRACE);
<                SEM_RDFCTX_DR.CREATE_VIRTUAL_RDFCTX_INDEX (
<                   ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                   PARTITION_NAME, NLS_UPPER(L_DEPPOL(PIDX))); 
<              END LOOP;
<            END IF;
<          END IF;
< 
<          COMMIT;
< 
<          STEP_NUM := 9;
<          
<          IF (L_LOAD_METHOD = 'BULKLOAD' AND (NOT POLICY_EXISTS)) THEN
<            FOR EI IN 1 .. L_BASEPOL.COUNT LOOP
<              STAGTAB_SUFFIX := SEM_RDFCTX_DR.GET_STAGTAB_SUFFIX(NLS_UPPER(L_BASEPOL(EI)),L_POLRIDS(EI));
<              EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME || STAGTAB_SUFFIX) || ' PURGE';
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('ODCIIndexAlter: dropped BULKLOAD staging table: ' 
<              || 'DROP TABLE ' || STAGTAB_NAME || STAGTAB_SUFFIX || ' PURGE', DEBUG_TRACE);
<            END LOOP;
<          ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN
<            EXECUTE IMMEDIATE 'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) || ' PURGE';
<          END IF;
< 
<          STEP_NUM := 10;
<          
<          STMT :=  'DROP TABLE ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCURI2RID_NAME) || ' PURGE';
<          BEGIN
<            EXECUTE IMMEDIATE STMT;
<            EXCEPTION WHEN OTHERS THEN
<              MDSYS.RDF_APIS_INTERNAL.KSDWRF('Failed during ODCIIndexAlter: step_num=' || STEP_NUM || ' stmt=' || STMT);
<          END;
< 
<       END IF; 
<     ELSE
<       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<           'ALTER INDEX (other than rebuild partition not supported for RDFCTX indexes'); 
<     END IF; 
<     RETURN ODCICONST.SUCCESS;
< 
<     EXCEPTION WHEN OTHERS THEN
<       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Failed during ODCIIndexAlter: step_num=' 
<         || STEP_NUM || ' stmt=' || STMT || ' SQLERRM=' || SQLERRM);
<       RETURN ODCICONST.SUCCESS;
<   END ODCIINDEXALTER; 
< 
1484,1513c63,67
<     DOCURI2RID_NAME    VARCHAR2(270);
<     DOCVID2RID_NAME    VARCHAR2(270);
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<   BEGIN 
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     COMMIT; 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
<                                    DOCVID2RID_NAME);
< 
<     IF (IDXENV.CALLPROPERTY IS NULL AND IDXINFO.INDEXPARTITION IS NULL) THEN
<       SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX (IDXINFO.INDEXSCHEMA,   
<                                          IDXINFO.INDEXNAME, IDXINFO.INDEXNAME);
<       EXECUTE IMMEDIATE 'truncate table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME);
<     ELSIF (IDXINFO.INDEXPARTITION IS NOT NULL) THEN 
<       SEM_RDFCTX_DR.TRUNCATE_RDFCTX_INDEX (IDXINFO.INDEXSCHEMA,   
<                                          IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION);
<    
<       EXECUTE IMMEDIATE ' alter table ' ||  SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                          || ' truncate partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) 
<                          || ' update indexes';
<     END IF;
< 
<     COMMIT; 
<     RETURN ODCICONST.SUCCESS;
<   END ODCIINDEXTRUNCATE; 
---
>     RETURNVAL NUMBER;
>   BEGIN
>     SEM_RDFCTX_DR.ODCIINDEXTRUNCATE_PR(IDXINFO, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXTRUNCATE;
1524,1539c78
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
<     L_MODIDX   SYS.ODCINUMBERLIST;
<     L_EXTARR   MDSYS.T_EXTARR;
<     L_EXTPREF  SYS.XMLTYPE;
<     L_TBSNM    VARCHAR2(128);
<     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     L_MODARR   SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_FLAGS    SYS.ODCINUMBERLIST;
<     DOCURI2RID_NAME    VARCHAR2(270);
<     DOCVID2RID_NAME    VARCHAR2(270);
<     STAGTAB_NAME       VARCHAR2(270);
<     STAGVIEW_NAME      VARCHAR2(270);
<     L_POLNAMES SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     ROLES_AND_PRIVS     VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
1541,1598c80,82
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE,
<                                     STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
<                                      DOCVID2RID_NAME);
<     IF (PART2_NAME IS NOT NULL) AND (IDXINFO.INDEXPARTITION IS NOT NULL) AND
<        (PART1_NAME IS NOT NULL) THEN
<       
<       
<       L_TBSNM := SDO_RDF_INTERNAL.GET_CALLCONTEXT_VC_ATTR('VALUES_TABLESPACE');
< 
<       
<       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                        IDXINFO.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
<                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
< 
<       FOR EI IN 1..L_EXTARR.COUNT LOOP
<         L_MODARR.EXTEND;
<         
<         L_MODARR(EI) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
<                           IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                           PART2_NAME.INDEXPARTITION, L_POLRIDS(EI), 
<                           L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
< 
<          
<          SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
<                                       IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, L_POLRIDS(EI));
< 
<       END LOOP;
< 
<       
<       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                        PART1_NAME.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
<                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
< 
<       FOR EI IN 1..L_EXTARR.COUNT LOOP     
<          
<          
<          SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
<                                      IDXINFO.INDEXNAME, PART1_NAME.INDEXPARTITION, L_POLRIDS(EI));
<       END LOOP;
< 
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                         || ' merge partitions ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ',' 
<                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE) || ' into partition ' 
<                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE) || ' update indexes';
< 
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
<                         || ' merge partitions ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ',' 
<                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE) || ' into partition ' 
<                         || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE) || ' update indexes';
<     END IF;
<     RETURN SYS.ODCICONST.SUCCESS;
---
>     SEM_RDFCTX_DR.ODCIINDEXMERGEPARTITION_PR(IDXINFO, PART1_NAME, PART2_NAME, 
>     				             IDXPARMS, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
1610,1626c94
<     L_POLRIDS   SYS.ODCIVARCHAR2LIST;
<     L_MODIDX    SYS.ODCINUMBERLIST;
<     L_EXTARR    MDSYS.T_EXTARR;
<     L_EXTPREF   SYS.XMLTYPE;
<     L_TBSNM     VARCHAR2(128);
<     L_MODARR    SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     L_FLAGS      SYS.ODCINUMBERLIST;
<     PIDX        NUMBER := 0;
<     DOCURI2RID_NAME    VARCHAR2(270);
<     DOCVID2RID_NAME    VARCHAR2(270);
<     STAGTAB_NAME       VARCHAR2(270);
<     STAGVIEW_NAME      VARCHAR2(270);
<     L_POLNAMES SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     ROLES_AND_PRIVS     VARCHAR2(4000) := SDO_RDF.GET_ROLES_AND_PRIVS();
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
1628,1696c96,98
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE,
<                                     STAGTAB_NAME, STAGVIEW_NAME, DUMMY_XINFOTAB_NAME);
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
<                                      DOCVID2RID_NAME);
< 
<     IF (PART1_NAME IS NOT NULL AND PART2_NAME IS NOT NULL ) THEN
<       
<       
<       L_TBSNM := SDO_RDF_INTERNAL.GET_CALLCONTEXT_VC_ATTR('VALUES_TABLESPACE');
< 
<       
<       SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                        IDXINFO.INDEXPARTITION, L_POLRIDS, L_MODIDX, 
<                                        L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
< 
<       FOR EI IN 1..L_EXTARR.COUNT LOOP
<         L_MODARR.EXTEND;
<         PIDX := PIDX + 1;
<         
<         L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
<                                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                                  PART1_NAME.INDEXPARTITION, L_POLRIDS(EI), 
<                                  L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
< 
<         L_MODARR.EXTEND;
<         PIDX := PIDX + 1;
<         L_MODARR(PIDX) := SEM_RDFCTX_DR.CREATE_RDFCTX_INDEX (
<                                  IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, 
<                                  PART2_NAME.INDEXPARTITION, L_POLRIDS(EI), 
<                                  L_FLAGS(EI), L_TBSNM, L_EXTRPARAMS(EI));
< 
<         
<         SEM_RDFCTX_DR.DROP_RDFCTX_INDEX(ROLES_AND_PRIVS, IDXINFO.INDEXSCHEMA,
<                                       IDXINFO.INDEXNAME, IDXINFO.INDEXPARTITION, L_POLRIDS(EI));
<       END LOOP;
<       COMMIT;
< 
<       
<       
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE);
<       COMMIT;
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
<                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART1_NAME.INDEXPARTITION, FALSE);
<       COMMIT;
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE);
<       COMMIT;
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
<                          || ' add partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PART2_NAME.INDEXPARTITION, FALSE);
<       COMMIT;
< 
<       
<       
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                          || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' update indexes';
<       COMMIT;
<       EXECUTE IMMEDIATE ' alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(STAGTAB_NAME) 
<                          || ' drop partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(IDXINFO.INDEXPARTITION, FALSE) || ' update indexes';
<       COMMIT;
<     END IF;
< 
<     RETURN SYS.ODCICONST.SUCCESS;
---
>     SEM_RDFCTX_DR.ODCIINDEXSPLITPARTITION_PR(IDXINFO, PART1_NAME, PART2_NAME, 
>     				             IDXPARMS, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
1706,1724c108
<     PL_POLRIDS   SYS.ODCIVARCHAR2LIST;
<     PL_MODIDX    SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     PL_EXTARR    MDSYS.T_EXTARR;
<     PL_EXTPREF   SYS.XMLTYPE;
<     PL_FLAGS     SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_POLRIDS    SYS.ODCIVARCHAR2LIST;
<     L_MODIDX     SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     L_EXTARR     MDSYS.T_EXTARR;
<     L_EXTPREF    SYS.XMLTYPE;
<     L_FLAGS      SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     DOCURI2RID_PNAME    VARCHAR2(270);
<     DOCVID2RID_PNAME    VARCHAR2(270);
<     DOCURI2RID_NAME     VARCHAR2(270);
<     DOCVID2RID_NAME     VARCHAR2(270);
<     PL_POLNAMES SYS.ODCIVARCHAR2LIST;
<     L_POLNAMES  SYS.ODCIVARCHAR2LIST;
<     PL_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS   SYS.ODCIVARCHAR2LIST;
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
1726,1789c110,111
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,TRUE,
<                                    DOCURI2RID_PNAME, DOCVID2RID_PNAME);
< 
<     
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,TRUE,DOCURI2RID_NAME,
<                                    DOCVID2RID_NAME);
< 
<     
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,
<                                      PA_IDXINFO.INDEXPARTITION, PL_POLRIDS, PL_MODIDX,
<                                      PL_EXTARR, PL_EXTPREF, PL_POLNAMES, PL_EXTRPARAMS, PL_FLAGS);
< 
<     
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                      IDXINFO.INDEXNAME, L_POLRIDS, L_MODIDX,
<                                      L_EXTARR, L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
< 
<     
<     IF (PL_POLRIDS.COUNT != L_POLRIDS.COUNT) THEN
<       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<         'EXCHANGE INDEX PARTITION not supported for different number of index policies');  
<     ELSE
<       FOR I IN 1..PL_EXTARR.COUNT LOOP
<         FOR J IN 1..L_EXTARR.COUNT LOOP
<           IF (L_POLRIDS(J) = PL_POLRIDS(I)) THEN
<              EXIT;
<           ELSE
<             IF (L_POLRIDS(J) > PL_POLRIDS(I)) THEN
<               MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<                   'EXCHANGE INDEX PARTITION not supported for incompatible index policies'); 
<             END IF; 
<           END IF;
<         END LOOP;
<       END LOOP; 
<     END IF;
< 
<     
<     
<     
<     FOR I IN 1..PL_EXTARR.COUNT LOOP
< 
< 
< 
<       SEM_RDFCTX_DR.EXCHANGE_INDEX_POLICIES(PA_IDXINFO.INDEXSCHEMA, PA_IDXINFO.INDEXNAME,
<                                             PA_IDXINFO.INDEXPARTITION, PL_MODIDX(I),
<                                             IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME,
<                                             L_MODIDX(I));
<     END LOOP;
< 
<     
<     EXECUTE IMMEDIATE 'alter table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_PNAME)
<                       || ' exchange partition ' || SYS.DBMS_ASSERT.ENQUOTE_NAME(PA_IDXINFO.INDEXPARTITION, FALSE)
<                       || ' with table ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                       || ' including indexes';
<     COMMIT;
< 
<     RETURN SYS.ODCICONST.SUCCESS;
---
>     SEM_RDFCTX_DR.ODCIINDEXEXCHANGEPARTITION_PR(PA_IDXINFO, IDXINFO, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
1800,1823c122
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
<     L_MODIDX   SYS.ODCINUMBERLIST; 
<     L_EXTARR   MDSYS.T_EXTARR; 
<     S_XMLRDF   CLOB; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     FILEDIR    VARCHAR2(4000) := NULL; 
<     L_NEWDOC   CLOB := NEWVAL; 
<     L_DUMN     NUMBER; 
<     FILTERPL   VARCHAR2(130) := NULL; 
<     STAGTAB    VARCHAR2(270);
<     STAGVIEW   VARCHAR2(270);
<     L_DOCURIPFX   VARCHAR2(4000);
<     L_DOCURISHORTPFX   VARCHAR2(500);
<     L_DOCURI      VARCHAR2(4000);
<     DOCVID2RID_NAME  VARCHAR2(270);
<     DOCURI2RID_NAME  VARCHAR2(270);
<     L_ROWCNT       CONSTANT NUMBER := 0;
<     L_ROWDESC VARCHAR2(50); 
<     L_POLNAMES SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     L_FLAGS      SYS.ODCINUMBERLIST;
< 
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
1825,1934c124,126
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     
< 
<     
<     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<     
< 
<     
<     IF (NEWVAL IS NULL) THEN 
<       RETURN SYS.ODCICONST.SUCCESS;
<     END IF; 
< 
<     
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<     
<     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
<                       IDXINFO.INDEXSCHEMA
<                     , IDXINFO.INDEXNAME
<                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
<     RDF_APIS_INTERNAL.KSDWRF('index insert: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
< 
<     
<     
< 
<     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
<     L_DOCURI := '<' || 
<                       L_DOCURIPFX || 
<                       L_ROWDESC ||
<                       '>';
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,   
<                                      IDXINFO.INDEXNAME, 
<                                 (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS); 
< 
<     IF (L_EXTPREF IS NOT NULL) THEN 
<       IF (NLS_UPPER(L_EXTPREF.EXTRACT('//Datastore/@type').GETSTRINGVAL())
<                                                             = 'FILE') THEN
<         FILEDIR := TRIM(L_EXTPREF.EXTRACT(
<                    '//Datastore/Path/text()').GETSTRINGVAL());
<       END IF; 
<       IF (L_EXTPREF.EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
<         FILTERPL := NLS_UPPER(L_EXTPREF.EXTRACT(
<                                     '//Datastore/@filter').GETSTRINGVAL()); 
<       END IF; 
<       IF (FILEDIR IS NOT NULL) THEN 
<         
<         SEM_RDFCTX_IR.READ_FROM_FILE(FILEDIR, NEWVAL, L_NEWDOC, FILTERPL); 
<       ELSE 
<         SEM_RDFCTX_IR.READ_FROM_NTWRK(NEWVAL, L_NEWDOC, FILTERPL);
<       END IF; 
<     END IF; 
< 
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
<                                   ,DUMMY_XINFOTAB_NAME);
< 
<     
<     
<     
<     
< 
<     MDSYS.RDF_APIS_INTERNAL.KSDWRF('Staging table for indexInsert is ' || STAGTAB, DEBUG_TRACE);
<     
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<     BEGIN
<       L_EXTARR(EI).STARTDRIVER();
<       
<       IF (L_EXTRPARAMS(EI) IS NULL) THEN 
<         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC);
<       ELSE
<         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC,
<                                             L_EXTRPARAMS(EI));
<       END IF;
< 
<       MDSYS.RDF_APIS_INTERNAL.KSDWRF('Done extracting data for the new document', DEBUG_TRACE);
<       L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(), 
<               S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
<               IDXINFO.INDEXPARTITION, RID); 
<       L_EXTARR(EI).CLOSEDRIVER();
< 
<       
<       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'INS');
<     EXCEPTION 
<        WHEN OTHERS THEN 
<         L_EXTARR(EI).CLOSEDRIVER();
<         IF (SQLCODE != -13199) THEN 
<           SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
<                                       SQLCODE, SQLERRM);
<         END IF; 
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<            'unable to maintain index. See exceptions table' ||
<            CHR(10) || DBMS_UTILITY.FORMAT_ERROR_STACK ||
<            CHR(10) || '[' || CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE || CHR(10) || ']'
<         ); 
<     END; 
<     END LOOP; 
< 
<     
<     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
< 
<     RETURN SYS.ODCICONST.SUCCESS;
<   END ODCIINDEXINSERT; 
---
>     SEM_RDFCTX_DR.ODCIINDEXINSERT_PR(IDXINFO, RID, NEWVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXINSERT;
1944,1964c136
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
<     L_MODIDX   SYS.ODCINUMBERLIST; 
<     L_EXTARR   MDSYS.T_EXTARR; 
<     S_XMLRDF   CLOB; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     L_DUMN     NUMBER;
<     STAGTAB    VARCHAR2(270);
<     STAGVIEW   VARCHAR2(270);
<     L_DOCURIPFX   VARCHAR2(4000);
<     L_DOCURISHORTPFX   VARCHAR2(500);
<     L_DOCURI      VARCHAR2(4000);
<     DOCVID2RID_NAME  VARCHAR2(270);
<     DOCURI2RID_NAME  VARCHAR2(270);
<     L_ROWCNT       CONSTANT NUMBER := 0;
<     L_ROWDESC VARCHAR2(50); 
<     L_POLNAMES SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     L_FLAGS       SYS.ODCINUMBERLIST;
< 
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>    RETURNVAL NUMBER;
1966,2045c138,140
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     
<     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<     
< 
<     
<     IF (NEWVAL IS NULL) THEN 
<       RETURN SYS.ODCICONST.SUCCESS;
<     END IF; 
< 
<     
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<     
<     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
<                       IDXINFO.INDEXSCHEMA
<                     , IDXINFO.INDEXNAME
<                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
<     RDF_APIS_INTERNAL.KSDWRF('index insert: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
< 
<     
<     
< 
<     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
<     L_DOCURI := '<' || 
<                       L_DOCURIPFX || 
<                       L_ROWDESC ||
<                       '>';
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,   
<                                      IDXINFO.INDEXNAME, 
<                                      (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS); 
< 
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
<                                   ,DUMMY_XINFOTAB_NAME);
< 
<     
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<     BEGIN
<       L_EXTARR(EI).STARTDRIVER(); 
< 
<       IF (L_EXTRPARAMS(EI) IS NULL) THEN
<         S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC); 
<       ELSE
<        S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC, 
<                                            L_EXTRPARAMS(EI));
<       END IF;
< 
<       L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(), 
<               S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
<               IDXINFO.INDEXPARTITION, RID); 
<       L_EXTARR(EI).CLOSEDRIVER();
< 
<       
<       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'INS');
<     EXCEPTION 
<        WHEN OTHERS THEN 
<         L_EXTARR(EI).CLOSEDRIVER();
<         IF (SQLCODE != -13199) THEN 
<           SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
<                                       SQLCODE, SQLERRM);
<         END IF; 
<         MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<            'unable to maintain index. See exceptions table'); 
<     END; 
<     END LOOP; 
< 
<     
<     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
< 
<     RETURN SYS.ODCICONST.SUCCESS;
<   END ODCIINDEXINSERT; 
---
>     SEM_RDFCTX_DR.ODCIINDEXINSERT_PR(IDXINFO, RID, NEWVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXINSERT;
2055,2065c150
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
<     L_MODIDX   SYS.ODCINUMBERLIST; 
<     L_EXTARR   MDSYS.T_EXTARR; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     DOCVID2RID_NAME   VARCHAR2(270);
<     DOCURI2RID_NAME   VARCHAR2(270);
<     L_POLNAMES SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     L_DOCVID          NUMBER;
<     L_FLAGS        SYS.ODCINUMBERLIST;
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>    RETURNVAL NUMBER;
2067,2097c152,154
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
<                                      IDXINFO.INDEXNAME, 
<                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
<  
<     
<     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                       || ' where docRid = :1' INTO L_DOCVID USING RID;
< 
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
< 
<       
<       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'DEL');
<     END LOOP; 
< 
<     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                     || ' where docRid = :1' USING RID;
< 
<     RETURN SYS.ODCICONST.SUCCESS;
<   END ODCIINDEXDELETE; 
---
>     SEM_RDFCTX_DR.ODCIINDEXDELETE_PR(IDXINFO, RID, OLDVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXDELETE;
2107,2117c164
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST; 
<     L_MODIDX   SYS.ODCINUMBERLIST; 
<     L_EXTARR   MDSYS.T_EXTARR; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     DOCVID2RID_NAME   VARCHAR2(270);
<     DOCURI2RID_NAME   VARCHAR2(270);
<     L_POLNAMES    SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS  SYS.ODCIVARCHAR2LIST;
<     L_DOCVID          NUMBER;
<     L_FLAGS           SYS.ODCINUMBERLIST;
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
2119,2149c166,168
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
<                                      IDXINFO.INDEXNAME, 
<                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
<  
<     
<     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                       || ' where docRid = :1' INTO L_DOCVID USING RID;
< 
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
< 
<       
<       MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'DEL');
<     END LOOP; 
< 
<     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                     || ' where docRid = :1' USING RID;
< 
<     RETURN SYS.ODCICONST.SUCCESS;
<   END ODCIINDEXDELETE; 
---
>     SEM_RDFCTX_DR.ODCIINDEXDELETE_PR(IDXINFO, RID, OLDVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXDELETE;
2160,2184c179
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
<     L_MODIDX   SYS.ODCINUMBERLIST;
<     L_EXTARR   MDSYS.T_EXTARR;
<     S_XMLRDF   CLOB; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     FILEDIR    VARCHAR2(4000) := NULL; 
<     L_NEWDOC   CLOB := NEWVAL; 
<     L_DUMN     NUMBER; 
<     FILTERPL   VARCHAR2(130); 
<     STAGTAB    VARCHAR2(270);
<     STAGVIEW   VARCHAR2(270);
<     DOCVID2RID_NAME   VARCHAR2(270);
<     DOCURI2RID_NAME   VARCHAR2(270);
<     L_ROWCNT       CONSTANT NUMBER := 0;
<     L_ROWDESC VARCHAR2(50); 
<     L_DOCURIPFX       VARCHAR2(4000);
<     L_DOCURISHORTPFX   VARCHAR2(500);
<     L_DOCURI          VARCHAR2(4000);
<     L_POLNAMES        SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS      SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     L_DOCVID          NUMBER;
<     L_FLAGS           SYS.ODCINUMBERLIST;
< 
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
2186,2292c181,183
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     
<     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<     
< 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
<  
<     
<     
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
<                                      IDXINFO.INDEXNAME, 
<                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),  
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
< 
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
<                                   ,DUMMY_XINFOTAB_NAME);
< 
<     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                       || ' where docRid = :1' INTO L_DOCVID USING RID;
< 
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID); 
<     END LOOP; 
< 
<     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                     || ' where docRid = :1' USING RID;
< 
<     IF (NEWVAL IS NULL) THEN 
<       RETURN ODCICONST.SUCCESS;
<     END IF; 
< 
<     
<     
<     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
<                       IDXINFO.INDEXSCHEMA
<                     , IDXINFO.INDEXNAME
<                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
<     RDF_APIS_INTERNAL.KSDWRF('index update: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
< 
<     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
<     L_DOCURI := '<' || 
<                       L_DOCURIPFX || 
<                       L_ROWDESC ||
<                       '>';
< 
<     IF (L_EXTPREF IS NOT NULL) THEN 
<       IF (NLS_UPPER(L_EXTPREF.EXTRACT('//Datastore/@type').GETSTRINGVAL())
<                                                             = 'FILE') THEN
<         FILEDIR := TRIM(L_EXTPREF.EXTRACT(
<                    '//Datastore/Path/text()').GETSTRINGVAL());
<       END IF; 
<       IF (L_EXTPREF.EXTRACT('//Datastore/@filter') IS NOT NULL) THEN 
<         FILTERPL := NLS_UPPER(L_EXTPREF.EXTRACT(
<                                     '//Datastore/@filter').GETSTRINGVAL()); 
<       END IF; 
<       IF (FILEDIR IS NOT NULL) THEN 
<         
<         SEM_RDFCTX_IR.READ_FROM_FILE(FILEDIR, NEWVAL, L_NEWDOC, FILTERPL); 
<       ELSE 
<         SEM_RDFCTX_IR.READ_FROM_NTWRK(NEWVAL, L_NEWDOC, FILTERPL);
<       END IF; 
<     END IF; 
< 
<     
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       BEGIN
<         L_EXTARR(EI).STARTDRIVER();
< 
<         IF (L_EXTRPARAMS(EI) IS NULL) THEN
<           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC);
<         ELSE
<           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(L_NEWDOC, L_DOCURISHORTPFX || L_ROWDESC,
<                                               L_EXTRPARAMS(EI));
<         END IF;
< 
<         L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(),
<                S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
<                IDXINFO.INDEXPARTITION, RID); 
<         L_EXTARR(EI).CLOSEDRIVER();
<    
<         
<         MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'UPD');
<       EXCEPTION
<          WHEN OTHERS THEN
<           L_EXTARR(EI).CLOSEDRIVER();
<           IF (SQLCODE != -13199) THEN 
<             SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
<                                         SQLCODE, SQLERRM);
<           END IF; 
<           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<              'unable to maintain index. See exceptions table');
<       END;
<     END LOOP; 
< 
<     
<     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
< 
<     RETURN SYS.ODCICONST.SUCCESS;
<   END ODCIINDEXUPDATE; 
---
>     SEM_RDFCTX_DR.ODCIINDEXUPDATE_PR(IDXINFO, RID, OLDVAL, NEWVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXUPDATE;
2303,2324c194
<     L_POLRIDS  SYS.ODCIVARCHAR2LIST;
<     L_MODIDX   SYS.ODCINUMBERLIST;
<     L_EXTARR   MDSYS.T_EXTARR;
<     S_XMLRDF   CLOB; 
<     L_EXTPREF  SYS.XMLTYPE; 
<     L_FLAGS    SYS.ODCINUMBERLIST;
<     L_DUMN     NUMBER; 
<     STAGTAB    VARCHAR2(270);
<     STAGVIEW   VARCHAR2(270);
<     DOCVID2RID_NAME   VARCHAR2(270);
<     DOCURI2RID_NAME   VARCHAR2(270);
<     L_ROWCNT       CONSTANT NUMBER := 0;
<     L_ROWDESC VARCHAR2(50); 
<     L_DOCURIPFX       VARCHAR2(4000);
<     L_DOCURISHORTPFX   VARCHAR2(500);
<     L_DOCURI          VARCHAR2(4000);
<     L_POLNAMES        SYS.ODCIVARCHAR2LIST;
<     L_EXTRPARAMS      SYS.ODCIVARCHAR2LIST;
<     DUMMY_XINFOTAB_NAME VARCHAR2(270);
<     L_DOCVID          NUMBER;
< 
<     DEBUG_TRACE        BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
---
>     RETURNVAL NUMBER;
2326,2416c196,198
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     
<     DEBUG_TRACE := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS);
<     
< 
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, TRUE,
<                                    DOCURI2RID_NAME, DOCVID2RID_NAME);
<  
<     
<     
< 
<     SEM_RDFCTX_DR.GET_INDEX_POLICIES(IDXINFO.INDEXSCHEMA,
<                                      IDXINFO.INDEXNAME, 
<                                     (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                      L_POLRIDS, L_MODIDX, L_EXTARR, 
<                                      L_EXTPREF, L_POLNAMES, L_EXTRPARAMS, L_FLAGS);
<    
<     SEM_RDFCTX_DR.GET_STAGTAB_NAME(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, NULL, TRUE, STAGTAB, STAGVIEW
<                                   ,DUMMY_XINFOTAB_NAME);
< 
<     EXECUTE IMMEDIATE 'select docVid from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME)
<                       || ' where docRid = :1' INTO L_DOCVID USING RID;
< 
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       SEM_RDFCTX_DR.DELETE_TRIPLES(RID, L_MODIDX(EI), L_DOCVID);
<     END LOOP; 
< 
<     EXECUTE IMMEDIATE 'delete from ' || SYS.DBMS_ASSERT.QUALIFIED_SQL_NAME(DOCVID2RID_NAME) 
<                     || ' where docRid = :1' USING RID;
< 
<     IF (NEWVAL IS NULL) THEN 
<       RETURN ODCICONST.SUCCESS;
<     END IF; 
< 
<     
<     
<     L_DOCURIPFX := SEM_RDFCTX_DR.GEN_DOC_URI_PREFIX(
<                       IDXINFO.INDEXSCHEMA
<                     , IDXINFO.INDEXNAME
<                     , IDXINFO.INDEXPARTITION, L_DOCURISHORTPFX);
<     RDF_APIS_INTERNAL.KSDWRF('index update: docUriPfx=' || L_DOCURIPFX, DEBUG_TRACE);
< 
<     L_ROWDESC := 'r' || SDO_RDF.FORM_URL_ENCODE(RID); 
<     L_DOCURI := '<' || 
<                       L_DOCURIPFX || 
<                       L_ROWDESC ||
<                       '>';
< 
<     
<     FOR EI IN 1 .. L_EXTARR.COUNT LOOP
<       BEGIN
<         L_EXTARR(EI).STARTDRIVER();
< 
<         IF (L_EXTRPARAMS(EI) IS NULL) THEN
<           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC);
<         ELSE
<           S_XMLRDF := L_EXTARR(EI).EXTRACTRDF(NEWVAL, L_DOCURISHORTPFX || L_ROWDESC,
<                                               L_EXTRPARAMS(EI));
<         END IF;
< 
<         L_DUMN := SEM_RDFCTX_DR.LOAD_TRIPLES(L_EXTARR(EI).RDFRETURNTYPE(),
<                 S_XMLRDF, L_DOCURI, L_MODIDX(EI), L_POLRIDS(EI), 'DML', STAGTAB, NULL, 
<                 IDXINFO.INDEXPARTITION, RID); 
<         L_EXTARR(EI).CLOSEDRIVER();
<   
<         
<         MDSYS.RDF_APIS_INTERNAL.NOTIFY_MODEL_DML(L_MODIDX(EI), 'UPD');
<       EXCEPTION
<          WHEN OTHERS THEN
<           L_EXTARR(EI).CLOSEDRIVER();
<           IF (SQLCODE != -13199) THEN 
<             SEM_RDFCTX_DR.RECORD_RDFCTX_EXCEPTION (L_MODIDX(EI), RID, 1,
<                                         SQLCODE, SQLERRM);
<           END IF; 
<           MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<              'unable to maintain index. See exceptions table');
<       END;
< 
<     END LOOP; 
< 
<     
<     SEM_RDFCTX_IR.MAINTAIN_DOCVID2RID_TABLE(IDXINFO, DOCVID2RID_NAME, L_DOCURI, RID);
< 
<     RETURN SYS.ODCICONST.SUCCESS;
< 
<   END ODCIINDEXUPDATE; 
---
>     SEM_RDFCTX_DR.ODCIINDEXUPDATE_PR(IDXINFO, RID, OLDVAL, NEWVAL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;
>   END ODCIINDEXUPDATE;
2429a212
>     RETURNVAL NUMBER;
2431,2433c214,217
<     RETURN ODCIINDEXSTART(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
<                           NULL, RDF_APIS.RULESIDX_VALID, NULL, IDXENV); 
<   END ODCIINDEXSTART; 
---
>     SEM_RDFCTX_DR.ODCIINDEXSTART_PR(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
>                           NULL, RDF_APIS.RULESIDX_VALID, NULL, IDXENV, RETURNVAL); 
>     RETURN RETURNVAL;			  
>   END ODCIINDEXSTART;
2447a232
>     RETURNVAL NUMBER;
2449,2450c234,236
<     RETURN ODCIINDEXSTART(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
<                           POLICY, RDF_APIS.RULESIDX_VALID, NULL, IDXENV);
---
>     SEM_RDFCTX_DR.ODCIINDEXSTART_PR(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
>                           POLICY, RDF_APIS.RULESIDX_VALID, NULL, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;			  
2465a252
>     RETURNVAL NUMBER;
2467,2468c254,256
<     RETURN ODCIINDEXSTART(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
<                           NULL, RDF_APIS.RULESIDX_VALID, ALIASES, IDXENV);
---
>     SEM_RDFCTX_DR.ODCIINDEXSTART_PR(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
>                           NULL, RDF_APIS.RULESIDX_VALID, ALIASES, IDXENV, RETURNVAL);
>     RETURN RETURNVAL;			  
2484a273
>     RETURNVAL NUMBER;
2486,2487c275,277
<     RETURN ODCIINDEXSTART(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
<                           POLICY, RDF_APIS.RULESIDX_VALID, ALIASES,  IDXENV);
---
>     SEM_RDFCTX_DR.ODCIINDEXSTART_PR(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
>                           POLICY, RDF_APIS.RULESIDX_VALID, ALIASES,  IDXENV, RETURNVAL);
>     RETURN RETURNVAL;			  
2490d279
< 
2505,2570c294,295
<            IDXENV      SYS.ODCIENV) RETURN NUMBER IS
<     L_MODID     NUMBER; 
<     L_QRYARR    RDF_LONGVARCHARARRAY;
<     L_COLNAMES  RDF_VARCHARARRAY;
<     L_FLAGS     INTEGER := 0; 
<     PS_NCOLS    INTEGER;
<     STMT        DBMS_SQL.VARCHAR2A;
<     SEL         VARCHAR2(32767);
<     COLNAMES    RDF_VARCHARARRAY;
<     SELLST      SYS.ODCINUMBERLIST := SYS.ODCINUMBERLIST();
<     CURNM       INTEGER; 
<     RID         ROWID; 
<     SPARQLSEL   VARCHAR2(4000) := NULL;
<     SPARQLWHR   VARCHAR2(4000) := SPARQL; 
<     SELCOLS     RDF_VARCHARARRAY := NULL; 
<     WHRCOLS     RDF_VARCHARARRAY := NULL; 
<     IDX         INTEGER;
<     L_CLOB      CLOB;
<     L_NUM       NUMBER; 
<     FLAG_OUT    NUMBER; 
<     DUMNUML     SYS.ODCINUMBERLIST;
<     DUMVARCHAR  VARCHAR2(32767);  
<     VMNAME      VARCHAR(128) := NULL; 
<     SP2SQFLG    NUMBER := 4;
<     DUMMYHINT   VARCHAR2(128);
<     PART_NAME   VARCHAR2(128);
< 
<     DOCGRAPH          CONSTANT VARCHAR2(30) := 'ORARDFGRAPH';
< 
<     DOCGRAPH_SPARQL_VAR        VARCHAR2(128) := '?' || DOCGRAPH;
<     DOCGRAPH$RDFVID_COL        VARCHAR2(128) := DOCGRAPH || '$RDFVID';
< 
<     GRAPH_AUG_AT_HEAD CONSTANT VARCHAR2(100) := '{GRAPH ' || DOCGRAPH_SPARQL_VAR || ' ';
<     GRAPH_AUG_AT_TAIL CONSTANT VARCHAR2(100) := '}';
< 
<     FLAG_MATCH_UNNAMED  CONSTANT PLS_INTEGER := 128; 
< 
<     DUMMY_DOCURI2RID             VARCHAR2(128);
<     DOCVID2RID                   VARCHAR2(128);
<     DOCVID2RID_TAB               VARCHAR2(128);
<     SELECT_DOCVID2RID_CLAUSE     VARCHAR2(100);
<     SELECT_DOCVID2RID_ANC_CLAUSE VARCHAR2(100);
<     SELECT_DOCVID2RID_CNT_CLAUSE VARCHAR2(100);
<     FROM_DOCVID2RID_CLAUSE       VARCHAR2(100);
<     WHERE_DOCVID2RID_CLAUSE      VARCHAR2(100);
<     REQIDXSTATUS                 VARCHAR2(30);
<     DEBUG_TRACE                  BOOLEAN := SEM_RDFCTX_IR.SET_DEBUG_TRACE(IDXENV.ENVFLAGS); 
< 
<     
<     HINTKEY    CONSTANT VARCHAR2(11)       := 'ORARDF$HINT';
<     
<     
<     
<     HINTSTR             VARCHAR2(4000)     := ' ALLOW_DUP=T ';
<     CLNALIASES          MDSYS.RDF_ALIASES  := MDSYS.RDF_ALIASES();
<     CURRALIAS           MDSYS.RDF_ALIAS;
<     ALIASIDX            PLS_INTEGER        := 0;
< 
<     
<     SELECT_OP CONSTANT VARCHAR2(19) := 'SEM_CONTAINS_SELECT';
<     COUNT_OP  CONSTANT VARCHAR2(18) := 'SEM_CONTAINS_COUNT';
< 
<     
<     L_NETWORK_OWNER     VARCHAR2(128) := 'MDSYS';
<     L_NETWORK_NAME      VARCHAR2(30) := '';
<     S_NETWORK_NAME      VARCHAR2(30) := '';
---
>            IDXENV      SYS.ODCIENV) RETURN NUMBER IS 
>     RETURNVAL NUMBER;
2572,2907c297,299
<     
<     
<     SEM_RDFCTX_IR.LOOKUP_AND_SET_NETWORK_INFO(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_INFO', NULL, TRUE);
<     SDO_RDF_INTERNAL.SET_CALLCONTEXT('NETWORK_P_INFO', NULL, TRUE);
< 
<     L_NETWORK_OWNER := SDO_RDF_INTERNAL.GET_NETWORK_OWNER;
<     IF (L_NETWORK_OWNER != 'MDSYS') THEN
<       L_NETWORK_NAME := SDO_RDF_INTERNAL.GET_NETWORK_NAME;
<       S_NETWORK_NAME := SUBSTR(L_NETWORK_NAME,1,LENGTH(L_NETWORK_NAME)-1); 
<     END IF;
< 
< 
< 
< 
<     
<     IF (ALIASES IS NOT NULL) THEN 
<       FOR ALIASIDX IN ALIASES.FIRST..ALIASES.LAST LOOP
<         CURRALIAS := ALIASES(ALIASIDX);
<         IF (NLS_UPPER(CURRALIAS.NAMESPACE_ID) = HINTKEY) THEN
<           HINTSTR := CURRALIAS.NAMESPACE_VAL;
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'extracted hint: [' || HINTSTR || ']', 
<             DEBUG_TRACE);
<         ELSE
<           CLNALIASES.EXTEND(1);
<           CLNALIASES(CLNALIASES.LAST) := CURRALIAS;
<           MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<             'keeping alias: [' || CURRALIAS.NAMESPACE_ID || '][' 
<                                || CURRALIAS.NAMESPACE_VAL || ']', 
<             DEBUG_TRACE);
<         END IF; 
<       END LOOP;
<     END IF;
< 
<     
<     IF (ICTX IS NOT NULL) THEN
<       IF (ICTX.SCANCUR IS NOT NULL) THEN
<          IF (DEBUG_TRACE) THEN
<            MDSYS.RDF_APIS_INTERNAL.KSDWRF('closing previous open cursor in ODCIIndexStart');
<          END IF;
<          DBMS_SQL.CLOSE_CURSOR(ICTX.SCANCUR);
<       END IF;
<     END IF;
< 
<     L_MODID := SEM_RDFCTX_DR.GET_MODEL_ID(IDXINFO.INDEXSCHEMA,
<                                           IDXINFO.INDEXNAME,
<                                (CASE WHEN IDXINFO.INDEXPARTITION IS NULL THEN IDXINFO.INDEXNAME ELSE IDXINFO.INDEXPARTITION END),
<                                           NLS_UPPER(POLICY)); 
< 
<     
<     SEM_RDFCTX_DR.GET_MAPTAB_NAMES(IDXINFO.INDEXSCHEMA, IDXINFO.INDEXNAME, FALSE, DUMMY_DOCURI2RID, DOCVID2RID);
<     DOCVID2RID_TAB := SYS.DBMS_ASSERT.SIMPLE_SQL_NAME(DOCVID2RID);
< 
<     
<     REQIDXSTATUS := SEM_RDFCTX_DR.GET_IDXSTATUS_STRING(IDX_STATUS);
< 
<     MDSYS.RDF_APIS_INTERNAL.KSDWRF('requiredidxStatus : ' ||REQIDXSTATUS, DEBUG_TRACE);
< 
<     IF (REQIDXSTATUS IS NULL) THEN
<       RAISE_APPLICATION_ERROR(-20000, TO_CHAR(IDX_STATUS) ||
<                ' is not a recognized option for status of a rules index');
<     END IF;
< 
<     
<     SELECT_DOCVID2RID_CLAUSE := 'SELECT docRid FROM (';
<     SELECT_DOCVID2RID_CNT_CLAUSE := 'SELECT docRid, abs_cnt FROM (';
<     SELECT_DOCVID2RID_ANC_CLAUSE := 'SELECT docRid, sparqlrslt FROM (';
<     FROM_DOCVID2RID_CLAUSE := '), ' || DOCVID2RID_TAB || ' Vid2Rid';
<     WHERE_DOCVID2RID_CLAUSE := ' and Vid2Rid.docVid = ' || DOCGRAPH$RDFVID_COL || ' ';
< 
<     
<     L_FLAGS := 0;
<     IF (OQI.ANCOPS IS NOT NULL AND OQI.ANCOPS.COUNT > 0) THEN 
<       FOR IDX IN OQI.ANCOPS.FIRST..OQI.ANCOPS.LAST LOOP
<         MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<           'ancop [' || OQI.ANCOPS(IDX).OBJECTNAME || ']', 
<            DEBUG_TRACE);
<         CASE (NLS_UPPER(OQI.ANCOPS(IDX).OBJECTNAME))
<           WHEN SELECT_OP THEN
<             L_FLAGS := L_FLAGS + SEM_RDFCTX_DR.SELECT_ANCOP;
<           WHEN COUNT_OP THEN
<             L_FLAGS := L_FLAGS + SEM_RDFCTX_DR.COUNT_ANCOP;
<           ELSE
<             NULL;
<         END CASE;
<       END LOOP;
<         MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<           'l_flags [' || L_FLAGS || ']', 
<            DEBUG_TRACE);
<     END IF; 
< 
<     IF (L_MODID < 0) THEN 
<       L_MODID := -1*L_MODID; 
<       SP2SQFLG := SP2SQFLG+ FLAG_MATCH_UNNAMED; 
<       VMNAME := SDO_RDF_INTERNAL.GET_PFX_FOR_RDF_OBJ_NAME() || 'SEMV_RDFCTX_MOD_'||L_MODID; 
<       
< 
<       
<       IF (SEM_RDFCTX_DR.IS_ENTAILMENT_COMPAT('RDFCTX_MOD_'||L_MODID, REQIDXSTATUS) = FALSE) THEN
<         IF (REQIDXSTATUS = SDO_RDF_INTERNAL.RIDX_VALID) THEN
<           RAISE_APPLICATION_ERROR(-20000,
<                    'We do not have a valid virtual model  with the specified status ');
<         ELSE
<           RAISE_APPLICATION_ERROR(-20000,
<                    'We do not have a virtual model  with the specified status ');
<         END IF;
<       END IF;
< 
<       
<     ELSE
<       NULL;
<       
<     END IF; 
< 
<     MDSYS.RDF_APIS_INTERNAL.KSDWRF('model_name in ODCIIndexStart : '||VMNAME, DEBUG_TRACE);
<     
<     IF (INSTR(NLS_UPPER(SUBSTR(LTRIM(SPARQL),1, 10)), 'SELECT') = 1) THEN 
<       SELCOLS := SEM_RDFCTX_DR.GETSELECTVARIABLES(SPARQL); 
<       
<       
<       SPARQLWHR := SUBSTR(SPARQL, INSTR(SPARQL,'{'));
<     END IF; 
< 
<     SPARQLWHR := GRAPH_AUG_AT_HEAD || SPARQLWHR || GRAPH_AUG_AT_TAIL;
< 
<     
<     
<     
<     SELLST.EXTEND;
<     SELLST(SELLST.COUNT) := 2;
< 
<     
<     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
<       IF (SELCOLS IS NULL) THEN 
<         SELCOLS := RDF_VARCHARARRAY('*'); 
<       END IF; 
<       WHRCOLS := SEM_RDFCTX_DR.GETWHEREVARIABLES(SPARQLWHR, DUMMYHINT); 
< 
<       
< 
< 
< 
< 
< 
< 
< 
< 
<       
<       IF (SELCOLS.COUNT = 1 AND SELCOLS(1) = '*') THEN 
<         SELCOLS := RDF_VARCHARARRAY(); 
<         FOR WCL IN 1 .. WHRCOLS.COUNT/2 LOOP
<           
<           IF (INSTR(WHRCOLS(WCL*2),'$') = 0 AND WHRCOLS(WCL*2) != NLS_UPPER(DOCGRAPH)) THEN 
<             
<             SELLST.EXTEND; 
<             SELLST(SELLST.COUNT) := WCL; 
<             
<             SELLST.EXTEND; 
<             SELLST(SELLST.COUNT) := WCL+4; 
<             
<             SELCOLS.EXTEND; 
<             SELCOLS(SELCOLS.COUNT) := WHRCOLS(WCL*2); 
<           
< 
< 
< 
< 
<           END IF; 
<         END LOOP;
<       ELSE
<         
<         FOR WCL IN 1 .. WHRCOLS.COUNT/2 LOOP
<           IF (INSTR(WHRCOLS(WCL*2),'$') = 0) THEN
<             
<             FOR SCL IN 1 .. SELCOLS.COUNT LOOP
<               IF (SELCOLS(SCL) = WHRCOLS(WCL*2)) THEN
<                 SELLST.EXTEND;
<                 SELLST(SELLST.COUNT) := WCL;      
<                 
<                 SELLST.EXTEND; 
<                 SELLST(SELLST.COUNT) := WCL+4; 
<               END IF; 
<             END LOOP; 
<           END IF; 
<         END LOOP; 
<       END IF; 
<     END IF; 
< 
<     RDF_APIS_INTERNAL.KSDWRF('sp2sqflg=' || TO_CHAR(SP2SQFLG) || '
< WHR=' || SPARQLWHR || '*
< SELLST=' || SELLST.COUNT || '*', DEBUG_TRACE);
< 
<     MDSYS.RDF_APIS_INTERNAL.KSDWRF(
<       'using sem_match options: [' || HINTSTR || ']', 
<       DEBUG_TRACE);
< 
<     RDF_APIS_INTERNAL.SPARQL_TO_SQL(SELLST,
<                                     SPARQLWHR, 
<                                     RDF_MODELS('RDFCTX_MOD_'||L_MODID), 
<                                     NULL, 
<                                     NULL, 
<                                     REQIDXSTATUS, 
<                                     NULL, 
<                                     NULL, 
<                                     NULL, 
<                                     NULL, 
<                                     ALIASES, 
<                                     SP2SQFLG,    
<                                     L_QRYARR, 
<                                     L_COLNAMES, NULL, VMNAME, 
<                                     FLAG_OUT, DUMNUML, DUMVARCHAR, NULL, 0
<                                   , L_NETWORK_OWNER, S_NETWORK_NAME); 
< 
<     
<     IF (BITAND(FLAG_OUT, 1) = 1) THEN 
<       MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<              'filters in optional graph patterns can only reference local or ' ||
<              'parent variables');
<     END IF;
< 
<     IDX := 1;  
< 
<     
<     
<     
<     
<     
< 
<     
<     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
<       
<       
<       
<       STMT(IDX) := SELECT_DOCVID2RID_ANC_CLAUSE 
<                 || ' select ' || DOCGRAPH$RDFVID_COL || ', ''  <result>''||chr(10)||'; 
<       IDX := IDX+1; 
<       FOR SCI IN 1 .. SELCOLS.COUNT LOOP
<         STMT(IDX) := '''    <binding name="'||SELCOLS(SCI)||'">''||chr(10)||'; 
<         IDX := IDX+1; 
<         STMT(IDX) := '   (case '||SELCOLS(SCI)||'$RDFVTYP when ''URI'' then '||
<          '''      <uri>''||replace('||SELCOLS(SCI)||
<                                       ',''&'',''&amp;'')||''</uri>'''; 
<         IDX := IDX+1; 
<         STMT(IDX) := '    when ''LIT'' then '||
<          '''      <literal>''||replace(replace(replace(replace('||SELCOLS(SCI)
<                       ||',''&'',''&amp;''), ''<'',''&lt;''), ''>'',''&gt;'')
<                 ,''"'',''&quot;'')||''</literal>'' end)||chr(10)||'; 
<         IDX := IDX+1; 
<         STMT(IDX) := '''    </binding>''||chr(10)||'; 
<         IDX := IDX+1; 
<       END LOOP; 
<       STMT(IDX) := '''  </result>'' as sparqlrslt from (';         
<       
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
< 
<     
<     ELSIF (BITAND(L_FLAGS, SEM_RDFCTX_DR.COUNT_ANCOP) = SEM_RDFCTX_DR.COUNT_ANCOP) THEN
<       STMT(IDX) := SELECT_DOCVID2RID_CNT_CLAUSE 
<                 || ' select ' || DOCGRAPH$RDFVID_COL || ', ' || 
<                                 'count(*) abs_cnt from ( ';
<     
<     ELSE 
<       STMT(IDX) := SELECT_DOCVID2RID_CLAUSE 
<                 || ' select ' || DOCGRAPH$RDFVID_COL || ' from ( ';
<     END IF; 
<     IDX := IDX+1; 
<    
<     FOR QIDX IN 1 .. L_QRYARR.COUNT LOOP
<       STMT(IDX) := L_QRYARR(QIDX);
<       IDX := IDX+1; 
<     END LOOP; 
< 
<     STMT(IDX) := ') where 1=1 ';
<     IDX := IDX+1;
< 
<     
<     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
<       STMT(IDX) :=
<          (CASE WHEN BITAND(SP2SQFLG,16) = 16 THEN 
<            ' and ' || DOCGRAPH$RDFVID_COL || ' is not null ' ELSE ' ' END)
<       || FROM_DOCVID2RID_CLAUSE || ' where 1=1 ' || WHERE_DOCVID2RID_CLAUSE
<       ||' order by 1, 2 ';
<     ELSE
<       STMT(IDX) :=
<          (CASE WHEN BITAND(SP2SQFLG,16) = 16 THEN
<              ' and ' || DOCGRAPH$RDFVID_COL || ' is not null ' ELSE ' ' END)
<       || ' group by ' || DOCGRAPH$RDFVID_COL
<       || FROM_DOCVID2RID_CLAUSE || ' where 1=1 ' || WHERE_DOCVID2RID_CLAUSE; 
<     END IF; 
<     
< 
< 
< 
< 
< 
< 
< 
<     
<     RDF_APIS_INTERNAL.KSDWRF('stmt.count=' || STMT.COUNT, DEBUG_TRACE);
<     FOR IDX IN 1..STMT.COUNT LOOP
<       RDF_APIS_INTERNAL.KSDWRF(STMT(IDX), DEBUG_TRACE);
<     END LOOP;
< 
<     CURNM := DBMS_SQL.OPEN_CURSOR;
<     DBMS_SQL.PARSE(CURNM, STMT, 1, STMT.COUNT, FALSE, DBMS_SQL.NATIVE);
<     DBMS_SQL.DEFINE_COLUMN_ROWID(CURNM, 1, RID); 
<     
<     IF (BITAND(L_FLAGS, SEM_RDFCTX_DR.SELECT_ANCOP) = SEM_RDFCTX_DR.SELECT_ANCOP) THEN
<       DBMS_SQL.DEFINE_COLUMN(CURNM, 2, L_CLOB); 
<     
<     ELSIF (BITAND(L_FLAGS, SEM_RDFCTX_DR.COUNT_ANCOP) = SEM_RDFCTX_DR.COUNT_ANCOP) THEN
<       DBMS_SQL.DEFINE_COLUMN(CURNM, 2, L_NUM); 
<     END IF; 
<     L_MODID := DBMS_SQL.EXECUTE(CURNM); 
<     ICTX := SEMCONTEXTINDEXMETHODS(CURNM, L_FLAGS, NULL);
<     RETURN ODCICONST.SUCCESS;
<   EXCEPTION WHEN OTHERS THEN 
<     MDERR.RAISE_MD_ERROR('MD', 'SDO', -13199,
<       'Error during ODCIIndexStart. ' 
<     ||': ' 
<     || SDO_SEM_LOG.NEWLINE || SQLERRM
<     || SDO_SEM_LOG.NEWLINE ||' [' 
<     || SDO_SEM_LOG.NEWLINE || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE 
<     || SDO_SEM_LOG.NEWLINE || ']');
<     
---
>     SEM_RDFCTX_DR.ODCIINDEXSTART_PR(ICTX, IDXINFO, OPI, OQI, STRT, STOP, SPARQL,
>                           POLICY, IDX_STATUS, ALIASES,  IDXENV, RETURNVAL);
>     RETURN RETURNVAL;			  
SYS.DBMS_ASH - PACKAGE (RU):
55a56
>   , LOCAL_AUTO_TYPE   VARCHAR(20)
91a93
>   , IGNORE_CPU_HISTORY BOOLEAN
118c120
<   REPORT_INTERNAL_VERSION CONSTANT VARCHAR2(64) := '41';
---
>   REPORT_INTERNAL_VERSION CONSTANT VARCHAR2(64) := '42';
126c128
<   OMC_ALLOWED_ERR_RATIO CONSTANT NUMBER := 0.9;
---
>   OMC_ALLOWED_ERR_RATIO CONSTANT NUMBER := 0.98;
259a262,266
>   
>   
>   
>   
>   
293a301,302
>   
>   
296c305,306
<                       INSTANCE_NUMBER IN NUMBER := NULL)
---
>                       INSTANCE_NUMBER IN NUMBER := NULL,
>                       IGNORE_CPU_HISTORY IN VARCHAR := 'n')
345c355,356
<     , AWR_INFO IN VARCHAR2 := 'n')
---
>     , AWR_INFO IN VARCHAR2 := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
394c405,406
<     , AWR_INFO IN VARCHAR2 := 'n')
---
>     , AWR_INFO       IN VARCHAR2 := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
415c427,428
<     , INSTANCE_NUMBER IN NUMBER := NULL)
---
>     , INSTANCE_NUMBER IN NUMBER := NULL
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
468c481,482
<     , INSTANCE_NUMBER IN NUMBER := NULL)
---
>     , INSTANCE_NUMBER IN NUMBER := NULL
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.4RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.04.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.04.01.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.04.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.04.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.04.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('19.04.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.04.01.00', 1, fsn - 1));
31c31
<                to_number(substr('19.04.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.04.01.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.04.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.04.01.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.04.00.00',  psn + 1));
---
>                              to_number(substr('19.04.01.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (RU):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.04.00.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.05.00.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.04.00.00', '.');
<   msn  CONSTANT NUMBER := instr('19.04.00.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.04.00.00', '.', msn + 1);
---
>   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);
29c29
<                            to_number(substr('19.04.00.00', 1, fsn - 1));
---
>                            to_number(substr('19.05.00.00', 1, fsn - 1));
31c31
<                to_number(substr('19.04.00.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.05.00.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.04.00.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.05.00.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.04.00.00',  psn + 1));
---
>                              to_number(substr('19.05.00.00',  psn + 1));
SYS.DBMS_BACKUP_RESTORE - PACKAGE (19.3RUR):
12c12
<   bannerVersion CONSTANT VARCHAR2(15) := '19.03.01.00';
---
>   bannerVersion CONSTANT VARCHAR2(15) := '19.03.02.00';
24,26c24,26
<   fsn  CONSTANT NUMBER := instr('19.03.01.00', '.');
<   msn  CONSTANT NUMBER := instr('19.03.01.00', '.', fsn + 1);
<   psn  CONSTANT NUMBER := instr('19.03.01.00', '.', msn + 1);
---
>   fsn  CONSTANT NUMBER := instr('19.03.02.00', '.');
>   msn  CONSTANT NUMBER := instr('19.03.02.00', '.', fsn + 1);
>   psn  CONSTANT NUMBER := instr('19.03.02.00', '.', msn + 1);
29c29
<                            to_number(substr('19.03.01.00', 1, fsn - 1));
---
>                            to_number(substr('19.03.02.00', 1, fsn - 1));
31c31
<                to_number(substr('19.03.01.00', fsn + 1, msn - fsn - 1));
---
>                to_number(substr('19.03.02.00', fsn + 1, msn - fsn - 1));
33c33
<               to_number(substr('19.03.01.00',  msn + 1, psn - msn - 1));
---
>               to_number(substr('19.03.02.00',  msn + 1, psn - msn - 1));
35c35
<                              to_number(substr('19.03.01.00',  psn + 1));
---
>                              to_number(substr('19.03.02.00',  psn + 1));
SYS.DBMS_REGISTRY - PACKAGE (19.4RUR):
13c13
<                                '19.4.0.0.0';
---
>                                '19.4.1.0.0';
SYS.DBMS_REGISTRY - PACKAGE (RU):
13c13
<                                '19.4.0.0.0';
---
>                                '19.5.0.0.0';
SYS.DBMS_REGISTRY - PACKAGE (19.3RUR):
13c13
<                                '19.3.1.0.0';
---
>                                '19.3.2.0.0';
SYS.PRVT_ASH_OMX - PACKAGE (RU):
43a44
>   
56a58
>     AWR_INFO        IN VARCHAR2 := NULL,
SYS.SDO_RDF_EXP_IMP - PACKAGE (RU):
2a3,5
>   -- #28103358: MDSYS packages require PRAGMA for DBMS_ROLLING upgrade support
>   PRAGMA SUPPLEMENTAL_LOG_DATA(default, NONE);
> 
SYS.SDO_RDF_SYS - PACKAGE (RU):
2a3,5
>   
>   PRAGMA SUPPLEMENTAL_LOG_DATA(DEFAULT, NONE);
> 
SYS.DBMS_AQ_INV - PACKAGE BODY (RU):
37a38,41
>   TA                  SYS.RE$TABLE_ALIAS_LIST;
>   RESULT              BOOLEAN;
>   INSUFFICIENT_PRIVILEGE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INSUFFICIENT_PRIVILEGE, -1031);
56a61,68
>     TA := SYS.RE$TABLE_ALIAS_LIST(SYS.RE$TABLE_ALIAS('qtview',
>     DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
>     DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$'||QT_NAME||DQT)));
>     
>     SYS.DBMS_RULE.IS_FAST(
> 	EXPRESSION => NEW_PURGE_COND,
>         TABLE_ALIASES => TA,
>         RESULT_VAL => RESULT);
57a70,72
>     IF RESULT = FALSE  THEN
>       RAISE INSUFFICIENT_PRIVILEGE;
>     END IF;
267a283,286
>   TA            SYS.RE$TABLE_ALIAS_LIST;
>   RESULT        BOOLEAN;
>   INSUFFICIENT_PRIVILEGE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INSUFFICIENT_PRIVILEGE, -1031);
301a321,334
>      TA := SYS.RE$TABLE_ALIAS_LIST(SYS.RE$TABLE_ALIAS('qtview',
>      DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
>      DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$'||QT_NAME||DQT)));
>      IF PURGE_CONDITION IS NOT NULL THEN
>      
>        SYS.DBMS_RULE.IS_FAST(
>          EXPRESSION => PURGE_CONDITION,
>          TABLE_ALIASES => TA,
>          RESULT_VAL => RESULT);
> 
>        IF RESULT = FALSE  THEN
>          RAISE INSUFFICIENT_PRIVILEGE;
>        END IF;
>      END IF;
365a399,402
>   TA            SYS.RE$TABLE_ALIAS_LIST;
>   RESULT        BOOLEAN;
>   INSUFFICIENT_PRIVILEGE EXCEPTION;
>   PRAGMA EXCEPTION_INIT(INSUFFICIENT_PRIVILEGE, -1031);
392a430,441
>        TA := SYS.RE$TABLE_ALIAS_LIST(SYS.RE$TABLE_ALIAS('qtview',
>        DBMS_ASSERT.ENQUOTE_NAME(DQT||QT_SCHEMA||DQT) || '.' ||
>        DBMS_ASSERT.ENQUOTE_NAME(DQT||'AQ$'||QT_NAME||DQT)));
>        
>        SYS.DBMS_RULE.IS_FAST(
>          EXPRESSION => PURGE_CONDITION,
>          TABLE_ALIASES => TA,
>          RESULT_VAL => RESULT);
> 
>        IF RESULT = FALSE  THEN
>          RAISE INSUFFICIENT_PRIVILEGE;
>        END IF;
SYS.DBMS_ASH - PACKAGE BODY (RU):
465a466,468
>              ,NVL(CONTEXT.LOCAL_CONID,0) AS "con_id"
>              ,NVL(CONTEXT.LOCAL_AUTO_TYPE,'NONE') AS "auto_type"
>              ,CONTEXT.LOCAL_VERSION AS "version"
475c478
<                            AWR_INFO IN VARCHAR)
---
>                            AWR_INFO IN VARCHAR, IGNORE_CPU_HISTORY IN VARCHAR)
519a523,527
>     IF UPPER(IGNORE_CPU_HISTORY) = 'Y' THEN
>       CONTEXT.IGNORE_CPU_HISTORY := TRUE;
>     ELSE
>       CONTEXT.IGNORE_CPU_HISTORY := FALSE;
>     END IF;
547,558c555,562
<     IF CONTEXT.LOCAL_COMP_VER >= VER_20 THEN
<       EXECUTE IMMEDIATE
<         'SELECT SYS.dbms_sqltune_util2.is_system_data_locked FROM SYS.DUAL'
<       INTO AUTO_PARAM_VALUE;
<     ELSE 
<       EXECUTE IMMEDIATE 
<         'SELECT MAX(SUBSTR(value,1,10)) FROM v$system_parameter
<          WHERE  name = ''_cloud_service_type'''
<       INTO AUTO_PARAM_VALUE;
<     END IF;
<     IF AUTO_PARAM_VALUE IS NULL OR UPPER(AUTO_PARAM_VALUE) = 'NONE' 
<        OR UPPER(AUTO_PARAM_VALUE) = 'NO' THEN 
---
>     BEGIN
>       AUTO_PARAM_VALUE := UPPER(NVL(SYS_CONTEXT('USERENV','CLOUD_SERVICE'),
>                                 'NONE'));
>       EXCEPTION WHEN OTHERS THEN
>         AUTO_PARAM_VALUE := 'NONE';
>     END;
>     CONTEXT.LOCAL_AUTO_TYPE := SUBSTR(AUTO_PARAM_VALUE, 1, 20);
>     IF CONTEXT.LOCAL_AUTO_TYPE = 'NONE' THEN
901c905
<          MINIMIZE_COST, AWR_INFO);
---
>          MINIMIZE_COST, AWR_INFO, 'n');
920c924,925
<        , AWR_INFO IN VARCHAR)
---
>        , AWR_INFO IN VARCHAR
>        , IGNORE_CPU_HISTORY IN VARCHAR)
925c930
<               MINIMIZE_COST, AWR_INFO);
---
>               MINIMIZE_COST, AWR_INFO, IGNORE_CPU_HISTORY);
961c966,967
<        , AWR_INFO IN VARCHAR)
---
>        , AWR_INFO IN VARCHAR
>        , IGNORE_CPU_HISTORY IN VARCHAR)
966c972
<          MINIMIZE_COST, AWR_INFO);
---
>          MINIMIZE_COST, AWR_INFO, IGNORE_CPU_HISTORY);
1064a1071,1118
>   
>   
>   
>   
>   
>   
>   PROCEDURE GETDATABOUNDARY(CONTEXT IN OUT NOCOPY CONTEXTTYPE)
>   IS
>     L_MIN_SNAP NUMBER := NULL;
>     L_MAX_SNAP NUMBER := NULL;
>     L_MIN_TIME DATE := NULL;
>     L_MAX_TIME DATE := NULL;
>     L_SQLTEXT  VARCHAR2(4000);
>     L_ERR_MSG VARCHAR2(4000);
>   BEGIN
>     L_SQLTEXT := 
>   'SELECT min(snap_id), max(snap_id) FROM ' || CONTEXT.AWRTABLEPREFIX || 
>   'SNAPSHOT WHERE dbid = :1';
>     EXECUTE IMMEDIATE L_SQLTEXT 
>     INTO   L_MIN_SNAP, L_MAX_SNAP
>     USING  CONTEXT.DBID;
>   
>     IF L_MIN_SNAP IS NOT NULL THEN
>       L_SQLTEXT := 
>   'SELECT CAST(MIN(begin_interval_time-snap_timezone) AS DATE),
>           CAST(MAX(end_interval_time-snap_timezone) AS DATE)
>    FROM ' || CONTEXT.AWRTABLEPREFIX || 'SNAPSHOT 
>    WHERE dbid = :1 AND snap_id IN (:2,:3)';
>       EXECUTE IMMEDIATE L_SQLTEXT
>       INTO   L_MIN_TIME, L_MAX_TIME
>       USING CONTEXT.DBID, L_MIN_SNAP, L_MAX_SNAP;
>     END IF;
>     
>     IF CONTEXT.IS_LOCAL THEN
>       L_MAX_TIME := CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE);
>       IF L_MIN_TIME IS NULL THEN
>         L_MIN_TIME := L_MAX_TIME - CONTEXT.MEMSIZEDAYS;
>       END IF;
>     END IF;
>     CONTEXT.MINAVAILTIMEUTC := L_MIN_TIME;
>     CONTEXT.MAXAVAILTIMEUTC := L_MAX_TIME;
> 
>     EXCEPTION WHEN OTHERS THEN
>        L_ERR_MSG := SQLERRM;
>        SELECT XMLELEMENT("error",L_ERR_MSG,XMLELEMENT("sqltext",L_SQLTEXT))
>        INTO CONTEXT.ERROR_XML FROM SYS.DUAL;
>   END GETDATABOUNDARY;
> 
1511c1565
<    CONTEXT := INITBASECONTEXT(P_DBID,'n','n','n',P_INST_NUM,'n','y');
---
>    CONTEXT := INITBASECONTEXT(P_DBID,'n','n','n',P_INST_NUM,'n','y','n');
1547c1601,1602
<                                 P_FULL_REPORT IN BOOLEAN)
---
>                                 P_FULL_REPORT IN BOOLEAN,
>                                 P_HISTORY IN XMLTYPE)
1552c1607,1611
<     L_INST_PRED VARCHAR2(1000);
---
>     L_CPUS    NUMBER := NULL;
>     L_CORES   NUMBER := NULL;
>     L_LIMIT   NUMBER := NULL;
>     L_INST_PRED_WHERE VARCHAR2(1000) := NULL;
>     L_INST_PRED_AND VARCHAR2(1000) := NULL;
1554c1613
<     L_INFO  XMLTYPE;
---
>     L_ERR_MSG VARCHAR2(4000);
1557,1560c1616,1619
<     IF CONTEXT.INSTANCE_NUMBER IS NULL THEN
<       L_INST_PRED := NULL;
<     ELSE
<       L_INST_PRED := ' WHERE TO_NUMBER(USERENV(''INSTANCE'')) = ' 
---
>     IF CONTEXT.INSTANCE_NUMBER IS NOT NULL THEN
>       L_INST_PRED_WHERE := ' WHERE TO_NUMBER(USERENV(''INSTANCE'')) = ' 
>           || CONTEXT.INSTANCE_NUMBER || ' ';
>       L_INST_PRED_AND := ' AND TO_NUMBER(USERENV(''INSTANCE'')) = ' 
1564,1575c1623,1625
<       q'[
< SELECT xmlelement("cpuinfo",
<            xmlattributes(
<             :1 as "time",
<             num_cpus as "cpus",
<             num_cpu_cores as "cores",
<             cpu_limit as "limit"
<       ))
< FROM (
<   SELECT SUM(num_cpus) as num_cpus,
<          SUM(num_cpu_cores) as num_cpu_cores,
<          SUM(LEAST(cpu_limit,num_cpus)) as cpu_limit
---
>       q'[SELECT SUM(num_cpus) as num_cpus,
>                 SUM(num_cpu_cores) as num_cpu_cores,
>                 SUM(LEAST(cpu_limit,num_cpus)) as cpu_limit
1599c1649
<              ) par ]' || L_INST_PRED || q'[
---
>              ) par ]' || L_INST_PRED_WHERE || q'[
1602,1603c1652
<   )
< ) ]';
---
>   ) ]';
1605,1607c1654,1677
<     EXECUTE IMMEDIATE L_SQLTEXT 
<     INTO L_INFO
<     USING L_NOW;
---
>     IF CONTEXT.LOCAL_IS_PDB THEN
>       BEGIN
>         EXECUTE IMMEDIATE L_SQLTEXT
>         INTO L_CPUS, L_CORES, L_LIMIT;
>         EXCEPTION WHEN OTHERS THEN
>            L_LIMIT := NULL;
>       END;
>       IF L_LIMIT IS NULL THEN
>          L_SQLTEXT :=
>         'SELECT SUM(cpu_limit) 
>          FROM   TABLE(GV$(CURSOR(
>            SELECT TO_NUMBER(value) as cpu_limit
>            FROM   v$parameter
>            WHERE  name = ''cpu_count'' ' || L_INST_PRED_AND || '
>          )))';
>          EXECUTE IMMEDIATE L_SQLTEXT
>          INTO L_LIMIT;
>       END IF;
>       L_CPUS := NULL;
>       L_CORES := NULL;
>     ELSE
>       EXECUTE IMMEDIATE L_SQLTEXT 
>       INTO L_CPUS, L_CORES, L_LIMIT;
>     END IF;
1610c1680,1693
<       SELECT XMLELEMENT("report", P_INPUT, L_INFO)
---
>       SELECT XMLELEMENT("report", P_INPUT, 
>                 XMLELEMENT("cpuinfo", XMLATTRIBUTES(
>                   L_NOW AS "time",
>                   L_CPUS AS "cpus",
>                   L_CORES AS "cores",
>                   L_LIMIT AS "limit"), P_HISTORY))
>       INTO   L_REPORT
>       FROM   SYS.DUAL;
>     ELSE
>       SELECT XMLELEMENT("cpuinfo", XMLATTRIBUTES(
>                   L_NOW AS "time",
>                   L_CPUS AS "cpus",
>                   L_CORES AS "cores",
>                   L_LIMIT AS "limit"), P_HISTORY)
1613d1695
<       RETURN L_REPORT;
1615c1697,1707
<     RETURN L_INFO;
---
>     RETURN L_REPORT;
> 
>     EXCEPTION WHEN OTHERS THEN
>        L_ERR_MSG := SQLERRM;
>        SELECT XMLELEMENT("error",L_ERR_MSG,XMLELEMENT("sqltext",L_SQLTEXT))
>        INTO L_REPORT FROM SYS.DUAL;
>        IF NOT CONTEXT.SHOW_SQL THEN
>          PRINT_SQL(L_SQLTEXT);
>        END IF;
>        DBMS_OUTPUT.PUT_LINE(L_ERR_MSG);
>        RETURN L_REPORT;
1624,1628c1716
<   
<   FUNCTION GETCPUINFOFROMAWR(CONTEXT IN OUT NOCOPY CONTEXTTYPE,
<                              P_SNAP_ID IN NUMBER,
<                              P_INPUT IN XMLTYPE,
<                              P_FULL_REPORT IN BOOLEAN)
---
>   FUNCTION GETCPUHISTORY(CONTEXT IN OUT NOCOPY CONTEXTTYPE)
1631a1720,1722
>     L_SQLCLOB CLOB;
>     L_INST_PRED_S VARCHAR2(1000) := NULL;
>     L_CON_DBID VARCHAR2(1000) := NULL;
1633,1636c1724
<     L_INFO    XMLTYPE;
<     L_SNAP_ID NUMBER := P_SNAP_ID;
<     L_INST_PRED1 VARCHAR2(1000);
<     L_INST_PRED2 VARCHAR2(1000);
---
>     L_ERR_MSG VARCHAR2(4000);
1638,1644c1726,1727
<     IF CONTEXT.INSTANCE_NUMBER IS NULL THEN
<       L_INST_PRED1 := NULL;
<       L_INST_PRED2 := NULL;
<     ELSE
<       L_INST_PRED1 := ' AND instance_number = ' || 
<                       CONTEXT.INSTANCE_NUMBER || ' ';
<       L_INST_PRED2 := ' AND i.inst_id = ' || CONTEXT.INSTANCE_NUMBER || ' ';
---
>     IF NOT CONTEXT.DISKENABLE OR CONTEXT.IGNORE_CPU_HISTORY THEN
>        RETURN NULL;
1646,1662c1729,1730
< 
<     IF L_SNAP_ID IS NULL THEN
<       L_SQLTEXT := 
< 'WITH snaps AS
<   (SELECT snap_id, count(*) as cnt
<    FROM   ' || CONTEXT.AWRTABLEPREFIX || 'snapshot
<    WHERE  dbid = ' || TO_CHAR(CONTEXT.DBID) || L_INST_PRED1 ||
<    ' AND  snap_id >= ' || TO_CHAR(NVL(CONTEXT.BEGINSNAPID,0)) ||
<    ' AND  snap_id <= ' || TO_CHAR(NVL(CONTEXT.ENDSNAPID,1000000000)) ||
< '  GROUP BY snap_id)
<   SELECT max(snap_id) FROM snaps
<   WHERE  cnt = (SELECT max(cnt) FROM snaps) ';
<       EXECUTE IMMEDIATE L_SQLTEXT 
<       INTO L_SNAP_ID;
<       IF L_SNAP_ID IS NULL THEN
<         RETURN NULL;
<       END IF;
---
>     IF CONTEXT.INSTANCE_NUMBER IS NOT NULL THEN
>       L_INST_PRED_S := ' AND s.instance_number = ' || CONTEXT.INSTANCE_NUMBER;
1664,1726c1732,1824
<     
<     L_SQLTEXT := 
<       q'[
< SELECT xmlelement("cpuinfo",
<            xmlattributes(
<             to_char(s_time, ]' ||
<       SYS.DBMS_ASSERT.ENQUOTE_LITERAL(OMC_TIME_FORMAT)
<   || q'[ ) as "time",
<             num_cpus as "cpus",
<             num_cpu_cores as "cores",
<             cpu_limit as "limit"
<       ))
< FROM (
<   SELECT SUM(num_cpus) as num_cpus,
<          SUM(num_cpu_cores) as num_cpu_cores,
<          SUM(LEAST(cpu_limit,num_cpus)) as cpu_limit,
<          MAX(s_time) as s_time
<   FROM (
<     SELECT host_name, max(s_time) as s_time, AVG(num_cpus) as num_cpus,
<            AVG(num_cpu_cores) as num_cpu_cores, SUM(cpu_limit) as cpu_limit
<     FROM (
<       SELECT i.inst_id, i.host_name, i.s_time,
<              NVL(os.num_cpus, os.num_cpu_cores) as num_cpus,
<              NVL(os.num_cpu_cores, os.num_cpus) as num_cpu_cores,
<              CASE WHEN (par.res_plan IS NULL
<                         OR par.cpu_count IS NULL
<                         OR par.cpu_count = 0)
<                   THEN NVL(os.num_cpus, os.num_cpu_cores)
<                   ELSE LEAST(par.cpu_count, NVL(os.num_cpus, os.num_cpu_cores))
<                   END as cpu_limit
<       FROM ( SELECT s.instance_number as inst_id,
<                     di.host_name as host_name,
<                     s.end_interval_time - s.snap_timezone as s_time
<              FROM   AWRPREFIXsnapshot s, AWRPREFIXdatabase_instance di
<              WHERE  s.dbid = :1 
<                AND  s.snap_id = :2
<                AND  di.dbid = :3
<                AND  di.startup_time = s.startup_time
<            ) i,
<            ( SELECT instance_number as inst_id
<                    ,MAX(DECODE(stat_name, 'NUM_CPUS', value, NULL)) as num_cpus
<                    ,MAX(DECODE(stat_name, 'NUM_CPUS', NULL, value)) as num_cpu_cores
<              FROM   AWRPREFIXosstat
<              WHERE dbid = :4 
<                AND snap_id = :5
<                AND stat_name IN ('NUM_CPUS', 'NUM_CPU_CORES')
<              GROUP BY instance_number
<            ) os,
<            ( SELECT instance_number as inst_id
<                    ,TO_NUMBER(MAX(DECODE(parameter_name, 'cpu_count', value, NULL))) as cpu_count
<                    ,MAX(DECODE(parameter_name, 'cpu_count', NULL, value)) as res_plan
<              FROM   AWRPREFIXparameter
<              WHERE dbid = :6 
<                AND snap_id = :7
<                AND parameter_name IN ('cpu_count', 'resource_manager_plan')
<              GROUP BY instance_number
<            ) par
<       WHERE i.inst_id = os.inst_id 
<         AND i.inst_id = par.inst_id ]' || L_INST_PRED2 || q'[
<     )
<     GROUP BY host_name
<   )
< ) ]';
---
>     IF CONTEXT.DISK_COMP_VER >= VER_12 THEN
>       L_CON_DBID := ' AND s.con_dbid = s.dbid ';
>     END IF;
> 
>     L_SQLTEXT :=
>       q'[ WITH
>   snaps as (
>     SELECT /*+ NO_MERGE */ s.snap_id, s.instance_number,
>            s.end_interval_time-s.snap_timezone as snap_time,
>            i.host_name
>     FROM   AWRPREFIXsnapshot s, AWRPREFIXdatabase_instance i
>     WHERE  s.dbid = :l_dbid
>       AND  s.snap_id >= :l_begin_snap
>       AND  s.snap_id <= :l_end_snap @INST_S@
>       AND  i.dbid = :l_dbid
>       AND  i.startup_time = s.startup_time
>       AND  i.instance_number = s.instance_number
>   ),
>   base_os_stat as (
>     SELECT /*+ NO_MERGE */ s.snap_id, s.instance_number,
>            s.stat_name, s.value
>     FROM   AWRPREFIXosstat s
>     WHERE  s.dbid = :l_dbid
>       AND  s.snap_id >= :l_begin_snap
>       AND  s.snap_id <= :l_end_snap @INST_S@
>       AND  s.stat_name IN ('NUM_CPUS', 'NUM_CPU_CORES')
>   ),
>   full_os_stat as (
>     SELECT nvl(s1.snap_id, s2.snap_id) as snap_id,
>            nvl(s1.instance_number, s2.instance_number) as instance_number,
>            nvl(s1.value, s2.value) as num_cpus,
>            nvl(s2.value, s1.value) as num_cores
>     FROM   base_os_stat s1 FULL OUTER JOIN base_os_stat s2
>            ON (s1.snap_id = s2.snap_id
>                AND s1.instance_number = s2.instance_number)
>     WHERE  s1.stat_name = 'NUM_CPUS' and s2.stat_name = 'NUM_CPU_CORES'
>   ),
>   base_param as (
>     SELECT /*+ NO_MERGE */ s.snap_id, s.instance_number,
>            s.parameter_name, s.value, s.con_dbid
>     FROM   AWRPREFIXparameter s
>     WHERE  s.dbid = :l_dbid
>       AND  s.snap_id >= :l_begin_snap
>       AND  s.snap_id <= :l_end_snap @INST_S@
>       AND  s.parameter_name in ('cpu_count', 'resource_manager_plan') @CONDBID@
>   ),
>   full_param as (
>     SELECT nvl(s1.snap_id, s2.snap_id) as snap_id,
>            nvl(s1.instance_number, s2.instance_number) as instance_number,
>            case when s2.value IS NULL 
>                 THEN NULL 
>                 ELSE TO_NUMBER(s1.value)
>                 END as cpu_limit
>     FROM   base_param s1 FULL OUTER JOIN base_param s2
>            ON (s1.snap_id = s2.snap_id
>                AND s1.instance_number = s2.instance_number)
>     WHERE  s1.parameter_name = 'cpu_count' 
>       AND  s2.parameter_name = 'resource_manager_plan'
>   ),
>   all_stats as (
>     SELECT nvl(s.snap_id, p.snap_id) as snap_id,
>            nvl(s.instance_number, p.instance_number) as instance_number,
>            s.num_cpus, s.num_cores, 
>            CASE WHEN p.cpu_limit IS NULL THEN s.num_cpus
>                 ELSE LEAST(p.cpu_limit, NVL(s.num_cpus, p.cpu_limit))
>                 END as cpu_limit
>     FROM   full_os_stat s FULL OUTER JOIN full_param p
>            ON (s.snap_id = p.snap_id
>                AND s.instance_number = p.instance_number)
>   ),
>   db_stats as (
>     SELECT /*+ NO_MERGE */ snap_id, 
>            MAX(snap_time) as snap_time,
>            SUM(num_cpus) as num_cpus,
>            SUM(num_cores) as num_cores,
>            SUM(cpu_limit) as cpu_limit
>     FROM  (
>        SELECT s.snap_id, s.host_name,
>               MAX(s.snap_time) as snap_time,
>               MAX(a.num_cpus) as num_cpus,
>               MAX(a.num_cores) as num_cores,
>               LEAST(MAX(a.num_cpus), SUM(a.cpu_limit)) as cpu_limit
>        FROM   all_stats a, snaps s
>        WHERE  a.snap_id = s.snap_id
>          AND  a.instance_number = s.instance_number
>        GROUP BY s.snap_id, s.host_name
>      )
>   GROUP BY snap_id
>   ),
>   row_data as (
>      SELECT snap_time, 'limit' as name, cpu_limit as value
>      FROM   db_stats ]';
> 
1727a1826,1868
>     L_SQLTEXT := REPLACE(L_SQLTEXT, '@INST_S@', L_INST_PRED_S);
>     L_SQLTEXT := REPLACE(L_SQLTEXT, '@CONDBID@', L_CON_DBID);
>     L_SQLCLOB := L_SQLTEXT;
> 
>     IF NOT CONTEXT.IS_LOCAL OR NOT CONTEXT.LOCAL_IS_PDB THEN
>       L_SQLTEXT := q'[ UNION ALL 
>      SELECT snap_time, 'cpus' as name, num_cpus as value
>      FROM   db_stats
>      UNION ALL 
>      SELECT snap_time, 'cores' as name, num_cores as value
>      FROM   db_stats ]';
>       SYS.DBMS_LOB.WRITEAPPEND(L_SQLCLOB, LENGTH(L_SQLTEXT), L_SQLTEXT);
>     END IF;
>     L_SQLTEXT := q'[ ),
>   l_data as (
>     SELECT name, snap_time, value,
>            LAG(value,1) OVER (ORDER BY name, snap_time) as p_value,
>            LAG(name,1) OVER (ORDER BY name, snap_time) as p_name,
>            LEAD(name,1) OVER (ORDER BY name, snap_time) as n_name
>     FROM   row_data
>     ORDER BY name,snap_time
>   ),
>   final_data as (
>     SELECT name, snap_time, value
>     FROM l_data
>     WHERE  p_name IS NULL
>        OR  n_name IS NULL
>        OR  name <> p_name
>        OR  name <> n_name
>        OR  value <> p_value
>     ORDER BY name,snap_time
>   ),
>   xml_data as
>   (SELECT name,
>           xmlelement("list",xmlattributes(name as "name"),xmlagg(xmlelement("c",xmlattributes(
>             to_char(snap_time,'MM/DD/YYYY HH24:MI:SS') as "t",
>             value as "v"
>           )))) as x
>    FROM   final_data
>    GROUP BY name
>   )
> SELECT xmlagg(x) FROM xml_data ]';
>     SYS.DBMS_LOB.WRITEAPPEND(L_SQLCLOB, LENGTH(L_SQLTEXT), L_SQLTEXT);
1729,1732c1870,1875
<     EXECUTE IMMEDIATE L_SQLTEXT 
<     INTO L_INFO
<     USING CONTEXT.DBID, L_SNAP_ID, CONTEXT.DBID, 
<           CONTEXT.DBID, L_SNAP_ID, CONTEXT.DBID, L_SNAP_ID;
---
>     EXECUTE IMMEDIATE L_SQLCLOB
>     INTO L_REPORT
>     USING CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID, CONTEXT.DBID,
>           CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID,
>           CONTEXT.DBID, CONTEXT.BEGINSNAPID, CONTEXT.ENDSNAPID;
>     RETURN L_REPORT;
1734,1741c1877,1882
<     IF P_FULL_REPORT THEN
<       SELECT XMLELEMENT("report", P_INPUT, L_INFO)
<       INTO   L_REPORT
<       FROM   SYS.DUAL;
<       RETURN L_REPORT;
<     END IF;
<     RETURN L_INFO;
<   END GETCPUINFOFROMAWR;
---
>     EXCEPTION WHEN OTHERS THEN
>        L_ERR_MSG := SQLERRM;
>        SELECT XMLELEMENT("error",L_ERR_MSG,XMLELEMENT("sqltext",L_SQLCLOB))
>        INTO L_REPORT FROM SYS.DUAL;
>        RETURN L_REPORT;
>   END GETCPUHISTORY;
1758c1899,1900
<                             INSTANCE_NUMBER IN NUMBER := NULL) 
---
>                             INSTANCE_NUMBER IN NUMBER := NULL,
>                             IGNORE_CPU_HISTORY IN VARCHAR := 'n')
1761,1762c1903
<     CONTEXT    CONTEXTTYPE := 
<           INITBASECONTEXT(DBID,'n','n','n',INSTANCE_NUMBER,'n','n');
---
>     CONTEXT    CONTEXTTYPE ;
1764,1774c1905,1906
<     L_SQLTEXT  VARCHAR2(4000);
<     L_END_TIME DATE;
<     L_BEGIN_TIME DATE;
<     L_END_SNAP NUMBER;
<     L_BEGIN_SNAP NUMBER;
<     L_REQ_TIME DATE;
<     L_REQ_TIMESTAMP TIMESTAMP;
<     L_NOW      DATE;
<     L_EMPTY    XMLTYPE;
<     L_INST     NUMBER;
<     L_INST_PRED VARCHAR2(1000);
---
>     L_HISTORY XMLTYPE := NULL;
>     L_REPORT  XMLTYPE;
1775a1908,1916
>   CONTEXT := BUILDBASECONTEXTHISTORICAL(
>          DBID 
>        , OBSERVATIONTIME
>        , TO_CHAR(SYS_EXTRACT_UTC(SYSTIMESTAMP), OMC_TIME_FORMAT)
>        , NULL
>        , 'n', 'n', 'n'
>        , INSTANCE_NUMBER 
>        , 'n', 'n', IGNORE_CPU_HISTORY);
> 
1783,1823c1924,1925
<     
<     IF CONTEXT.INSTANCE_NUMBER IS NULL THEN
<       L_INST := NULL;
<       L_INST_PRED := NULL;
<     ELSE
<       L_INST := CONTEXT.INSTANCE_NUMBER;
<       L_INST_PRED := ' AND instance_number = ' || L_INST || ' ';
<     END IF;
< 
<     
<     IF DBID IS NULL OR DBID = CONTEXT.LOCAL_DBID THEN 
<       IF OBSERVATIONTIME IS NULL THEN
<         RETURN GETCPUINFOFROMMEMORY(CONTEXT,L_INPUT,TRUE);
<       ELSE 
<         L_SQLTEXT := 
<           'SELECT MAX(snap_id), 
<                   CAST(MAX(end_interval_time-snap_timezone) AS DATE)
<            FROM ' || CONTEXT.AWRTABLEPREFIX || 'SNAPSHOT WHERE dbid = :1'
<            || L_INST_PRED;
<         EXECUTE IMMEDIATE L_SQLTEXT
<         INTO    L_END_SNAP, L_END_TIME
<         USING   CONTEXT.LOCAL_DBID;
<         IF L_END_SNAP IS NULL THEN
<           
<           RETURN GETCPUINFOFROMMEMORY(CONTEXT,L_INPUT,TRUE);
<         END IF;
<         
<         L_REQ_TIME := TO_DATE(OBSERVATIONTIME, OMC_TIME_FORMAT);
<         L_NOW := CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE);
<         IF L_REQ_TIME >= L_END_TIME THEN
<           IF L_NOW - L_REQ_TIME < L_REQ_TIME - L_END_TIME THEN
<             
<             RETURN GETCPUINFOFROMMEMORY(CONTEXT, L_INPUT,TRUE); 
<           ELSE 
<             CONTEXT.DBID := CONTEXT.LOCAL_DBID;
<             RETURN GETCPUINFOFROMAWR(CONTEXT, L_END_SNAP, L_INPUT, TRUE);
<           END IF;
<         END IF;
<       END IF;
<       
<       
---
>     IF LOWER(IGNORE_CPU_HISTORY) <> 'y' THEN
>       L_HISTORY := GETCPUHISTORY(CONTEXT);
1825,1844c1927,1928
< 
<     
<     IF OBSERVATIONTIME IS NULL THEN 
<       
<       L_SQLTEXT := 
<         'SELECT MAX(snap_id)
<          FROM ' || CONTEXT.AWRTABLEPREFIX || 'SNAPSHOT WHERE dbid = :1'
<          || L_INST_PRED;
<       EXECUTE IMMEDIATE L_SQLTEXT
<       INTO    L_END_SNAP
<       USING   CONTEXT.DBID;
<       IF L_END_SNAP IS NULL THEN
<         
<         SELECT XMLELEMENT("report", L_INPUT, 
<                  XMLELEMENT("error",'No Data in AWR'))
<         INTO   L_EMPTY 
<         FROM   SYS.DUAL;
<         RETURN L_EMPTY;
<       END IF;
<       RETURN GETCPUINFOFROMAWR(CONTEXT, L_END_SNAP, L_INPUT, TRUE);
---
>     IF CONTEXT.IS_LOCAL THEN
>       RETURN GETCPUINFOFROMMEMORY(CONTEXT,L_INPUT,TRUE,L_HISTORY);  
1847,1868c1931,1935
<     L_REQ_TIMESTAMP := TO_TIMESTAMP(OBSERVATIONTIME, OMC_TIME_FORMAT);
<     L_SQLTEXT := 
<       'SELECT MAX(CASE WHEN end_interval_time-snap_timezone <= :1 
<                   THEN snap_id ELSE NULL END),
<               MIN(CASE WHEN end_interval_time-snap_timezone >= :2 
<                   THEN snap_id ELSE NULL END)
<        FROM ' || CONTEXT.AWRTABLEPREFIX || 'SNAPSHOT
<        WHERE dbid = :3' || L_INST_PRED;
<     EXECUTE IMMEDIATE L_SQLTEXT
<     INTO    L_BEGIN_SNAP, L_END_SNAP
<     USING   L_REQ_TIMESTAMP, L_REQ_TIMESTAMP, CONTEXT.DBID;
<     IF L_BEGIN_SNAP IS NULL AND L_END_SNAP IS NULL THEN
<       SELECT XMLELEMENT("report", L_INPUT,
<                  XMLELEMENT("error",'No Data in AWR'))
<       INTO   L_EMPTY
<       FROM   SYS.DUAL;
<       RETURN L_EMPTY;
<     END IF;
<     RETURN GETCPUINFOFROMAWR(CONTEXT, 
<                              GREATEST(NVL(L_BEGIN_SNAP, L_END_SNAP),
<                                       NVL(L_END_SNAP, L_BEGIN_SNAP)),
<                              L_INPUT, TRUE);
---
>     SELECT XMLELEMENT("report", L_INPUT, 
>              XMLELEMENT("cpuinfo", L_HISTORY))
>     INTO   L_REPORT
>     FROM   SYS.DUAL;
>     RETURN L_REPORT;
1876a1944
>     L_HISTORY XMLTYPE := NULL;
1877a1946
>     L_HISTORY := GETCPUHISTORY(CONTEXT);
1879,1886c1948
<       IF CONTEXT.MEMENABLE THEN
<          L_CPU := GETCPUINFOFROMMEMORY(CONTEXT, NULL, FALSE);
<       ELSE
<          L_CPU := GETCPUINFOFROMAWR(CONTEXT, NULL, NULL, FALSE);
<          IF L_CPU IS NULL THEN
<            L_CPU := GETCPUINFOFROMMEMORY(CONTEXT, NULL, FALSE);
<          END IF;
<       END IF;
---
>       L_CPU := GETCPUINFOFROMMEMORY(CONTEXT,NULL,FALSE,L_HISTORY);
1888c1950,1952
<       L_CPU := GETCPUINFOFROMAWR(CONTEXT, NULL, NULL, FALSE);
---
>       SELECT XMLELEMENT("cpuinfo", L_HISTORY)
>       INTO   L_CPU
>       FROM   SYS.DUAL;
2226a2291,2292
>     
>     GETDATABOUNDARY(CONTEXT);
2374c2440
<             OR a.wait_class <> 'Idle') @DISK_PRED@ @AND_FG_ONLY@ @AND_INST_GVD@
---
>             OR a.wait_class <> 'Idle') @AND_FG_ONLY@ @AND_INST_GVD@
2399,2405d2464
<       IF CONTEXT.DISKENABLE THEN
<         L_SQLTEXT := REPLACE(L_SQLTEXT, '@DISK_PRED@', 
< ' AND a.is_awr_sample = ''Y'' AND bitand(a.flags,128)=0 ');
<       ELSE 
<         L_SQLTEXT := REPLACE(L_SQLTEXT, '@DISK_PRED@', NULL); 
<       END IF;
< 
3473c3532,3533
<        AND (CONTEXT.BEGINSNAPID IS NOT NULL) AND (CONTEXT.ENDSNAPID IS NOT NULL)) THEN 
---
>        AND (CONTEXT.BEGINSNAPID IS NOT NULL) 
>        AND (CONTEXT.ENDSNAPID IS NOT NULL)) THEN 
3511c3571,3572
<       L_TEXT := REPLACE(L_TEXT, '%con_dbid_to_id%', ',con_dbid_to_id(con_dbid) as con_id');
---
>       L_TEXT := REPLACE(L_TEXT, '%con_dbid_to_id%', 
>                                 ',con_dbid_to_id(con_dbid) as con_id');
3513,3516c3574,3581
<       IF CONTEXT.DISKENABLE THEN
<         L_TEXT := REPLACE(L_TEXT, '%con_id_pred%', ' AND m.con_dbid = n.con_dbid(+) ');
<       ELSE 
<         L_TEXT := REPLACE(L_TEXT, '%con_id_pred%', ' AND m.con_id = n.con_id(+) ');
---
>       IF (CONTEXT.DISKENABLE
>          AND (CONTEXT.BEGINSNAPID IS NOT NULL)
>          AND (CONTEXT.ENDSNAPID IS NOT NULL)) THEN
>         L_TEXT := REPLACE(L_TEXT, '%con_id_pred%', 
>                                   ' AND m.con_dbid = n.con_dbid(+) ');
>       ELSE
>         L_TEXT := REPLACE(L_TEXT, '%con_id_pred%', 
>                                   ' AND m.con_id = n.con_id(+) ');
4019d4083
< 
4699a4764,4769
> 
>     
>     IF HISTOGRAM_ONLY THEN
>       GETDATABOUNDARY(CONTEXT);
>     END IF;
> 
5087a5158,5162
>   
>   
>   
>   
>   
5139,5144c5214,5223
<     IF NOT L_DATA_TYPE IN ('data','timepicker','histogram') THEN
<       RAISE_APPLICATION_ERROR(-20001, 'Invalid value for data_type: ' || DATA_TYPE);
<     END IF;
<   
<     IF NOT L_TIME_TYPE IN ('realtime','historical','incremental') THEN
<       RAISE_APPLICATION_ERROR(-20002, 'Invalid value for time_type: ' || TIME_TYPE);
---
>     
>     IF NOT L_DATA_TYPE IN 
>           ('data','timepicker','histogram','version','awr','cpu') THEN
>       RAISE_APPLICATION_ERROR(-20001, 'Invalid value for data_type: ' 
>           || DATA_TYPE);
>     END IF;
>     IF L_DATA_TYPE IN ('data','timepicker','histogram') AND 
>        NOT L_TIME_TYPE IN ('realtime','historical','incremental') THEN
>       RAISE_APPLICATION_ERROR(-20002, 'Invalid value for time_type: ' 
>           || TIME_TYPE);
5146a5226
>     
5160c5240,5280
<   
---
> 
>     
>     IF LOWER(DATA_TYPE) = 'version' THEN
>       SELECT XMLELEMENT("report",XMLATTRIBUTES(
>                SYS.DBMS_ASH.GETVERSION() AS "version"
>              ))
>       INTO L_RESULT
>       FROM SYS.DUAL;
>       RETURN L_RESULT;
>     END IF;
> 
>     
>     IF LOWER(DATA_TYPE) = 'cpu' THEN
>       RETURN SYS.DBMS_ASH.GETCPUINFO(
>                 L_DBID, L_BEGIN_TIME_UTC, L_INSTANCE_NUMBER);
>     END IF;
> 
>     
>     IF LOWER(DATA_TYPE) = 'awr' THEN
>       IF L_DBID IS NULL 
>          OR L_BEGIN_TIME_UTC IS NULL 
>          OR L_END_TIME_UTC IS NULL THEN
>         RAISE_APPLICATION_ERROR(-20003, 
>  'Missing either dbid, begin_time_utc or end_time_utc arguments for "awr" API');
>       END IF;
>       RETURN SYS.DBMS_ASH.GETAWRINFO(
>                 L_DBID, L_BEGIN_TIME_UTC, L_END_TIME_UTC, L_INSTANCE_NUMBER);
>     END IF;
> 
>     
>     IF LOWER(TIME_TYPE) = 'increment' THEN
>       IF L_BEGIN_TIME_UTC IS NULL THEN
>         RAISE_APPLICATION_ERROR(-20003, 
>           'Missing begin_time_utc argument for "increment" time type');
>       END IF;
>       IF L_BUCKET_SIZE IS NULL THEN
>         RAISE_APPLICATION_ERROR(-20003, 
>           'Missing bucket_size argument for "increment" time type');
>       END IF;
>     END IF;
>     
5227c5347,5348
<                       INSTANCE_NUMBER IN NUMBER := NULL)
---
>                       INSTANCE_NUMBER IN NUMBER := NULL,
>                       IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5231c5352,5353
<     RETURN GETCPUINFOREPORT(DBID, OBSERVATIONTIME, INSTANCE_NUMBER);
---
>     RETURN GETCPUINFOREPORT(DBID, OBSERVATIONTIME, INSTANCE_NUMBER, 
>                             IGNORE_CPU_HISTORY);
5251c5373,5374
<     , AWR_INFO IN VARCHAR2 := 'n')
---
>     , AWR_INFO IN VARCHAR2 := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5259c5382
<                NVL(AWR_INFO,'n'));
---
>                NVL(AWR_INFO,'n'), NVL(IGNORE_CPU_HISTORY,'n'));
5346c5469,5470
<     , AWR_INFO IN VARCHAR2 := 'n')
---
>     , AWR_INFO IN VARCHAR2 := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5355c5479,5480
<                   INSTANCE_NUMBER,'n',NVL(AWR_INFO,'n'));
---
>                   INSTANCE_NUMBER,'n',NVL(AWR_INFO,'n'),
>                   NVL(IGNORE_CPU_HISTORY,'n'));
5394c5519,5520
<     , MINIMIZE_COST   IN VARCHAR := 'n')
---
>     , MINIMIZE_COST   IN VARCHAR := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5405c5531,5532
<                    VERBOSE_XML, INCLUDE_BG, INSTANCE_NUMBER, MINIMIZE_COST,'n');
---
>                    VERBOSE_XML, INCLUDE_BG, INSTANCE_NUMBER, 
>                    MINIMIZE_COST,'n',IGNORE_CPU_HISTORY);
5522c5649,5650
<     , MINIMIZE_COST   IN VARCHAR := 'n')
---
>     , MINIMIZE_COST   IN VARCHAR := 'n'
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5535c5663
<                   MINIMIZE_COST,'n');
---
>                   MINIMIZE_COST,'n',IGNORE_CPU_HISTORY);
5583c5711,5712
<     , INSTANCE_NUMBER IN NUMBER := NULL)
---
>     , INSTANCE_NUMBER IN NUMBER := NULL
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5589c5718,5719
<               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, 'n');
---
>               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, 'n',
>               NVL(IGNORE_CPU_HISTORY,'n'));
5648c5778,5779
<     , INSTANCE_NUMBER IN NUMBER := NULL)
---
>     , INSTANCE_NUMBER IN NUMBER := NULL
>     , IGNORE_CPU_HISTORY IN VARCHAR := 'n')
5655c5786,5787
<               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, 'n');
---
>               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, 'n',
>               NVL(IGNORE_CPU_HISTORY,'n'));
5684c5816
<               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, NVL(MINIMIZE_COST,'n'));
---
>               NVL(INCLUDE_BG,'n'), INSTANCE_NUMBER, NVL(MINIMIZE_COST,'n'),'n');
5753c5885
<               NVL(MINIMIZE_COST,'n'));
---
>               NVL(MINIMIZE_COST,'n'),'n');
SYS.DBMS_ASH_INTERNAL - PACKAGE BODY (RU):
363c363
<               '      (SELECT dbid, con_dbid, ' || 
---
>               '      (SELECT /*+ NO_MERGE */ dbid, con_dbid, ' || 
373,379c373,374
<                                'pdb_instance i, ' || 
<                                SYS.DBMS_UMF_PROTECTED.KEUQQPAT_AWR_VN_DFLT_PAT ||
<                                'snapshot s ' ||
<               '              WHERE  s.dbid = i.dbid ' ||
<               '                AND  s.instance_number = i.instance_number ' ||
<               '                AND  i.startup_time >= s.startup_time ' ||
<               '                AND  i.con_dbid <> 0 ' ||
---
>                                'pdb_instance i ' || 
>               '              WHERE i.con_dbid <> 0 ' ||
SYS.DBMS_AUTO_INDEX_INTERNAL - PACKAGE BODY (RU):
421a422,425
>   
>   AI_MAX_STMTS_FOR_COMPILE      CONSTANT NUMBER     := 10000;
> 
>   
1032,1033c1036,1037
<     CAN_CANCEL             IN     INTEGER,
<     CAN_INTERRUPT          IN     INTEGER
---
>     CAN_CANCEL             IN     PLS_INTEGER,
>     CAN_INTERRUPT          IN     PLS_INTEGER
1038,1039c1042,1043
<     CAN_CANCEL             OCINUMBER,  CAN_CANCEL    INDICATOR  SB4,
<     CAN_INTERRUPT          OCINUMBER,  CAN_INTERRUPT INDICATOR  SB4
---
>     CAN_CANCEL             SB4,        CAN_CANCEL    INDICATOR  SB4,
>     CAN_INTERRUPT          SB4,        CAN_INTERRUPT INDICATOR  SB4
1042a1047
> 
3365,3367c3370,3374
<         WHEN HT.OBJ# IS NULL AND             
<              (BITAND(T.FLAGS, 16) = 0 OR     
<               DBMS_STATS_INTERNAL.IS_STALE(  
---
>         WHEN HT.OBJ# IS NULL AND              
>              
>              BITAND(T.TRIGFLAG, 67108864) = 0 AND
>              (BITAND(T.FLAGS, 16) = 0 OR      
>               DBMS_STATS_INTERNAL.IS_STALE(   
3616,3617c3623,3624
<                                 'dbms_stats_internal.aggregate_index_stats(' ||
<                                 FIXQ(DQ(OWN)) || ',' || FIXQ(DQ(IND)) || ')');
---
>                       'begin dbms_stats_internal.aggregate_index_stats(' ||
>                       FIXQ(DQ(OWN)) || ',' || FIXQ(DQ(IND)) || '); end;');
3620c3627
<                                 'dbms_stats.gather_index_stats(' ||
---
>                                 'begin dbms_stats.gather_index_stats(' ||
3622c3629
<                                 ', no_invalidate => true)');
---
>                                 ', no_invalidate => true); end;');
5531c5538
<          (SELECT PO.SQL_ID_VC, PO.ATTR5, 
---
>          (SELECT /*+ no_merge(po) no_merge(i) */ PO.SQL_ID_VC, PO.ATTR5, 
5535c5542
<           (SELECT/*+ no_merge no_push_pred */ OST.SQL_ID_VC, OST.ATTR5,
---
>           (SELECT/*+ no_push_pred */ OST.SQL_ID_VC, OST.ATTR5,
5568c5575
<          (SELECT PO.SQL_ID_VC, PO.ATTR5
---
>          (SELECT /*+ no_merge(po) no_merge(i) */ PO.SQL_ID_VC, PO.ATTR5
5570c5577
<           (SELECT/*+ no_merge no_push_pred */ OST.SQL_ID_VC, OST.ATTR5,
---
>           (SELECT/*+ no_push_pred */ OST.SQL_ID_VC, OST.ATTR5,
5858,5863c5865,5870
<            (SELECT F.NAME AS SQLSET_NAME, F.OWNER AS SQLSET_OWNER, 
<             S.SQL_ID, 
<             P.PLAN_HASH_VALUE,
<             C.ELAPSED_TIME, C.BUFFER_GETS, 
<             C.EXECUTIONS, 
<             EXTRACTVALUE(XMLTYPE(L.OTHER_XML),
---
>            (SELECT SSF.NAME AS SQLSET_NAME, SSF.OWNER AS SQLSET_OWNER, 
>             SSS.SQL_ID, 
>             SSP.PLAN_HASH_VALUE,
>             SSC.ELAPSED_TIME, SSC.BUFFER_GETS, 
>             SSC.EXECUTIONS, 
>             EXTRACTVALUE(XMLTYPE(SSPL.OTHER_XML),
5865,5882c5872,5889
<             FROM WRI$_SQLSET_DEFINITIONS F, WRI$_SQLSET_STATEMENTS S, 
<                  WRI$_SQLSET_PLANS P,WRI$_SQLSET_MASK M, WRH$_SQLTEXT T, 
<                  WRI$_SQLSET_STATISTICS C, WRI$_SQLSET_PLAN_LINES L
<             WHERE  F.ID = S.SQLSET_ID AND S.ID = P.STMT_ID 
<               AND S.CON_DBID = P.CON_DBID
<               AND P.STMT_ID = C.STMT_ID 
<               AND P.PLAN_HASH_VALUE = C.PLAN_HASH_VALUE
<               AND P.CON_DBID = C.CON_DBID
<               AND P.STMT_ID = M.STMT_ID 
<               AND P.PLAN_HASH_VALUE = M.PLAN_HASH_VALUE
<               AND P.CON_DBID = M.CON_DBID
<               AND S.SQL_ID = T.SQL_ID
<               AND S.CON_DBID = T.CON_DBID
<               AND T.DBID = F.CON_DBID 
<               AND P.STMT_ID=L.STMT_ID 
<               AND P.PLAN_HASH_VALUE = L.PLAN_HASH_VALUE 
<               AND P.CON_DBID = L.CON_DBID
<               AND L.OTHER_XML IS NOT NULL) S
---
>             FROM WRI$_SQLSET_DEFINITIONS SSF, WRI$_SQLSET_STATEMENTS SSS, 
>                  WRI$_SQLSET_PLANS SSP,WRI$_SQLSET_MASK SSM, WRH$_SQLTEXT ST, 
>                  WRI$_SQLSET_STATISTICS SSC, WRI$_SQLSET_PLAN_LINES SSPL
>             WHERE SSF.ID = SSS.SQLSET_ID AND SSS.ID = SSP.STMT_ID 
>               AND SSS.CON_DBID = SSP.CON_DBID
>               AND SSP.STMT_ID = SSC.STMT_ID 
>               AND SSP.PLAN_HASH_VALUE = SSC.PLAN_HASH_VALUE
>               AND SSP.CON_DBID = SSC.CON_DBID
>               AND SSP.STMT_ID = SSM.STMT_ID 
>               AND SSP.PLAN_HASH_VALUE = SSM.PLAN_HASH_VALUE
>               AND SSP.CON_DBID = SSM.CON_DBID
>               AND SSS.SQL_ID = ST.SQL_ID
>               AND SSS.CON_DBID = ST.CON_DBID
>               AND ST.DBID = SSF.CON_DBID 
>               AND SSP.STMT_ID=SSPL.STMT_ID 
>               AND SSP.PLAN_HASH_VALUE = SSPL.PLAN_HASH_VALUE 
>               AND SSP.CON_DBID = SSPL.CON_DBID
>               AND SSPL.OTHER_XML IS NOT NULL) S
6501c6508
<     FROM DBA_INDEXES I, DBA_INDEX_USAGE U, DBA_OBJECTS DO
---
>     FROM DBA_INDEXES I, DBA_INDEX_USAGE U, DBA_OBJECTS DO, IND$ IB
6513a6521
>       AND DO.OBJECT_ID = IB.OBJ#
6519a6528,6530
>            
>            BITAND(IB.FLAGS, 536870912) > 0
>            OR
7184c7195,7198
<         IF (ELAPSED_SO_FAR >= AI_JOB_INTERVAL * 1000 * 1000) THEN
---
>         
>         
>         IF (ELAPSED_SO_FAR >= AI_JOB_INTERVAL * 1000 * 1000 OR
>             SQLCNT_COMPILE >= AI_MAX_STMTS_FOR_COMPILE) THEN
7187c7201
< 
---
>   
SYS.DBMS_DBFS_SFS - PACKAGE BODY (19.3RUR):
11493a11494
>         GOODLINK        BOOLEAN;
11511a11513,11520
> 
>         IF DBMS_DBFS_SFS_ADMIN.GET_PARAM('_dbfs_symlink_path_prefix') THEN
>           GOODLINK := DBMS_PDB_IS_VALID_PATH(LINK);
>           IF NOT GOODLINK THEN
>             LINK := '';  
>             RAISE DBMS_DBFS_CONTENT.UNSUPPORTED_OPERATION;
>           END IF;
>         END IF;  
SYS.DBMS_HEAT_MAP_INTERNAL - PACKAGE BODY (RU):
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_RCVMAN - PACKAGE BODY (RU):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.04.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.05.00.00'; 
692c692
<            NULL                    COMPLETION_TIME,
---
>            BDF.COMPLETION_TIME     COMPLETION_TIME,
SYS.DBMS_RCVMAN - PACKAGE BODY (19.4RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.04.00.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.04.01.00'; 
SYS.DBMS_RCVMAN - PACKAGE BODY (19.3RUR):
122c122
< CATALOGVERSION CONSTANT VARCHAR2(11) := '19.03.01.00'; 
---
> CATALOGVERSION CONSTANT VARCHAR2(11) := '19.03.02.00'; 
SYS.DBMS_SCHEDULER - PACKAGE BODY (RU):
3618c3618,3621
<   IF LENGTH(PREFIX) > 18 THEN
---
>   
>   
>   
>   IF LENGTH(PREFIX) > 20 THEN
3629c3632,3634
<   IF LENGTH(RTRIM(CANON_PREFIX, '0123456789')) < LENGTH(CANON_PREFIX) THEN
---
>   
>   IF    LENGTH(RTRIM(CANON_PREFIX, '0123456789')) < LENGTH(CANON_PREFIX)
>      OR LENGTH(CANON_PREFIX) > 18 THEN
SYS.PRVT_ASH_OMX - PACKAGE BODY (RU):
43a44
>   
56a58
>     AWR_INFO        IN VARCHAR2 := NULL,
109c111,112
<                           INSTANCE_NUMBER => INST_ID);
---
>                           INSTANCE_NUMBER => INST_ID,
>                           AWR_INFO        => AWR_INFO);
118c121,122
<                           INSTANCE_NUMBER => INST_ID);
---
>                           INSTANCE_NUMBER => INST_ID,
>                           AWR_INFO        => AWR_INFO);
129c133,134
<                           INSTANCE_NUMBER => INST_ID);        
---
>                           INSTANCE_NUMBER => INST_ID,
>                           AWR_INFO        => AWR_INFO);        
SYS.PRVT_ILM - PACKAGE BODY (RU):
8373a8374,8386
>     
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
8375,8398c8388,8403
<       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.WRI$_REPT_ASH_OMX - TYPE BODY (RU):
10a11
>     L_COMPRESS_XML      VARCHAR2(2000)  := 'n';
23a25
>     L_AWR_INFO          VARCHAR2(2000)  := 'n';
39c41,42
<       L_DBID := TO_NUMBER(DBMS_REPORT.GET_PARAM(L_PARAMS,'dbid',NULLABLE=>TRUE));
---
>       L_DBID := TO_NUMBER(DBMS_REPORT.GET_PARAM(L_PARAMS,'dbid',
>                           NULLABLE=>TRUE));
73,74c76,81
<       L_SHOW_SQL := NVL(DBMS_REPORT.GET_PARAM(L_PARAMS,'show_sql', NULLABLE=>TRUE), 
<                         'n');
---
>       L_SHOW_SQL := NVL(DBMS_REPORT.GET_PARAM(L_PARAMS,'show_sql', 
>                         NULLABLE=>TRUE), 'n');
> 
>       
>       L_AWR_INFO := NVL(DBMS_REPORT.GET_PARAM(L_PARAMS,'awr_info', 
>                         NULLABLE=>TRUE), 'n');
96a104
>                         AWR_INFO        => L_AWR_INFO,
172a181,188
>     END IF;
> 
>     
>     L_COMPRESS_XML := NVL(SYS.DBMS_REPORT.GET_PARAM(L_PARAMS, 'compress_xml',
>                                                     NULLABLE=>TRUE),
>                          'n');
>     IF LOWER(L_COMPRESS_XML) = 'y' THEN 
>       L_REPORT_XML := DBMS_REPORT.TRANSFORM_REPORT_XML(L_REPORT_XML, 1);
SYS.DBA_AUTO_INDEX_EXECUTIONS - VIEW (RU):
5,6c5,11
<        error_message,
<        status
---
>        case when e.error_message is null and e.status = 'FATAL ERROR'
>             then (select max(message) from dba_advisor_findings f
>                   where f.task_id = e.task_id
>                     and f.execution_name=f.execution_name
>                     and f.type = 'ERROR')
>             else e.error_message end error_message,
>        decode(e.status, 'FATAL ERROR', 'STOPPED', e.status) status
XDB.DBMS_SODA_ADMIN - PACKAGE (RU):
21a22
>   type INTNTAB is table of PLS_INTEGER;
XDB.DBMS_SODA_ADMIN - PACKAGE BODY (RU):
2474c2474
<                              P_MAX_LENGTHS         OUT  NUMNTAB,
---
>                              P_MAX_LENGTHS         OUT  INTNTAB,
2606c2606
<         P_MAX_LENGTHS := NUMNTAB();
---
>         P_MAX_LENGTHS := INTNTAB();
2832c2832
<     V_MAX_LENGTHS               NUMNTAB;
---
>     V_MAX_LENGTHS               INTNTAB;
2836,2838c2836,2838
<     V_NUM_CHAR_COLS             NUMBER := 0;
<     V_NUM_CHAR_COLS_LEN         NUMBER := 0;
<     V_DEFAULT_SIZE              NUMBER := 0;
---
>     V_NUM_CHAR_COLS             PLS_INTEGER := 0;
>     V_NUM_CHAR_COLS_LEN         PLS_INTEGER := 0;
>     V_DEFAULT_SIZE              PLS_INTEGER := 0;

Useful Links:

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

Deixe um comentário

Seu e-mail não será publicado.