Home » SQL & PL/SQL » SQL & PL/SQL » Calculate with sql
icon5.gif  Calculate with sql [message #429124] Mon, 02 November 2009 04:21 Go to next message
frax
Messages: 5
Registered: November 2009
Junior Member
Is there anyone who can help me with this one?

I want to get all customers who have reached their limit in a list. As you can see in the sql below i can calculate it with a specific id specified but i want to remove that filter and receive a list of customer. But i can´t figure out how to do that! Every SQL part (t0 - t4)can produce different numbers of rows so i think i need some kind of union here?

select t0.limit-t1.Total-(t2.Total-t3.Total-(t4.Total-t3.Total)) from

(select creditlimit limit, custid customers 
from company, customer 
where customer.compid = company.compid 
AND customer.custid = 19892) t0,

(SELECT SUM(totalPrice) Total, custid customers 
FROM lmorder 
WHERE billed < 0 and custid = 19892
group by custid) t1,  

(SELECT SUM(B.totalCapital) Total, custid customers 
FROM bill B  
WHERE B.billType = 'D' and custid = 19892
group by custid) t2,

(SELECT SUM(B.totalCapital) Total, custid customers 
FROM bill B  
WHERE B.billType = 'K' and custid = 19892
group by custid) t3,

(SELECT SUM(amount) Total, custid customers 
FROM payment P, bill B 
WHERE B.billID = P.billID 
AND P.paymentID > 0 and custid = 19892 
group by custid) t4


//Fredrik
Re: Calculate with sql [message #429134 is a reply to message #429124] Mon, 02 November 2009 04:44 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
The requirement is a little unclear without a test case, but have a look at the analytical sum function.
Re: Calculate with sql [message #429135 is a reply to message #429124] Mon, 02 November 2009 04:45 Go to previous messageGo to next message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add a join condition on custid in the outer query for all inner ones.

Regards
Michel
Re: Calculate with sql [message #429327 is a reply to message #429135] Tue, 03 November 2009 04:09 Go to previous messageGo to next message
frax
Messages: 5
Registered: November 2009
Junior Member
Thanks for your answer, i have tried to make something out of it but can´t make it work. I will post my tables and hopefully someone would be able to help me.

The result should be something like this

Total Custid
-1989,72 19892
-1204237,25 5340

Sorry for the long codeblock Embarassed
//Fredrik


CREATE TABLE CUSTOMER
(
  CUSTID             NUMBER(12)                 NOT NULL,
  COMPID             NUMBER(12),
 PRIMARY KEY
 (CUSTID)
);

CREATE TABLE COMPANY
(
  COMPID                NUMBER(12),
  CREDITLIMIT           NUMBER(12,2),
 PRIMARY KEY
 (COMPID)
);

CREATE TABLE LMORDER
(
  ORDERID      NUMBER(6)                        NOT NULL,
  CUSTID       NUMBER(12),
  TOTALPRICE   NUMBER(12,2),
  BILLED       NUMBER(1),
  PRIMARY KEY
 (ORDERID)
);

CREATE TABLE BILL
(
  BILLID                 NUMBER(6)              NOT NULL,
  BILLTYPE               VARCHAR2(2 BYTE),
  CUSTID                 NUMBER(12),
  TOTALCAPITAL           NUMBER(12,2),
  PRIMARY KEY
 (BILLID)
);

CREATE TABLE PAYMENT
(
  PAYMENTID    NUMBER(6)                        NOT NULL,
  BILLID       NUMBER(6),
  AMOUNT       NUMBER(12,2),
  PRIMARY KEY
 (PAYMENTID)
);


Insert into CUSTOMER
   (CUSTID, COMPID)
 Values
   (5340, 3792);
Insert into CUSTOMER
   (CUSTID, COMPID)
 Values
   (19892, 17828);
COMMIT;


Insert into COMPANY,
   (COMPID, CREDITLIMIT)
 Values
   (3792, 5000);
Insert into COMPANY,
   (COMPID, CREDITLIMIT)
 Values
   (17828, 19000);
COMMIT;


Insert into LMORDER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68911, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68912, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68965, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68966, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68968, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68976, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (68979, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72397, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72398, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72399, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72400, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72401, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72402, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72447, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72448, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72449, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72450, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72451, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72452, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72453, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72454, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72461, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72462, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72463, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72464, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72477, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72478, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72479, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72533, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72715, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72716, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72717, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72718, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72719, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72720, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72721, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72722, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72723, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72724, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72725, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72726, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72727, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72728, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72729, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72730, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72731, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72732, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72733, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72734, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72735, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72736, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72737, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72738, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72739, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72740, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72741, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72742, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72743, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72744, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72745, 49, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72746, 49, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72915, 400000, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72919, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72848, 400000.25, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72851, 400000, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72846, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72446, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72458, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72337, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72338, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72339, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72340, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72341, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72342, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72343, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72344, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72345, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72346, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72347, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72348, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72349, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72350, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72351, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72352, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72353, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72354, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72355, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72356, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72357, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72358, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72359, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72360, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72361, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72362, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72363, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72364, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72365, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72366, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72367, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72368, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72369, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72370, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72371, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72372, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72373, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72374, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72375, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72376, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72377, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72378, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72379, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72380, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72381, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72382, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72655, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72656, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72657, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72658, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72659, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72660, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72661, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72662, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72663, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72664, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72665, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72666, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72667, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72668, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72669, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72670, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72671, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72672, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72673, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72674, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72675, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72676, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72677, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72678, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72679, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72680, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72681, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72682, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72683, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72684, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72685, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72686, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72687, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72688, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72689, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72690, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72691, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72383, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72384, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72385, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72386, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72387, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72388, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72389, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72390, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72391, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72392, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72393, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72394, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72395, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72396, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72409, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72410, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72411, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72751, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72692, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72693, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72694, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72695, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72696, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72697, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72698, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72699, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72700, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72701, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72702, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72703, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72704, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72705, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72706, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72710, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72788, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72404, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72405, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72406, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72407, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72408, 17, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72455, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72456, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72457, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72459, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72467, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72480, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72481, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72482, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72483, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72484, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72485, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72486, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72487, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72488, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72489, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72490, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72491, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72492, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72493, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72494, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72495, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72496, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72497, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72498, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72499, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72500, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72501, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72502, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72503, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72504, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72505, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72506, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72507, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72508, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72509, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72510, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72511, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72512, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72513, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72514, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72515, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72516, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72517, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72518, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72526, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72527, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72528, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72529, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72530, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72531, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72532, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72652, 19, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72653, 19, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72654, 19, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72708, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72709, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72713, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72787, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72794, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72831, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72832, 99, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72836, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72837, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72838, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72839, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72840, 11, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72864, 29, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72924, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (72925, 9, 5340, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73774, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73775, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73776, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73777, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73778, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73779, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73785, 99, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73786, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73788, 396, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73789, 49, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73790, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73791, 49, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73792, 29, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73793, 2400, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73006, 177, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73008, 1980, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73753, 177.39, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73754, 150, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73581, -1490, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73583, 2400, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73755, 12, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73756, 96.44, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73757, 96.44, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73758, 177.39, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73759, 119.13, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73760, 96.44, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73771, -187, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73772, -148.5, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73773, 0, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73787, 495, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73794, 2400, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73795, -600, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73004, 9, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73780, 99, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73781, 149, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73782, 20, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73783, 39, 19892, -1);
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73784, 29, 19892, -1);
COMMIT;

Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45975, 'D', 36, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45976, 'D', 2518, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45977, 'D', 51, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45983, 'D', 3260, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45984, 'D', 2174, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45972, 'D', 284, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45970, 'D', 1175, 5340);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (55520, 'D', 225, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45973, 'D', 160, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (55659, 'D', 225, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (55513, 'D', 225, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (53335, 'D', 1026, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (45985, 'D', 1924, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (54204, 'K', 1026, 19892);
Insert into BILL
   (BILLID, BILLTYPE, TOTALCAPITAL, CUSTID)
 Values
   (56502, 'D', 225, 19892);
COMMIT;

Insert into PAYMENT
   (PAYMENTID, BILLID, AMOUNT)
 Values
   (14385, 45972, 284);
Insert into PAYMENT
   (PAYMENTID, BILLID, AMOUNT)
 Values
   (14386, 45973, 160);
Insert into PAYMENT
   (PAYMENTID, BILLID, AMOUNT)
 Values
   (14387, 45970, 1175);
Insert into PAYMENT
   (PAYMENTID, BILLID, AMOUNT)
 Values
   (14407, 55513, 225);
Insert into PAYMENT
   (PAYMENTID, BILLID, AMOUNT)
 Values
   (14409, 55520, 225);
COMMIT;


[Updated on: Tue, 03 November 2009 04:17]

Report message to a moderator

Re: Calculate with sql [message #429350 is a reply to message #429327] Tue, 03 November 2009 05:36 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Insert into CUSTOMER
   (ORDERID, TOTALPRICE, CUSTID, BILLED)
 Values
   (73784, 29, 19892, -1);


Have you tried the above query which is in your post?

You shuld get
ERROR at line 2:
ORA-00904: "BILLED": invalid identifier
Re: Calculate with sql [message #429359 is a reply to message #429124] Tue, 03 November 2009 06:31 Go to previous messageGo to next message
frax
Messages: 5
Registered: November 2009
Junior Member
I am so sorry for that, no i didn´t check the code.
I used Toad to export the queries. I don´t understand why it changed from the second line to CUSTOMER, it should have been LMORDER like the first insert??

//Fredrik
Re: Calculate with sql [message #429375 is a reply to message #429359] Tue, 03 November 2009 07:44 Go to previous message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
frax wrote on Tue, 03 November 2009 06:31
I am so sorry for that, no i didn´t check the code.
I used Toad to export the queries. I don´t understand why it changed from the second line to CUSTOMER, it should have been LMORDER like the first insert??

//Fredrik


Even These.......You posted the query having 1000 no of lines.

Do you really think that it is posible to run each and every query individually?
Crying or Very Sad

SQL> Insert into COMPANY,
  2     (COMPID, CREDITLIMIT)
  3   Values
  4     (3792, 5000);
Insert into COMPANY,
                   *
ERROR at line 1:
ORA-00926: missing VALUES keyword


SQL> Insert into COMPANY,
  2     (COMPID, CREDITLIMIT)
  3   Values
  4     (17828, 19000);
Insert into COMPANY,
                   *
ERROR at line 1:
ORA-00926: missing VALUES keyword


Its impossible for me to check every statement whether it is correct or Any missing syntax it has....

Regards
Sriram.

[Updated on: Tue, 03 November 2009 07:49]

Report message to a moderator

Previous Topic: collection and records(basic documents)
Next Topic: Correlation Approach
Goto Forum:
  


Current Time: Sun Dec 11 06:28:28 CST 2016

Total time taken to generate the page: 0.12686 seconds