DBA Data[Home] [Help]

APPS.INV_HV_TXN_PURGE SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 10

   3. Inserting back the rows from the temporarary table to
      the original table.
   4. Commiting the transactions
   5. Dropping the temporary tables

   By this way, if the data to be deleted is very high, the program's performance
   will be better when compared with actually deleting the rows.
   If rows to be deleted are very less then script invtxnpg.sql will be better
   in terms of performance where we wmploy direct deltion from the tables.
*/

/*
   The parameters are
   1. x_errbuf          -- Error buffer to concurrent program
   2. x_retcode         -- Indicates the return status of the concurrent program
   3. p_organization_id -- Organization for which the purge has to be carried out,
                           If this is null then the records for all the organizations
                           will be purged.
   4. p_cut_off_date    -- The records whose transaction_date below this date
                           will be deleted. This is mandatory parameter.
                           This will be also used to check for accounting period.
                           If the period is open then purge won't be carried out.
*/

/* Configurable Variables are

   1. max_rows_to_del - This variable determines which approach has to be selected
                        for deleting the rows, either the direct approach or the
                        temp table approach. If the rows to be deleted are less than
                        this value then the records will be deleted directly else
                        it will be deleted via temp table approach.
                        Currently this is set to 100000. But it can be changed
                        based on the requirements
   2. l_bulk_limit    - This is the bulk collect limit for deletion.
                        This can be configured based on the database stats.
                        This is currently set to 5000.

*/

  PROCEDURE Txn_Purge( x_errbuf	         OUT NOCOPY VARCHAR2
                       ,x_retcode	      OUT NOCOPY NUMBER
                       ,p_organization_id	IN  NUMBER   := NULL
                       ,p_cut_off_date		IN  VARCHAR2
                      )
     IS

    l_debug          NUMBER := NVL(fnd_profile.VALUE('INV_DEBUG_TRACE'), 0);
Line: 79

      IS  SELECT 'OPEN' sdate
          FROM   org_acct_periods
          WHERE  INV_LE_TIMEZONE_PUB.get_le_day_for_inv_org(x_period_start_date,x_organization_id)
                   >= ( SELECT  MIN(period_start_date)
                        FROM    org_acct_periods
                        WHERE   organization_id = x_organization_id
                                AND  open_flag = 'Y'
                                        )
                 AND open_flag = 'Y';
Line: 90

       SELECT ROWID
       FROM     MTL_MATERIAL_TXN_ALLOCATIONS
       WHERE    transaction_date < l_cut_off_date
                AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 96

       SELECT ROWID
       FROM     MTL_MATERIAL_TRANSACTIONS
       WHERE    transaction_date < l_cut_off_date
                AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 103

       SELECT ROWID
       FROM     MTL_TRANSACTION_LOT_NUMBERS
       WHERE    transaction_date < l_cut_off_date
                AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 110

       SELECT ROWID
       FROM     MTL_UNIT_TRANSACTIONS
       WHERE    transaction_date < l_cut_off_date
                AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 117

       SELECT ROWID
       FROM     MTL_TRANSACTION_ACCOUNTS
       WHERE    transaction_date < l_cut_off_date
                AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 162

             FOR i in (SELECT ood.organization_id FROM org_organization_definitions ood )
         	 LOOP -- Organization loop

               OPEN  get_open_period (l_cut_off_date, i.organization_id);
Line: 215

            SELECT   count(transaction_id)
            INTO     rows_to_del
            FROM     mtl_material_txn_allocations
            WHERE    transaction_date < l_cut_off_date
                     AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 251

                  inv_trx_util_pub.TRACE(' exiting out of the loop since there are no more records to delete ' );
Line: 256

                  DELETE FROM mtl_material_txn_allocations
                  WHERE ROWID = rowid_list(i);
Line: 264

                inv_trx_util_pub.TRACE(' Deleted ' || rows_to_del || ' row(s) from MTL_MATERIAL_TXN_ALLOCATIONS ' );
Line: 278

                              || ' SELECT  * FROM  MTL_MATERIAL_TXN_ALLOCATIONS '
                              || ' WHERE 1 = 1 ' ;
Line: 310

                s_sql_stmt := 'INSERT INTO MTL_MATERIAL_TXN_ALLOCATIONS SELECT * FROM mtl_material_txn_alloc_bu';
Line: 317

                   inv_trx_util_pub.TRACE(' Inserted ' || rows_processed || ' row(s) into the table MTL_MATERIAL_TXN_ALLOCATIONS');
Line: 363

            SELECT   count(transaction_id)
            INTO     rows_to_del
            FROM     mtl_material_transactions
            WHERE    transaction_date < l_cut_off_date
                     AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 398

                  inv_trx_util_pub.TRACE(' exiting out of the loop since there are no more records to delete ' );
