/*ABS-10959 Reducing the table size*/

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'IssueHistory', 'Issue History', null, null, 'ASSIGNDATE', null, null,
         'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'DeliveryHistory', 'Delivery History', null, null, 'DELIVERYDATE',
         null, null, 'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'DeliveryVariations', 'Delivery Variations',
         'Warning: cleaned up for all plants!', 'PROCESSED=''Y''', 'DELIVERYDATE', null, null,
         null, 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'PackingNote', 'Packing Notes',
         'Only processed or cancelled packingnotes',
         'status_id in ( select st.status_id from status st where st.code in (''30'',''40''))',
         'DELIVERYDATE', null, null, 'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'WebServiceTransaction', 'Web Service Transaction',
         'Warning: cleaned up for all plants!', 'TIMESTAMP < TRUNC(SYSDATE-14)', 'TIMESTAMP',
         null, null, null, 9000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'OutOfStockHistory', 'Out Of Stock History', null, null,
         'OUTOFSTOCKDATE', null, null, 'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'WeighingHistory', 'Weighing History', null, null, 'WEIGHINGDATE',
         null, null, 'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'OutOfCirculationHistory', 'Out Of Circulation History', null,
         null, 'OUTOFCIRCDATE', null, null, 'PROCESSBUSINESSUNIT_ID', 5000, getminsystemuser(), sysdate from dual;
      commit;

      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'WeighingTicket', 'Weighing Ticket', 'Cleanup processed weighing tickets',
         'status_id in ( select st.status_id from status st where st.code in (''30'',''40''))',
         'WEIGHINGDATE', null, null, 'PROCESSBUSINESSUNIT_ID', 5000,
         getminsystemuser(), sysdate from dual;
      commit;
         
      insert into purgetable
        (purgetable_id, tablename, description, remark, whereclause, datefieldname, hint,
         plantfieldname, businessunitfieldname, commitsize, systemuser_id, timestamp)
      select seq_purgetable.nextval, 'PrintQueue', 'Printqueue',
         'Cleanup processed Print Queue records',
         '(PROCESSED = ''Y'' AND ((STATUS=0 AND INVOICEHEADER_ID IS NOT NULL) OR STATUS<>0))',
         'CREATIONDATE', null, null, 'BUSINESSUNIT_ID', 9000, getminsystemuser(), sysdate from dual;
      commit;