How to delete records from a table?

It comes to my table structure:
create table BILLS
(
  bill_id    VARCHAR2(20),
  trx_no     VARCHAR2(20),
  item_code  VARCHAR2(3),
  amount     NUMBER,
  item_id    NUMBER,
  invoice_dt DATE
)
Here are some insert statements to populate the table. *(About a 100 of them, please Bear with me) *.
insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104173960', '910873', '002', 432, 351, to_date('04-03-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104209800', '910873', '002', 432, 351, to_date('04-04-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104212747', '263156', '039', 230, 351, to_date('01-04-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104269414', '263156', '039', 230, 351, to_date('01-06-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104360446', '263156', '039', 230, 351, to_date('01-09-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104577673', '910873', '002', 432, 351, to_date('04-04-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104608668', '910873', '002', 432, 351, to_date('04-05-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104611586', '263156', '039', 230, 351, to_date('01-05-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104642560', '910873', '002', 432, 351, to_date('04-06-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104699154', '910873', '002', 432, 351, to_date('04-08-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104820820', '263156', '039', 230, 351, to_date('01-12-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104826028', '910873', '002', 432, 351, to_date('04-12-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104850631', '910873', '002', 432, 351, to_date('04-01-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104885554', '263156', '039', 230, 351, to_date('01-02-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104926901', '910873', '002', 432, 351, to_date('04-03-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104936656', '263156', '', 15, 247, null);

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104996320', '263156', '039', 230, 351, to_date('01-05-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105030104', '263156', '039', 230, 351, to_date('01-06-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105176803', '910873', '002', 432, 351, to_date('04-10-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105217998', '910873', '002', 432, 351, to_date('04-11-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105253306', '263156', '039', 230, 351, to_date('01-12-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105280152', '263156', '039', 230, 351, to_date('01-01-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105318072', '910873', '002', 432, 351, to_date('04-02-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105449712', '910873', '002', 432, 351, to_date('04-06-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105579048', '910873', '002', 432, 351, to_date('04-10-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105611201', '263156', '039', 230, 351, to_date('01-11-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105679991', '263156', '011', 196.56, 351, to_date('06-01-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105686749', '910873', '002', 432, 351, to_date('04-01-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105816473', '910873', '002', 432, 351, to_date('04-05-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105846525', '263156', '011', 230, 351, to_date('01-06-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105778111', '910873', '002', 432, 351, to_date('04-04-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104958496', '910873', '002', 432, 351, to_date('04-04-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105143695', '910873', '002', 432, 351, to_date('04-09-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104176755', '263156', '039', 230, 351, to_date('01-03-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104365552', '910873', '002', 432, 351, to_date('04-09-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104646837', '263156', '039', 230, 351, to_date('01-06-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104763596', '910873', '002', 432, 351, to_date('04-10-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104936656', '263156', '', 15, 247, null);

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105510930', '263156', '039', 230, 351, to_date('01-08-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104302780', '263156', '039', 230, 351, to_date('01-07-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104793590', '263156', '039', 230, 351, to_date('01-11-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104238583', '910873', '002', 432, 351, to_date('04-05-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105779115', '263156', '011', 230, 351, to_date('01-04-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104394481', '263156', '039', 230, 351, to_date('01-10-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105144934', '263156', '039', 230, 351, to_date('01-09-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105342823', '263156', '039', 230, 351, to_date('01-03-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105747780', '910873', '002', 432, 351, to_date('04-03-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105517258', '910873', '002', 432, 351, to_date('04-08-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105617909', '910873', '002', 432, 351, to_date('04-11-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104480711', '910873', '002', 432, 351, to_date('04-01-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105845480', '910873', '002', 432, 351, to_date('04-06-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105349031', '910873', '002', 432, 351, to_date('04-03-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105382599', '263156', '039', 230, 351, to_date('01-04-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104423263', '263156', '039', 230, 351, to_date('01-11-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104482370', '263156', '039', 230, 351, to_date('01-01-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104892872', '910873', '002', 432, 351, to_date('04-02-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105071771', '263156', '039', 230, 351, to_date('01-07-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105716829', '910873', '002', 432, 351, to_date('04-02-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105251149', '910873', '002', 432, 351, to_date('04-12-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105420465', '910873', '002', 432, 351, to_date('04-05-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105547036', '910873', '002', 432, 351, to_date('04-09-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105450806', '263156', '039', 230, 351, to_date('01-06-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105178143', '263156', '039', 230, 351, to_date('01-10-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105648407', '910873', '002', 432, 351, to_date('04-12-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105718070', '263156', '011', 230, 351, to_date('01-02-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104735083', '910873', '002', 432, 351, to_date('04-09-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105748707', '263156', '011', 230, 351, to_date('01-03-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104570555', '263156', '039', 230, 351, to_date('01-04-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105480249', '910873', '002', 432, 351, to_date('04-07-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104799512', '910873', '002', 432, 351, to_date('04-11-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105036878', '910873', '002', 432, 351, to_date('04-06-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105413781', '263156', '039', 230, 351, to_date('01-05-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105548204', '263156', '039', 230, 351, to_date('01-09-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104510445', '910873', '002', 432, 351, to_date('04-02-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104545120', '263156', '039', 230, 351, to_date('01-03-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104700608', '263156', '039', 230, 351, to_date('01-08-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104765006', '263156', '039', 230, 351, to_date('01-10-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105111984', '910873', '002', 432, 351, to_date('04-08-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105310993', '263156', '039', 230, 351, to_date('01-02-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105481415', '263156', '039', 230, 351, to_date('01-07-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105210719', '263156', '039', 230, 351, to_date('01-11-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105809981', '263156', '011', 230, 351, to_date('01-05-2011', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104328833', '910873', '002', 432, 351, to_date('04-08-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104511904', '263156', '039', 230, 351, to_date('01-02-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105278905', '910873', '002', 432, 351, to_date('04-01-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104421567', '910873', '002', 432, 351, to_date('04-11-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104851866', '263156', '039', 230, 351, to_date('01-01-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105649424', '263156', '039', 230, 351, to_date('01-12-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104729022', '263156', '039', 230, 351, to_date('01-09-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105070358', '910873', '002', 432, 351, to_date('04-07-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104299829', '910873', '002', 432, 351, to_date('04-07-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104920099', '263156', '039', 230, 351, to_date('01-03-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104266551', '910873', '002', 432, 351, to_date('04-06-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104994904', '910873', '002', 432, 351, to_date('04-05-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104910999', '263156', '', 15, 247, null);

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104241418', '263156', '039', 230, 351, to_date('01-05-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104960203', '263156', '039', 230, 351, to_date('01-04-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105381371', '910873', '002', 432, 351, to_date('04-04-2010', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104542458', '910873', '002', 432, 351, to_date('04-03-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104670160', '910873', '002', 432, 351, to_date('04-07-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105105026', '263156', '039', 230, 351, to_date('01-08-2009', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104392347', '910873', '002', 432, 351, to_date('04-10-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104451005', '910873', '002', 432, 351, to_date('04-12-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104453960', '263156', '039', 230, 351, to_date('01-12-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104671563', '263156', '039', 230, 351, to_date('01-07-2008', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('104331181', '263156', '039', 230, 351, to_date('01-08-2007', 'dd-mm-yyyy'));

insert into BILLS (BILL_ID, TRX_NO, ITEM_CODE, AMOUNT, ITEM_ID, INVOICE_DT)
values ('105580192', '263156', '039', 230, 351, to_date('01-10-2010', 'dd-mm-yyyy'));
It comes to my select statement.
SELECT 
       Trx_No,
       Item_Code,
       Amount,
       Item_Id,
       MAX(Invoice_Dt)
  FROM Bills
 GROUP BY 
          Trx_No,
          Item_Code,
          Amount,
          Item_Id
I want to remove the lines that are extracted from my select statement. What is the best way to achieve this?

SELECT query sets.

She literally takes

delete from bills
 where (Trx_No,Item_Code,Amount,Item_Id,Invoice_Dt) in (select Trx_No,Item_Code,Amount,Item_Id,MAX(Invoice_Dt)
                                                          FROM Bills
                                                         GROUP BY Trx_No,Item_Code,Amount,Item_Id
                                                       )

Concerning

Etbin

Tags: Database

Similar Questions

  • How to delete records from a table that has a composite unique key duplicate

    Hello
    I get the customer data from various sources in the staging of the table where I insert in the database table where the combination of two columns is considered as a unique key. But there is a possibility of duplicates. How to find duplicates in a SQL or pl/sql

    Thank you
    Manoi.

    Kassa,

    You can see the duplicates by using the following query...

    sql> select * from temp_rajesh;
    
          COL1       COL2 MESSAGE
    ---------- ---------- ------------------
           100        200 message
           100        200 message2
           300        400 message3
           400        500 message 4
    
    sql> select col1, col2, count(*)
      2     from temp_rajesh
      3       group by col1, col2
      4         having count(*) > 1;
    
          COL1       COL2   COUNT(*)
    ---------- ---------- ----------
           100        200          2
    

    -If in the case of duplicate records, you should see only the duplicates (according to some timestamp etc., you can use the functinon row_number analytic..)

      1  select col1, col2 from (
      2  select col1, col2,
      3         row_number() over (partition by col1, col2
      4                            order by message) rn
      5    from temp_rajesh)
      6*   where rn > 1
    sql> /
    
          COL1       COL2
    ---------- ----------
           100        200
    

    In the above example, I use message to order, you can replace it with activity_timestamp or the insertd_date according to your logic... when there are two records... one that you choose to duplicate.

    Thank you
    Rajesh.

    Published by: Rajesh Chamarthi on November 20, 2009 12:05 AM (added for example)

  • Delete query to delete records from multiple tables

    All,

    I need a delete query that will delete the records from the tables. Please see the structure of the table & below
    CREATE TABLE TEMP1 (ID NUMBER(10),NAME VARCHAR2(40),CLASS VARCHAR2(40),COLLEGE VARCHAR2(40));
    CREATE TABLE TEMP2 (ID NUMBER(10),CITY VARCHAR2(40),STATE(40));
    
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (1000,'SAM','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (2000,'RIO','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (3000,'CHRIS','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (4000,'ALEX','CS','UNIV_1');
    
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (1000,'Auburn','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (2000,'Ithaca','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (3000,'Mount Vernon','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (4000,'Port Jervis','NY');
    Now, I need to delete the records in these tables where the ID is '2000' by using a single delete query. Is this possible? This may be a newbie question. Help, please.

    "using a single request deletion. Is this possible?

    Nope.
    You can insert into multiple tables by using a single query, INSERT ALL job, but you cannot delete more than one table using a single query.

  • Delete records from a table of forms

    Oracle forms6i
    Hai All

    I use forms6i and my need is I have generated a forms and the output is displayed through tables and I need to delete all the records from the table of my forms when executing next time pls tell me

    Concerning

    Srikkanth.M

    Hello

    Please try something like that.

    Begin
    Delete From Master_Tbl Cascade;
    forms_ddl('Commit');
    End;
    

    Sarah

  • Deleting records from a table and trying to retrieve those

    Hello
    is it possible to recover the table deleted after validation of the track file, if so how? Once again I have to synchronize back to the database once the table is retrieved.

    Reverse GoldenGate utility.

    details on this forum.
    Reverse GoldenGate utility
    Golden Gate can be a lever to make point in time recovery for MySql?

  • How to delete columns from a table

    Hello

    I have a 2D chart composed of 12 columns. I want to just use the first three columns within LabView. What is the best way to extract the data from these three columns?

    Greetings

    Kristoffer

    You can watch from two different angles:

    • You can remove the extra columns
    • You can keep only the fist three columns

    Would be easier to use "subset of the table" and select the first three columns. See photo.

    (This assumes you want the three columns as a 2D array. If you want in three tables 1 d, you would use 'index array' resized to three exits.)

  • How replicates all records from one table to another table without using expdp, impdp

    Hi I have two database in a database, that I have a table called t1 and another base data, I have the second table .so, my first table have records, that I need to transfer all records second T2 without use of expdp and impdp in every 5 min... what I do

    ??

    The best solution for this scenario is to use Oracle Golden Gate

    However, it requires a license, and you must pay for it.

    If this is not possible, you can create a job scheduler that uses a link DB in order to reproduce the recordings of the target database, but it will take the entire table to the target database and then INSERT AS SELECT truncate the data of the entire table every time that the job is running (because you can't follow only the records that have been changed or modified).

    In addition, read here on the replication of data using materialized views.

  • How to delete items from a cluster?

    Hello. I would like to know how to delete items from a cluster. I'm stuck with this problem. It has its own order of each element in a cluster. I tried to open a table, but it seems too complicated. In the attachment, I want to only get the data of 'flow' not 'pressure '. I try to use array programming, but it does not work. Would be nice if you help me to fix the file. Thank you

    Thank you very much. Your solution is way better than my confusing file.

  • Delete records from sys.aud$ stored procedure

    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If {(rowcount > 1000)
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    956928 wrote:
    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If (rowcount 1000 >) {}
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    acquired through ROLE privileges are NOT applicable within the named PL/SQL procedures.

    GRANT DELETE ON SYS. AUD$ ;

  • How to delete photos from my i phone 6 but keep them on my i mac

    How to delete photos from my i phone 6 but keep them on my i mac os x

    peterfromcredin wrote:

    How to delete photos from my i phone 6 but keep them on my i mac os x

    And how does your photos get your iMac?

    Photo stream that you use?

  • help in registration of the records from two tables

    HI: I have two tables joined the first field. The field is the primary key in the first table. Need help listing records from both tables with each a line/record results.
    create table EVENTS (
    event_key varchar2(64) primary key,
    event_description varchar2(64),
    create_time int
    );
    
    
    create table EVENT_UPDATES (
    event_key varchar2(64) NOT NULL ,
    update_description varchar2(64),
    update_time int
    );
    
    
    insert into EVENTS values('Event1', 'This is event1', 1);
    insert into EVENT_UPDATES values('Event1', 'Ticket created', 3);
    insert into EVENT_UPDATES values('Event1', 'Event cleared', 10);
    insert into EVENTS values('Event2', 'This is event2', 4);
    insert into EVENT_UPDATES values('Event2', 'Ticket created', 6);
    insert into EVENT_UPDATES values('Event2', 'Event cleared', 8);
    I want to print each record in the table of EVENTS such as a line and the corresponding records in EVENT_UPDATES as a line like this record
    Event1   1     This is event1
                3     Ticket created
                10   Event cleared
    Event2   4     This is event2
                6     Ticket created
                8     Event cleared
    TIA
    Ravi
    select  case weight
              when 1 then event_key
            end key,
            time_val,
            description
      from  (
              select  event_key,
                      create_time time_val,
                      event_description description,
                      1 weight
                from  events
             union all
              select  event_key,
                      update_time,
                      update_description,
                      2 weight
                from  event_updates
            )
      order by event_key,
               weight
    /
    
    KEY          TIME_VAL DESCRIPTION
    ---------- ---------- -------------------------
    Event1              1 This is event1
                        3 Ticket created
                       10 Event cleared
    Event2              4 This is event2
                        6 Ticket created
                        8 Event cleared
    
    6 rows selected.
    
    SQL> 
    

    SY.

  • How to restore deleted records in another table in the oracle 10g database...

    Hi all

    I want to restore deleted records in a particular table in the other table

    Suppose that:

    I make a request

    delete from emp

    where deptno = 30;

    now, I won't restore deptno = 30 records in the other table, let's say table emp1

    can someone let me know how to do it?

    Thank you...

    This is what flashback query is for:

    orclz > conn scott/tiger

    Connected.

    orclz > select count (*) emp;

    COUNT (*)

    ----------

    14

    orclz > delete from emp where deptno = 30;

    6 deleted rows.

    orclz > commit;

    Validation complete.

    orclz > create table deleted30 in select * from emp to the timestamp (systimestamp - 5/1440) where deptno = 30;

    Table created.

    orclz > select count (*) in the deleted30;

    COUNT (*)

    ----------

    6

    orclz >

  • Impossible to delete the record from the table using the form

    I have a stored procedure (function, actually) that allows an administrator to manually delete a record in a table.

    When I call my form there will be no effect. The record remains in the table.

    In both cases, I connect to the database to the same user.

    I am able to call a test function in the database which returns a field in the record, so I think I can at least communicate with and retrieve results from the database using a stored function. As soon as I approach him "select" "delete from", no luck.

    If I try to run the SQL in my form with a statement of FORMS_DDL, it seems to run smoothly when I not in the code in the debugger, but it had no effect. FORMS_SUCCESS reports TRUE if DBMS_ERROR_TEXT has the following: ORA-01403: no data found. I don't know how the DBMS_ERROR_TEXT is that FORMS_SUCCESS is not set to FALSE.

    Any ideas as to why I am unable to remove using my form but can when you call the function registered directly/manually?

    Using Oracle Forms & DB 10.0.2.0.1.

    Patrick,

    After each Insert / Update / Delete statement, you have to COMMIT . Then only it will be in select statements.

    Kind regards

    Manu.

  • How to load data from different tables, but record to another table?

    Hi all

    I use the apex and I understand how it updates and saves the files normally.

    In this case, I would need to load from a table, but save on another Board on the button "submit".

    I am aware that it would be easy as forms where I could do a manual insert process. im making in tabular form and I don't really know how to handle this process.

    Suppose that I am loading a set of questionnaires in the form of tables and have a yes / no selection.

    If the questions would come from table A and I need to save it in table B.

    in this case that I can't put just the value default by the tabular row for questions coz it would be dynamic and this example is on a small scale. I would need to load the table A and record in table B.

    could someone guide me on this operation or provide tutorials any?

    Maybe that's what you're after.

    (1) create region report using SQL like this:

    Select apex_item.hidden(1,rownum).

    apex_item.display_and_save(2,question_column) in Question,

    apex_item. Text(3,,4,4) as answer

    from table_a

    apex_item documentation of package found:

    http://docs.Oracle.com/CD/E37097_01/doc/doc.42/e35127/apex_item.htm

    The pidx (first number) in each apex_item parameter is used to identify this item in the same row of the report' / tabular form.

    (2) create a submit in procedure a bit like that.

    Start

    because I 1.apex_application.g_f01.count loop - identifies the "apex_item.hidden(1,rownum)" at the top and gets a count of how many times it occurs

    Insert into table_b (question, answer)

    values (apex_application.g_f02 (i), apex_application.g_f03 (i));

    end loop;

    end;

  • How to read/select only the records from a table with non-English characters

    Hello
    I need to find all records in a table with non-English (mainly Chinese) characters in at least one of the varchar2 columns. Let me kow if someone knows a way by which it can be done using SQL/PLSQL.

    Best regards
    Imran
    select * from your table
    where your_column != convert(your_column, 'UTF8', 'US7ASCII)
    

    Replace UTF8 with your database character set

    Published by: thtsang on October 15, 2009 03:53 - unequal sign change of! =

Maybe you are looking for