Line: 403

                  DELETE FROM mtl_material_transactions
                  WHERE ROWID = rowid_list(i);
Line: 410

                inv_trx_util_pub.TRACE(' Deleted ' || rows_to_del || ' row(s) from MTL_MATERIAL_TRANSACTIONS ' );
Line: 425

                              || ' SELECT  * FROM  MTL_MATERIAL_TRANSACTIONS '
                              || ' WHERE 1 = 1 ' ;
Line: 457

                s_sql_stmt := 'INSERT INTO MTL_MATERIAL_TRANSACTIONS SELECT * FROM mtl_material_transactions_bu';
Line: 464

                   inv_trx_util_pub.TRACE(' Inserted ' || rows_processed || ' row(s) into the table MTL_MATERIAL_TRANSACTIONS');
Line: 510

            SELECT   count(transaction_id)
            INTO     rows_to_del
            FROM     mtl_transaction_lot_numbers
            WHERE    transaction_date < l_cut_off_date
                     AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 545

                  inv_trx_util_pub.TRACE(' exiting out of the loop since there are no more records to delete ' );
Line: 550

                  DELETE FROM mtl_transaction_lot_numbers
                  WHERE ROWID = rowid_list(i);
Line: 557

                inv_trx_util_pub.TRACE(' Deleted ' || rows_to_del || ' row(s) from MTL_TRANSACTION_LOT_NUMBERS ' );
Line: 572

                              || ' SELECT  * FROM MTL_TRANSACTION_LOT_NUMBERS '
                              || ' WHERE 1 = 1 ' ;
Line: 604

                s_sql_stmt := 'INSERT INTO MTL_TRANSACTION_LOT_NUMBERS SELECT * FROM mtl_transaction_lot_numbers_bu';
Line: 611

                   inv_trx_util_pub.TRACE(' Inserted ' || rows_processed || ' row(s) into the table MTL_TRANSACTION_LOT_NUMBERS');
Line: 657

            SELECT   count(transaction_id)
            INTO     rows_to_del
            FROM     mtl_unit_transactions
            WHERE    transaction_date < l_cut_off_date
                     AND (p_organization_id IS NULL OR organization_id = p_organization_id);
Line: 692

                  inv_trx_util_pub.TRACE(' exiting out of the loop since there are no more records to delete ' );
Line: 697

                  DELETE FROM mtl_unit_transactions
                  WHERE ROWID = rowid_list(i);
Line: 704

                inv_trx_util_pub.TRACE(' Deleted ' || rows_to_del || ' row(s) from MTL_UNIT_TRANSACTIONS ' );
Line: 719

                              || ' SELECT  * FROM  MTL_UNIT_TRANSACTIONS '
                              || ' WHERE 1 = 1 ' ;
Line: 751

                s_sql_stmt := 'INSERT INTO MTL_UNIT_TRANSACTIONS SELECT * FROM mtl_unit_transactions_bu';
Line: 758

                   inv_trx_util_pub.TRACE(' Inserted ' || rows_processed || ' row(s) into the table MTL_UNIT_TRANSACTIONS');
Line: 805

            /*SELECT   count(transaction_id)
                                    INTO     rows_to_del
                                    FROM     mtl_transaction_accounts
                                    WHERE    transaction_date < l_cut_off_date
                                    AND (p_organization_id IS NULL OR organization_id = p_organization_id);*/
Line: 813

                 SELECT   COUNT(transaction_id)
                 INTO     rows_to_del
                 FROM     mtl_transaction_accounts
                 WHERE    transaction_date < l_cut_off_date ;
Line: 820

                 SELECT   COUNT(transaction_id)
                 INTO     rows_to_del
                 FROM     mtl_transaction_accounts
                 WHERE    transaction_date < l_cut_off_date
                 AND      organization_id = p_organization_id ;
Line: 857

                  inv_trx_util_pub.TRACE(' exiting out of the loop since there are no more records to delete ' );
Line: 862

                  DELETE FROM mtl_transaction_accounts
                  WHERE ROWID = rowid_list(i);
Line: 869

                inv_trx_util_pub.TRACE(' Deleted ' || rows_to_del || ' row(s) from MTL_TRANSACTION_ACCOUNTS ' );
Line: 884

                              || ' SELECT  * FROM  MTL_TRANSACTION_ACCOUNTS '
                              || ' WHERE 1 = 1 ' ;
Line: 916

                s_sql_stmt := 'INSERT INTO MTL_TRANSACTION_ACCOUNTS SELECT * FROM mtl_transaction_accounts_bu';
Line: 923

                   inv_trx_util_pub.TRACE(' Inserted ' || rows_processed || ' row(s) into the table MTL_TRANSACTION_ACCOUNTS');