Custom index for Oracle
Use this index for an Oracle database.
DECLARE
iCount INTEGER;
BEGIN
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTACT_ACCTSRVKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTACTIVITY';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTACT_ACCTSRVKEY
ON BILLING.ACCOUNTACTIVITY(ACCOUNTSERVICEKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTACT_PENALTY'
AND UPPER(TABLE_NAME) = 'ACCOUNTACTIVITY';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTACT_PENALTY
ON BILLING.ACCOUNTACTIVITY(PENALTYKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTTW_ACCTKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTTRADEWASTE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTTW_ACCTKEY
ON BILLING.ACCOUNTTRADEWASTE(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTTW_ACCTSRVKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTTRADEWASTE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTTW_ACCTSRVKEY
ON BILLING.ACCOUNTTRADEWASTE(ACCOUNTSERVICEKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTWST_ACCTTW '
AND UPPER(TABLE_NAME) = 'ACCOUNTWASTE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTWST_ACCTTW
ON BILLING.ACCOUNTWASTE(ACCOUNTTRADEWASTEKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTWSTRES_ACCTTW'
AND UPPER(TABLE_NAME) = 'ACCOUNTWASTERESULT';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTWSTRES_ACCTTW
ON BILLING.ACCOUNTWASTERESULT(ACCOUNTTRADEWASTEKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BBPAYEX_ACCTKEY'
AND UPPER(TABLE_NAME) = 'BBPAYMENTEXCEPTION';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BBPAYEX_ACCTKEY
ON BILLING.BBPAYMENTEXCEPTION(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BBSETSCH'
AND UPPER(TABLE_NAME) = 'SETTLEMENTSCHEDULE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BBSETSCH
ON BILLING.SETTLEMENTSCHEDULE(SETTLEMENTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BILLMESSAGE_BILLKEY'
AND UPPER(TABLE_NAME) = 'BILLMESSAGES';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BILLMESSAGE_BILLKEY
ON BILLING.BILLMESSAGES(BILLKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BILLRUN_ACCTKEY'
AND UPPER(TABLE_NAME) = 'BILLRUN';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BILLRUN_ACCTKEY
ON BILLING.BILLRUN(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BPAYALERTEX_ACALKEY'
AND UPPER(TABLE_NAME) = 'BATCHPAYMENTALERTEXCEPTION';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BPAYALERTEX_ACALKEY
ON BILLING.BATCHPAYMENTALERTEXCEPTION(ACALRTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BTYPEMSGSET_ACCTKEY'
AND UPPER(TABLE_NAME) = 'BILLTYPEMESSAGESSETUP';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BTYPEMSGSET_ACCTKEY
ON BILLING.BILLTYPEMESSAGESSETUP(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DDSCH_LATBILL'
AND UPPER(TABLE_NAME) = 'DEBITSCHEDULE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DDSCH_LATBILL
ON BILLING.DEBITSCHEDULE(LATESTELIGIBLEBILL)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DELINQHIST_BILLKEY'
AND UPPER(TABLE_NAME) = 'DELINQUENCYHISTORY';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DELINQHIST_BILLKEY
ON BILLING.DELINQUENCYHISTORY(BILLKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPADJ_ACCTKEY'
AND UPPER(TABLE_NAME) = 'DEPOSITADJUSTMENT';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPADJ_ACCTKEY
ON BILLING.DEPOSITADJUSTMENT(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_LIIMP_ACCTKEY'
AND UPPER(TABLE_NAME) = 'LINEITEMIMPERVIOUSAREA';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_LIIMP_ACCTKEY
ON BILLING.LINEITEMIMPERVIOUSAREA(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_LIP_ACCTKEY'
AND UPPER(TABLE_NAME) = 'LINEITEMPENALTY';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_LIP_ACCTKEY
ON BILLING.LINEITEMPENALTY(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_LITRREADING_LI'
AND UPPER(TABLE_NAME) = 'LINEITEMTRACKEDREAD';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_LITRREADING_LI
ON BILLING.LINEITEMTRACKEDREAD(LINEITEMKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_NSFIMPDET_PAYBATCH'
AND UPPER(TABLE_NAME) = 'NSFIMPORTACTIVITYDETAILS';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_NSFIMPDET_PAYBATCH
ON BILLING.NSFIMPORTACTIVITYDETAILS(PAYMENTBATCHKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_OOCSETUP_OOC'
AND UPPER(TABLE_NAME) = 'AUTOMATEDONEOFFCHARGESETUP';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_OOCSETUP_OOC
ON BILLING.AUTOMATEDONEOFFCHARGESETUP(ONEOFFCHARGEKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_RITEM_REFUND'
AND UPPER(TABLE_NAME) = 'REFUNDITEM';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_RITEM_REFUND
ON BILLING.REFUNDITEM(REFUNDKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_SEWTR_ACCTPOSKEY'
AND UPPER(TABLE_NAME) = 'SEWERTRACKEDREADING';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_SEWTR_ACCTPOSKEY
ON BILLING.SEWERTRACKEDREADING(ACCTSERVICEPOSITIONKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_STTRREAD_ACCTSRVPOS'
AND UPPER(TABLE_NAME) = 'STORMTRACKREADING';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_STTRREAD_ACCTSRVPOS
ON BILLING.STORMTRACKREADING(ACCTSERVICEPOSITIONKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CASHIERING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_IC_ACCCTKEY'
AND UPPER(TABLE_NAME) = 'INTERNALCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CASHIERING.IDX_ARC_IC_ACCCTKEY
ON CASHIERING.INTERNALCHARGE(ACCTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CASHIERING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_IC_ADJ'
AND UPPER(TABLE_NAME) = 'INTERNALCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CASHIERING.IDX_ARC_IC_ADJ
ON CASHIERING.INTERNALCHARGE(ADJUSTMENTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CASHIERING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_IC_DEPKEY'
AND UPPER(TABLE_NAME) = 'INTERNALCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CASHIERING.IDX_ARC_IC_DEPKEY
ON CASHIERING.INTERNALCHARGE(DEPOSITKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CASHIERING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_IC_OOC'
AND UPPER(TABLE_NAME) = 'INTERNALCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CASHIERING.IDX_ARC_IC_OOC
ON CASHIERING.INTERNALCHARGE(ONEOFFKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CORE_BATCHPROCESSING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_USREX_ACCT'
AND UPPER(TABLE_NAME) = 'USEREXCEPTION';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CORE_BATCHPROCESSING.IDX_ARC_USREX_ACCT
ON CORE_BATCHPROCESSING.USEREXCEPTION(ACCOUNTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'CORE_CORRESPONDENCE'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BOPMETER_BILL'
AND UPPER(TABLE_NAME) = 'BILLOUTPUTMETER';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX CORE_CORRESPONDENCE.IDX_ARC_BOPMETER_BILL
ON CORE_CORRESPONDENCE.BILLOUTPUTMETER(BILLKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCT_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNT';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCT_COMMENTSKEY
ON BILLING.ACCOUNT(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTDD_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTDIRECTDEBIT';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTDD_COMMENTSKEY
ON BILLING.ACCOUNTDIRECTDEBIT(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTSVC_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTSERVICE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTSVC_COMMENTSKEY
ON BILLING.ACCOUNTSERVICE(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTTRAN_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ACCTTRAN';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTTRAN_COMMENTSKEY
ON BILLING.ACCTTRAN(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ACCTTW_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ACCOUNTTRADEWASTE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ACCTTW_COMMENTSKEY
ON BILLING.ACCOUNTTRADEWASTE(COMMENTKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ADJ_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'ADJUSTMENT';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ADJ_COMMENTSKEY
ON BILLING.ADJUSTMENT(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ADJAPP_COMMENTSKEYA'
AND UPPER(TABLE_NAME) = 'ADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ADJAPP_COMMENTSKEYA
ON BILLING.ADJUSTMENTAPPROVAL(APPROVALCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ADJAPP_COMMENTSKEYR'
AND UPPER(TABLE_NAME) = 'ADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ADJAPP_COMMENTSKEYR
ON BILLING.ADJUSTMENTAPPROVAL(REJECTIONCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_ADJAPP_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'ADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_ADJAPP_COMMENTSKEYS
ON BILLING.ADJUSTMENTAPPROVAL(SUBMISSIONCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BBPLAN_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'BUDGETBILLINGPLAN';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BBPLAN_COMMENTSKEY
ON BILLING.BUDGETBILLINGPLAN(COMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BTIS_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'BILLTYPEINSERTSETUP';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BTIS_COMMENTSKEY
ON BILLING.BILLTYPEINSERTSETUP(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_BTYPE_COMMENTSKEY'
AND UPPER(TABLE_NAME) = 'BILLTYPE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_BTYPE_COMMENTSKEY
ON BILLING.BILLTYPE(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DDRUN_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'DIRECTDEBITRUN';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DDRUN_COMMENTSKEYS
ON BILLING.DIRECTDEBITRUN(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPADJAPP_COMMENTSKEYA'
AND UPPER(TABLE_NAME) = 'DEPOSITADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPADJAPP_COMMENTSKEYA
ON BILLING.DEPOSITADJUSTMENTAPPROVAL(APPROVALCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPADJAPP_COMMENTSKEYR'
AND UPPER(TABLE_NAME) = 'DEPOSITADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPADJAPP_COMMENTSKEYR
ON BILLING.DEPOSITADJUSTMENTAPPROVAL(REJECTIONCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPADJAPP_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'DEPOSITADJUSTMENTAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPADJAPP_COMMENTSKEYS
ON BILLING.DEPOSITADJUSTMENTAPPROVAL(SUBMISSIONCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPCHG_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'DEPOSITCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPCHG_COMMENTSKEYS
ON BILLING.DEPOSITCHARGE(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_DEPTRAN_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'DEPTRAN';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_DEPTRAN_COMMENTSKEYS
ON BILLING.DEPTRAN(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_LI_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'LINEITEM';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_LI_COMMENTSKEYS
ON BILLING.LINEITEM(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_LISP_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'LINEITEMSETUP';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_LISP_COMMENTSKEYS
ON BILLING.LINEITEMSETUP(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_OOC_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'ONEOFFCHARGE';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_OOC_COMMENTSKEYS
ON BILLING.ONEOFFCHARGE(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_PAYBATCH_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'PAYBATCH';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_PAYBATCH_COMMENTSKEYS
ON BILLING.PAYBATCH(COMMENTSKEY)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
SELECT COUNT(*) INTO iCount FROM ALL_INDEXES
WHERE UPPER(TABLE_OWNER) = 'BILLING'
AND UPPER(INDEX_NAME) = 'IDX_ARC_REFUNDSUB_COMMENTSKEYS'
AND UPPER(TABLE_NAME) = 'REFUNDAPPROVAL';
IF iCount = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'CREATE INDEX BILLING.IDX_ARC_REFUNDSUB_COMMENTSKEYS
ON BILLING.REFUNDAPPROVAL(SUBMISSIONCOMMENTS)';
EXCEPTION
WHEN OTHERS THEN NULL;
END;
END IF;
END;