2 Replies - 394 Views - Last Post: 26 November 2017 - 09:34 AM

#1 Nardilla   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-October 17

Foreign key errors- oracle SQL

Posted 25 November 2017 - 06:32 PM

--drop tables, remove constraints
DROP TABLE NB_Customer CASCADE CONSTRAINTS;
DROP TABLE NB_Call CASCADE CONSTRAINTS;
DROP TABLE NB_Topic CASCADE CONSTRAINTS;
DROP TABLE NB_Order CASCADE CONSTRAINTS;
DROP TABLE NB_Product CASCADE CONSTRAINTS;
DROP TABLE NB_Sales_Associate CASCADE CONSTRAINTS;

--------------------------------------------------------------------------------
--create table statements
CREATE TABLE NB_Customer(
Customer_ID  NUMBER,
Customer_Name VARCHAR2(50),
Customer_Address VARCHAR2(70),
Customer_CITY VARCHAR2(25),
Customer_State VARCHAR2(5),
Customer_ZIP NUMBER,
Customer_Phone VARCHAR2(20),
Customer_Fax VARCHAR2(20),
Customer_Email VARCHAR2(60),
Customer_Website VARCHAR2(60),
Cstomer_Contact VARCHAR2(150));

CREATE TABLE NB_Call(
Call_ID NUMBER,
Sales_Person_ID NUMBER,
Customer_ID NUMBER,
Topic_ID NUMBER,
Call_Date DATE,
Call_Comments VARCHAR2(150));


CREATE TABLE NB_Topic(
Topic_ID NUMBER,
Topic_Description VARCHAR2(30));

CREATE TABLE NB_Order(
Order_ID NUMBER,
Customer_ID NUMBER,
Sales_Person_ID NUMBER,
Order_Date DATE,
Product_ID NUMBER,
Order_Quantity NUMBER,
Product_Price NUMBER,
Order_Amount NUMBER);

CREATE TABLE NB_Product(
Product_ID NUMBER,
Product_Description VARCHAR2(30),
Product_Cost NUMBER,
Product_Price NUMBER);

CREATE TABLE NB_Sales_Associate(
Sales_Person_ID NUMBER,
Sales_Person_Name VARCHAR2(50),
Sales_Person_Last_Name VARCHAR2(50),
Sales_Person_Cellphone VARCHAR2(20),
Sales_Person_email VARCHAR2(50));

------------------------------------------------------------------------------------
--Primary key Alter statements
ALTER TABLE NB_Customer
ADD CONSTRAINT Customer_ID_PK PRIMARY KEY(Customer_ID);

ALTER TABLE NB_Call
ADD CONSTRAINT Call_ID_PK PRIMARY KEY(Call_ID);

ALTER TABLE NB_Topic
ADD CONSTRAINT Topic_ID_PK PRIMARY KEY(Topic_ID);

ALTER TABLE NB_Order
ADD CONSTRAINT  Order_ID_PK PRIMARY KEY (Order_ID);

ALTER TABLE NB_Product
ADD CONSTRAINT  Product_ID_PK PRIMARY KEY(Product_ID);

ALTER TABLE NB_Sales_Associate
ADD CONSTRAINT Sales_Person_ID_PK PRIMARY KEY(Sales_Person_ID);

--------------------------------------------------------------------------------
--Foreign key statements

ALTER TABLE NB_Call
ADD CONSTRAINT Call_Customer_FK FOREIGN KEY
(Customer_ID) REFERENCES NB_Customer (Customer_ID);

ALTER TABLE NB_Call
ADD CONSTRAINT Call_Topic_FK FOREIGN KEY
(Topic_ID) REFERENCES NB_Topic (Topic_ID);

ALTER TABLE NB_Call
ADD CONSTRAINT Call_Sales_Associate_FK FOREIGN KEY
(Sales_Person_ID) REFERENCES NB_Sales_Associate (Sales_Person_ID);

ALTER TABLE NB_Order
ADD CONSTRAINT Order_Sales_Associate_FK FOREIGN KEY
(Sales_Person_ID) REFERENCES NB_Sales_Associate (Sales_Person_ID);


ALTER TABLE NB_Order
ADD CONSTRAINT Order_Customer_FK FOREIGN KEY
(Customer_ID) REFERENCES NB_Customer (Customer_ID);

ALTER TABLE NB_Order
ADD CONSTRAINT Order_Product_FK FOREIGN KEY
(Product_ID) REFERENCES NB_Product (Product_ID);


--TABLE NB_Customer
INSERT INTO NB_Customer  VALUES(1,'Fresco','235 Joe street','Allentown','PA',18017,'610-261-3589','610-895-7866','[email protected]','www.fresco.com','Theresa West')	;
INSERT INTO NB_Customer  VALUES(2,'Alfonzo','589 grey drive','Boca Raton','FL',33021,'511-261-1532','511-895-7830','[email protected]','www.alfonzo.com','Charles Bush')	;
INSERT INTO NB_Customer  VALUES(3,'Grunther','4891 rio avenue','Allentown','PA',18014,'610-261-58942','610-820-8949','[email protected]','www.grunther.com','Katherine Butler')	;
INSERT INTO NB_Customer  VALUES(4,'Greenland','895 Levands Road','Saint Paul','MN',45804,'654-261-8459','654-997-9571','[email protected]','www.greenland.com','Cedric Lyons')	;
INSERT INTO NB_Customer  VALUES(5,'Finck','2145 black Forest circle','Easton','PA',18012,'610-261-4581','610-598-9510','[email protected]','www.finck.com','Jay Schultz')	;
INSERT INTO NB_Customer  VALUES(6,'Gredert','589 trent street','Huston','TX',54831,'589-261-0215','589-339-2147','[email protected]','www.gredert.com',' Wilbur Medina')	;
INSERT INTO NB_Customer  VALUES(7,'Huymer','247 Blue drive','Hollywood','CA',25843,'369-261-6894','369-986-2911','[email protected]','www.Huymer.com','Irving Gibbs')	;
INSERT INTO NB_Customer  VALUES(8,'Gopret','8921 Grant avenue','Boynton Beach','FL',95654,'485-261-8459','485-891-9827','[email protected]','www.gopret.com','Julian Mccarthy')	;
INSERT INTO NB_Customer  VALUES(9,'Fringwert','7436 Crest Road','Tucson','AZ',15798,'582-261-2186','582-597-7452','[email protected]','www.fringwert.com','Gertrude Moreno')	;
INSERT INTO NB_Customer  VALUES(10,'Jutheth','849 Mount circle','Los angeles','CA',57899,'369-261-2549','369-391-9955','[email protected]','www.juheth.com','Renee Weaver')	;
INSERT INTO NB_Customer  VALUES(11,'Klodss','214   Saint Paul street','New York City','NY',15787,'741-261-3335','741-677-5987','[email protected]','www.klodss.com','Darryl Schultz')	;
INSERT INTO NB_Customer  VALUES(12,'Gastph','125 plum drive','Duluth','MN',25482,'586-261-2544','586-941-2669','[email protected]','www.gastph.com','Hattie Webster')	;
INSERT INTO NB_Customer  VALUES(13,'Hurkey','2365 maple avenue','Phoenix','AZ',35913,'589-261-2522','589-699-9817','[email protected]','www.hurkey.com','Donna Ramos')	;
INSERT INTO NB_Customer  VALUES(14,'Hrets','591 Hamilton Road','San Diego','CA',15785,'895-261-0154','895-111-5563','[email protected]','www.hrets.com','Conrad Malone')	;
INSERT INTO NB_Customer  VALUES(15,'Lopedt','3474 Robert  lane','Trenton','NJ',58444,'610-261-3598','610-551-9127','[email protected]','www.lopedt.com','Eugene Phelps')	;
INSERT INTO NB_Customer  VALUES(16,'Fristz','559 Plato street','Delray Beach','FL',14585,'987-261-1247','987-211-3398','[email protected]','www.fristz.com','Hector Glover')	;
INSERT INTO NB_Customer  VALUES(17,'kuths','5879 Ammore  drive','Minneaoplis','MN',69878,'489-261-2507','489-866-7327','[email protected]','www.kuths.com','Vera Price')	;
INSERT INTO NB_Customer  VALUES(18,'Brenth','4891 rio avenue','Dallas','TX',14587,'851-261-6589','851-217-9812','[email protected]','www.brenth.com','Charlotte Patterson')	;
INSERT INTO NB_Customer  VALUES(19,'Pholy','2689 fresh Road','Tucson','AZ',15471,'610-261-9840','610-258-5841','[email protected]','www.pholy.com','Tina Matthews')	;
INSERT INTO NB_Customer  VALUES(20,'Thophy','299 Abigail lane','Buffalo','NY',36986,'159-261-6508','159-236-5481','[email protected]','www.thophy.com','Dave Walsh')	;
INSERT INTO NB_Customer  VALUES(21,'Dracdo','698 Grape street','Palm Beach','FL',15746,'367-261-5831','367-105-9143','[email protected]','www.dracdo.com','Josh Ruiz')	;
INSERT INTO NB_Customer  VALUES(22,'Laprys','762 Juniper  drive','Princenton','NJ',25847,'597-261-6901','597-987-9842','[email protected]','www.laprys.com','Mona Lawson')	;
INSERT INTO NB_Customer  VALUES(23,'Jathys','359 Elm avenue','Philadelphia','PA',18104,'983-261-6980','983-548-5144','[email protected]','www.jathys.com','Thelma Fleming')	;
INSERT INTO NB_Customer  VALUES(24,'Byrons','398 grapeseed Road','Sedona','AZ',96325,'437-261-2485','437-391-3368','[email protected]','www.byrons.com','Maurice Summers')	;
INSERT INTO NB_Customer  VALUES(25,'Jojoky','957 copper field lane','Albany','NY',25846,'927-261-6897','927-048-3811','[email protected]','www.jojoky.com','Adam Buchanan')	;
INSERT INTO NB_Customer  VALUES(26,'Fruglie','2897 milkyway street','Orlando','FL',15478,'689-261-5890','689-754-0681','[email protected]','www.fruglie.com','Archie Bowen')	;
INSERT INTO NB_Customer  VALUES(27,'Pruntrex','2350 Fern drive','Atlantic City','NJ',35782,'187-261-5548','187-974-1089','[email protected]','www.pruntrex.com','Katherine Garner')	;
INSERT INTO NB_Customer  VALUES(28,'Gyrones','29 gothic avenue','Sacramento','CA',69851,'654-261-1032','654-156-6541','[email protected]','www.gyrones.com','Doreen Holland')	;
INSERT INTO NB_Customer  VALUES(29,'Montemart','2980 Coconut Road','Austin','TX',15470,'524-261-3617','524-975-2315','[email protected]','www.montemart.com','Rolando Campbell')	;
INSERT INTO NB_Customer  VALUES(30,'Neythew','996 Flower lane','Bethlehem','PA',18103,'954-261-5891','954-589-9851','[email protected]','www.neythew.com','Alexandra Meyer')	;
INSERT INTO NB_Customer  VALUES(31,'Yearin','42 Lyme Street ','Hopewell Junction',' NY',12533,'419-299-4407','975-443-5795','[email protected]','www.yearin.com','Paul Clark')	;
INSERT INTO NB_Customer  VALUES(32,'Goodsilron','215 Lake View Ave. ','Vista','CA',92083,'888-342-9364','646-289-2514','[email protected]','www.goodsilron.com','Kristopher Rodgers')	;
INSERT INTO NB_Customer  VALUES(33,'Condax','70 S. Railroad Street ','Englewood',' NJ',7631,'254-827-1455','812-736-3273','[email protected]','www.condax.com','Alicia Drake')	;
INSERT INTO NB_Customer  VALUES(34,'Opentech','554 George Lane ','Fishers',' IN',46037,'900-748-4152','311-278-2756','[email protected]','www.opentech.com','Betsy Bell')	;
INSERT INTO NB_Customer  VALUES(35,'Golddex','9124 Grant Ave. ','Evansville',' IN',47711,'106-491-3710','372-359-2028','[email protected]','www.golddex.com','Patty Mann')	;
INSERT INTO NB_Customer  VALUES(36,'yearjob','539 Old Peninsula Street ','Brighton',' MA',2135,'562-749-0580','361-990-3465','[email protected]','www.yearjob.com','Hubert Baldwin')	;
INSERT INTO NB_Customer  VALUES(37,'Isdom','289 Berkshire Road ','Berwyn','IL',60402,'508-506-0838','585-115-2355','[email protected]','www.isdom.com','Jermaine Hall')	;
INSERT INTO NB_Customer  VALUES(38,'Gogozoom','5 Mulberry Avenue ','Atwater','CA',95301,'579-481-7132','998-589-2673','[email protected]','www.gogozoom.com','Nathaniel Hudson')	;
INSERT INTO NB_Customer  VALUES(39,'Y-corporation','8098 4th St. ','Waterloo','IA',50701,'948-411-7527','248-852-4183','[email protected]','www.Y-corporation.com','Wilma Cohen')	;
INSERT INTO NB_Customer  VALUES(40,'Nam-zim','8158 Rockcrest Street ','Hopewell','VA',23860,'817-220-9678','645-116-2105','[email protected]','www.Nam-zim.com','Henry Huff')	;
INSERT INTO NB_Customer  VALUES(41,'Donquadtech','4 Ridgewood Ave. ','Saint Paul',' MN',55104,'392-465-7355','354-628-2365','[email protected]','www.Donquadtech.com','Randal Cannon')	;
INSERT INTO NB_Customer  VALUES(42,'Warephase','98 Lantern Street ','Altamonte Springs',' FL',32714,'844-981-2153','141- 561-1531','[email protected]','www.Warephase.com','Bernadette Norton')	;
INSERT INTO NB_Customer  VALUES(43,'Donware','7275 South Columbia Dr. ','Fargo','ND',58102,'910-240-3122','498-430-3851','[email protected]','www.Donware.com','Sammy Saunders')	;
INSERT INTO NB_Customer  VALUES(44,'Faxquote','8555 Highland Court ','Brainerd',' MN',56401,'324-261-2711','410-140-3562','[email protected]','www.Faxquote.com','Eddie Osborne')	;
INSERT INTO NB_Customer  VALUES(45,'Sunnamplex','49 Iroquois Ave. ','Fredericksburg',' VA',22405,'243-422-1005','765-556-8003','[email protected]','www.Sunnamplex.com','Rolando Potter')	;
INSERT INTO NB_Customer  VALUES(46,'Lexiqvolax','8595 South Pineknoll Lane ','Farmingdale','NY',11735,'536-962-9200','216-340-7867','[email protected]','www.Lexiqvolax.com','Salvador Perry')	;
INSERT INTO NB_Customer  VALUES(47,'Sumace','308 East Myrtle Drive ','New Brunswick',' NJ',8901,'761-591-7082','373-695-7374','[email protected]','www.Sumace.com','Lorraine Gutierrez')	;
INSERT INTO NB_Customer  VALUES(48,'Treequote','668 Greenview Court ','Niceville',' FL',32578,'481-572-1716','953-370-4868','[email protected]','www.Treequote.com','Doris Wolfe')	;
INSERT INTO NB_Customer  VALUES(49,'Iselectrics','9558 Lantern Drive ','Muncie','IN',47302,'416-233-3999','832-665-1619','[email protected]','www.Iselectrics.com','Joann Boyd')	;
INSERT INTO NB_Customer  VALUES(50,'Zencorporation','9 S. San Pablo St. ','Rolla','MO',65401,'416-435-2939','959-870-1314','[email protected]','www.Zencorporation.com','Jeannie Mcdonald')	;
INSERT INTO NB_Customer  VALUES(51,'Plusstrip','583 Marvon St. ','Naples','FL',34116,'950-810-7555','859-303-0472','[email protected]','www.Plusstrip.com','Pam Clayton')	;
INSERT INTO NB_Customer  VALUES(52,'dambase','7261 E. Roosevelt St. ','Stow','OH',44224,'939-292-0410','760-521-8004','[email protected]','www.dambase.com','Verna Obrien')	;
INSERT INTO NB_Customer  VALUES(53,'Toughzap','548 Whitemarsh St. ','Cockeysville','MD',21030,'542-876-7097','848-227-1857','[email protected]','www.Toughzap.com','Christina Frank')	;
INSERT INTO NB_Customer  VALUES(54,'Codehow','9524 San Pablo Street ','Woodside','NY',11377,'932-890-0086','508-741-6403','[email protected]','www.Codehow.com','Audrey Baker')	;
INSERT INTO NB_Customer  VALUES(55,'Zotware','9111 Cedar Street ','Mount Juliet','TN',37122,'127-210-0696','177-865-0805','[email protected]','www.Zotware.com','Winifred Zimmerman')	;
INSERT INTO NB_Customer  VALUES(56,'Statholdings','364 Bishop Ave. ','Patchogue','NY',11772,'573-710-7161','709-423-7805','[email protected]','www.Statholdings.com','Shelley Aguilar')	;
INSERT INTO NB_Customer  VALUES(57,'Conecom','57 West Vale Street ','Glendale','AZ',85302,'405-626-4684','436-957-0845','[email protected]','www.Conecom.com','Vernon Reynolds')	;
INSERT INTO NB_Customer  VALUES(58,'Zathunicon','9742 Beechwood Lane ','Indianapolis',' IN',46201,'747-691-7875','885-470-7107','[email protected]','www.Zathunicon.com','Marc Hubbard')	;
INSERT INTO NB_Customer  VALUES(59,'Labdrill','74 Newbridge Lane ','Klamath Falls','OR',97603,'734-814-1706','424-276-4053','[email protected]','www.Labdrill.com','Orville Powers')	;
INSERT INTO NB_Customer  VALUES(60,'Ron-tech','8580 Division Rd. ','Hinesville','GA',31313,'645-122-6141','890-164-9295','[email protected]','www.Ron-tech.com','Deanna Moody')	;
INSERT INTO NB_Customer  VALUES(61,'Green-Plus','63 Pearl St. ','Sevierville','TN',37876,'592-101-3730','523-943-2124','[email protected]','www.Green-Plus.com','Cathy Horton')	;
INSERT INTO NB_Customer  VALUES(62,'Groovestreet','36 Briarwood Ave. ','Atlantic City',' NJ',8401,'616-896-2848','739-202-1542','[email protected]','www.Groovestreet.com','Beulah Singleton')	;
INSERT INTO NB_Customer  VALUES(63,'Zoomit','8872 Whitemarsh St. ','Lilburn','GA',30047,'792-780-2430','258-290-4857','[email protected]','www.Zoomit.com','Gabriel Simmons')	;
INSERT INTO NB_Customer  VALUES(64,'Bioplex','449 Homewood Avenue ','Piscataway','NJ',8854,'215-861-6547','206-288-1071','[email protected]','www.Bioplex.com','Maxine Hughes')	;
INSERT INTO NB_Customer  VALUES(65,'Zumgoity','7335 Canal Ave. ','Torrington','CT',6790,'470-866-0282','718-970-5102','[email protected]','www.Zumgoity.com','Elsie Garrett')	;
INSERT INTO NB_Customer  VALUES(66,'Scotfind','7123 Annadale Street ','Southgate','MI',48195,'280-871-3551','477-473-8501','[email protected]','www.Scotfind.com','Harvey Reyes')	;
INSERT INTO NB_Customer  VALUES(67,'Dalttechnology','437 Edgewood St. ','Bristol','CT',6010,'716-702-3086','113-506-7662','[email protected]','www.Dalttechnology.com','Tiffany Casey')	;
INSERT INTO NB_Customer  VALUES(68,'Kinnamplus','7972 Hillside St. ','Centreville','VA',20120,'174-860-7025','550-614-7917','[email protected]','www.Kinnamplus.com','Myrtle Shelton')	;
INSERT INTO NB_Customer  VALUES(69,'Konex','741 Alderwood Court ','Dover','NH',3820,'772-996-0903','289-996-4696','[email protected]','www.Konex.com','Amelia Buchanan')	;
INSERT INTO NB_Customer  VALUES(70,'Stanredtax','16 Belmont Ave. ','Norman','OK',73072,'620-636-6593','152-424-5083','[email protected]','www.Stanredtax.com','Jennie Carter')	;
INSERT INTO NB_Customer  VALUES(71,'Cancity','9807 Linda Rd. ','Oswego','NY',13126,'261-301-3799','988-646-5630','[email protected]','www.Cancity.com','Rudy Payne')	;
INSERT INTO NB_Customer  VALUES(72,'Finhigh','9797 Birchpond Street ','Aiken','SC',29803,'224-955-7506','663-205-5852','[email protected]','www.Finhigh.com','Donnie Wilkerson')	;
INSERT INTO NB_Customer  VALUES(73,'Kan-code','7245 S. Tunnel St. ','Mount Vernon','NY',10550,'123-662-2302','696-994-6385','[email protected]','www.Kan-code.com','Lynn Bryan')	;
INSERT INTO NB_Customer  VALUES(74,'Blackzim','401 Richardson Dr. ','Ravenna','OH',44266,'129-176-5941','829-973-3555','[email protected]','www.Blackzim.com','Amber Strickland')	;
INSERT INTO NB_Customer  VALUES(75,'Dontechi','1 Hudson St. ','Bethel Park','PA',15102,'497-421-9335','892-885-8984','[email protected]','www.Dontechi.com','Lauren Harrison')	;
INSERT INTO NB_Customer  VALUES(76,'Xx-zobam','505 E. Schoolhouse Dr. ','Winchester',' VA',22601,'752-988-5401','727-579-9141','[email protected]','www.Xx-zobam.com','Clifford Floyd')	;
INSERT INTO NB_Customer  VALUES(77,'Fasehatice','395 Prince Circle ','Fullerton',' CA',92831,'583-819-0103','112-329-3861','[email protected]','www.Fasehatice.com','Sam Walters')	;
INSERT INTO NB_Customer  VALUES(78,'Hatfan','70 East Church Lane ','Christiansburg','VA',24073,'582-845-1257','344-650-5941','[email protected]','www.Hatfan.com','Richard Silva')	;
INSERT INTO NB_Customer  VALUES(79,'Streethex','218 West Brown Lane ','Wethersfield','CT',6109,'468-494-8570','510-567-2703','[email protected]','www.Streethex.com','Matthew Garza');
INSERT INTO NB_Customer  VALUES(80,'Inity','9172 South Bedford Lane ','Vineland',' NJ',8360,'690-423-1188','891-956-2174','[email protected]','www.Inity.com','Chad Gross');
INSERT INTO NB_Customer  VALUES(81,'Konmatfix','15 High St. ','Sicklerville','NJ',8081,'375-388-4733','201-938-1191','[email protected]','www.Konmatfix.com','Amelia Vasquez')	;
INSERT INTO NB_Customer  VALUES(82,'Bioholding','9932 Arcadia Street ','Ringgold','GA',30736,'976-961-8281','953-481-8604','[email protected]','www.Bioholding.com','Dustin Silva')	;
INSERT INTO NB_Customer  VALUES(83,'Hottechi','268 Wagon Ave. ','Superior','WI',54880,'100-474-9681','939-616-1981','[email protected]','www.Hottechi.com','Harvey Howell')	;
INSERT INTO NB_Customer  VALUES(84,'Ganjaflex','28 Walnut Street ','Ridgewood','NJ',7450,'427-169-2707','198-407-9819','[email protected]','www.Ganjaflex.com','Irvin Mcguire')	;
INSERT INTO NB_Customer  VALUES(85,'Betatech','350 W. Linden Ave. ','West Haven','CT',6516,'665-486-6084','963-338-8922','[email protected]','www.Betatech.com','Freda Bryant')	;
INSERT INTO NB_Customer  VALUES(86,'Domzoom','8565 Halifax Ave. ','Suffolk','VA',23434,'845-654-8418','640-638-4247','[email protected]','www.Domzoom.com','Frederick Medina')	;
INSERT INTO NB_Customer  VALUES(87,'Ontomedia','9225 Harrison Court ','Kansas City','MO',64151,'392-826-1040','282-196-6391','[email protected]','www.Ontomedia.com','Lloyd Kim')	;
INSERT INTO NB_Customer  VALUES(88,'Newex','698 N. Clay Street ','Lithonia','GA',30038,'488-715-3793','532-787-3646','[email protected]','www.Newex.com','John Horton')	;
INSERT INTO NB_Customer  VALUES(89,'Betasoloin','93 Dunbar Ave. ','Fairfield','CT',6824,'990-234-4665','755-919-0503','[email protected]','www.Betasoloin.com','Clyde Fisher')	;
INSERT INTO NB_Customer  VALUES(90,'Mathtouch','726 Green Lake St. ','Torrance','CA',90505,'913-748-5622','374-814-7396','[email protected]','www.Mathtouch.com','Mario Townsend');
INSERT INTO NB_Customer  VALUES(91,'Rantouch','41 North Drive ','Minneapolis','MN',55406,'637-583-3854','238-373-5665','[email protected]','www.Rantouch.com','Kendra Steele')	;
INSERT INTO NB_Customer  VALUES(92,'Silis','7690 S. Poor House Rd. ','Boston','MA',2127,'222-598-5920','973-167-2781','[email protected]','www.Silis.com','Joyce Kelley')	;
INSERT INTO NB_Customer  VALUES(93,'Plussunin','69 Paris Hill Ave. ','West Chester','PA',19380,'786-615-4264','863-153-9695','[email protected]','www.Plussunin.com','Ricardo Todd')	;
INSERT INTO NB_Customer  VALUES(94,'Plexzap','93 Purple Finch St. ','Mahopac','NY',10541,'485-171-0734','845-783-6775','[email protected]','www.Plexzap.com','Kimberly Berry')	;
INSERT INTO NB_Customer  VALUES(95,'Finjob','25 Rockledge Street ','Tampa','FL',33604,'566-406-6263','552-997-4524','[email protected]','www.Finjob.com','Silvia Bridges')	;
INSERT INTO NB_Customer  VALUES(96,'Xx-holding','710 Bay St. ','Endicott','NY',13760,'675-241-7603','402-188-9015','[email protected]','www.Xx-holding.com','Kent Franklin');
INSERT INTO NB_Customer  VALUES(97,'Scottech','684 Shady Drive ','Des Moines','IA',50310,'984-414-1570','653-354-2690','[email protected]','www.Scottech.com','Oliver Holmes')	;
INSERT INTO NB_Customer  VALUES(98,'Funholding','7649 Newbridge St. ','Lynnwood','WA',98037,'192-315-4144','976-921-6563','[email protected]','www.Funholding.com','Ashley Smith')	;
INSERT INTO NB_Customer  VALUES(99,'Sonron','589 Thorne Street ','Marietta','GA',30008,'501-987-2086','123-934-2242','[email protected]','www.Sonron.com','Frances Campbell')	;
INSERT INTO NB_Customer  VALUES(100,'Singletechno','6 Lantern Drive ','Peabody','MA',1960,'794-697-0874','132-459-7489','[email protected]','www.Singletechno.com','Clarence Goodwin');

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--TABLE NB_Call

INSERT INTO NB_Call  VALUES(1,202,10,1,TO_DATE ('11/1/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(2,201,83,2,TO_DATE ('11/2/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(3,204,95,2,TO_DATE ('11/3/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(4,205,51,1,TO_DATE ('11/4/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(5,203,13,2,TO_DATE ('11/5/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(6,202,93,3,TO_DATE ('11/6/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(7,204,8,3,TO_DATE ('11/7/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(8,201,76,1,TO_DATE ('11/8/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(9,205,33,3,TO_DATE ('11/9/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(10,202,27,3,TO_DATE ('11/10/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(11,204,75,2,TO_DATE ('11/11/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(12,203,11,1,TO_DATE ('11/12/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(13,201,5,3,TO_DATE ('11/13/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(14,205,99,2,TO_DATE ('11/14/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(15,202,97,3,TO_DATE ('11/15/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(16,204,30,1,TO_DATE ('11/16/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(17,201,26,3,TO_DATE ('11/17/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(18,202,7,2,TO_DATE ('11/18/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(19,202,17,1,TO_DATE ('11/19/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(20,203,79,3,TO_DATE ('11/20/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(21,204,38,2,TO_DATE ('11/21/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(22,201,32,3,TO_DATE ('11/22/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(23,203,53,2,TO_DATE ('11/23/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(24,205,39,2,TO_DATE ('11/24/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(25,202,21,1,TO_DATE ('11/25/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(26,203,62,3,TO_DATE ('11/26/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(27,205,69,1,TO_DATE ('11/27/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(28,201,77,2,TO_DATE ('11/28/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(29,202,44,2,TO_DATE ('11/29/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(30,204,46,1,TO_DATE ('11/30/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(31,201,40,2,TO_DATE ('12/1/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(32,203,58,3,TO_DATE ('12/2/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(33,205,78,3,TO_DATE ('12/3/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(34,202,55,1,TO_DATE ('12/4/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(35,203,52,3,TO_DATE ('12/5/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(36,201,35,3,TO_DATE ('12/6/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(37,205,64,2,TO_DATE ('12/7/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(38,202,9,2,TO_DATE ('12/8/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(39,204,23,2,TO_DATE ('12/9/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(40,201,12,1,TO_DATE ('12/10/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(41,202,57,3,TO_DATE ('12/11/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(42,202,6,1,TO_DATE ('12/12/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(43,203,94,2,TO_DATE ('12/13/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(44,204,81,2,TO_DATE ('12/14/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(45,201,86,1,TO_DATE ('12/15/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(46,202,36,2,TO_DATE ('12/16/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(47,201,2,3,TO_DATE ('12/17/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(48,204,42,3,TO_DATE ('12/18/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(49,205,19,1,TO_DATE ('12/19/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(50,203,84,3,TO_DATE ('12/20/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(51,202,18,3,TO_DATE ('12/21/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(52,201,3,3,TO_DATE ('12/22/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(53,205,22,3,TO_DATE ('12/23/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(54,202,56,2,TO_DATE ('12/24/2017' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(55,204,24,1,TO_DATE ('12/25/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(56,201,37,3,TO_DATE ('12/26/2017' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(57,202,92,2,TO_DATE ('12/27/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(58,203,25,3,TO_DATE ('12/28/2017' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(59,202,72,2,TO_DATE ('12/29/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(60,201,87,2,TO_DATE ('12/31/2017' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(61,205,61,1,TO_DATE ('1/1/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(62,202,73,2,TO_DATE ('1/2/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(63,204,20,3,TO_DATE ('1/3/2018' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(64,202,29,3,TO_DATE ('1/4/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(65,203,48,1,TO_DATE ('1/5/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(66,204,49,1,TO_DATE ('1/6/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(67,201,67,3,TO_DATE ('1/7/2018' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(68,202,59,2,TO_DATE ('1/8/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(69,201,54,3,TO_DATE ('1/9/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(70,204,14,2,TO_DATE ('1/10/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(71,202,1,2,TO_DATE ('1/11/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(72,202,85,3,TO_DATE ('1/12/2018' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(73,203,45,3,TO_DATE ('1/13/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(74,202,60,1,TO_DATE ('1/14/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(75,204,88,2,TO_DATE ('1/15/2018' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(76,201,71,2,TO_DATE ('1/16/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(77,205,90,1,TO_DATE ('1/17/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(78,202,50,3,TO_DATE ('1/18/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(79,204,96,1,TO_DATE ('1/19/2018' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(80,203,74,1,TO_DATE ('1/20/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(81,201,70,3,TO_DATE ('1/21/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(82,205,66,3,TO_DATE ('1/22/2018' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(83,202,98,2,TO_DATE ('1/23/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(84,204,34,1,TO_DATE ('1/24/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(85,201,16,3,TO_DATE ('1/25/2018' , 'MM/DD/YYYY'),'call next week')	;
INSERT INTO NB_Call  VALUES(86,202,68,1,TO_DATE ('1/26/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(87,202,31,1,TO_DATE ('1/27/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(88,202,80,3,TO_DATE ('1/28/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(89,204,91,2,TO_DATE ('1/29/2018' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(90,203,4,1,TO_DATE ('1/30/2018' , 'MM/DD/YYYY'),'Fast shipping')	;
INSERT INTO NB_Call  VALUES(91,201,43,3,TO_DATE ('2/1/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(92,205,65,1,TO_DATE ('2/2/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(93,202,100,1,TO_DATE ('2/3/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(94,204,28,2,TO_DATE ('2/4/2018' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(95,201,15,2,TO_DATE ('2/5/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(96,202,89,1,TO_DATE ('2/6/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(97,201,82,3,TO_DATE ('2/7/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(98,204,41,1,TO_DATE ('2/8/2018' , 'MM/DD/YYYY'),'')	;
INSERT INTO NB_Call  VALUES(99,205,63,1,TO_DATE ('2/9/2018' , 'MM/DD/YYYY'),'Call next month')	;
INSERT INTO NB_Call  VALUES(100,203,47,2,TO_DATE ('2/10/2018' , 'MM/DD/YYYY'),'')	;

-----------------------------------------------------------------------------------------------------------------------
--TABLE NB_Topic
INSERT INTO NB_Topic  VALUES(1,'New Costumer');
INSERT INTO NB_Topic  VALUES(2,'Re-order');
INSERT INTO NB_Topic  VALUES(3,'New-order');
------------------------------------------------------------------------------------------------------------------------
--Table NB_Order
INSERT INTO NB_Order  VALUES(301,1,205,TO_DATE ('11/1/2017' , 'MM/DD/YYYY'),2,100,1.2,120)	;
INSERT INTO NB_Order  VALUES(302,16,203,TO_DATE ('11/2/2017' , 'MM/DD/YYYY'),1,200,1,200)	;
INSERT INTO NB_Order  VALUES(303,57,204,TO_DATE ('11/3/2017' , 'MM/DD/YYYY'),1,150,1,150)	;
INSERT INTO NB_Order  VALUES(304,96,201,TO_DATE ('11/4/2017' , 'MM/DD/YYYY'),2,500,1.2,600)	;
INSERT INTO NB_Order  VALUES(305,73,205,TO_DATE ('11/5/2017' , 'MM/DD/YYYY'),3,350,1.3,455)	;
INSERT INTO NB_Order  VALUES(306,62,204,TO_DATE ('11/6/2017' , 'MM/DD/YYYY'),1,600,1,600)	;
INSERT INTO NB_Order  VALUES(307,80,202,TO_DATE ('11/7/2017' , 'MM/DD/YYYY'),3,550,1.3,715)	;
INSERT INTO NB_Order  VALUES(308,45,201,TO_DATE ('11/8/2017' , 'MM/DD/YYYY'),2,700,1.2,840)	;
INSERT INTO NB_Order  VALUES(309,30,203,TO_DATE ('11/9/2017' , 'MM/DD/YYYY'),3,650,1.3,845)	;
INSERT INTO NB_Order  VALUES(310,35,204,TO_DATE ('11/10/2017' , 'MM/DD/YYYY'),1,800,1,800)	;
INSERT INTO NB_Order  VALUES(311,6,202,TO_DATE ('11/11/2017' , 'MM/DD/YYYY'),2,200,1.2,240)	;
INSERT INTO NB_Order  VALUES(312,88,205,TO_DATE ('11/12/2017' , 'MM/DD/YYYY'),3,100,1.3,130)	;
INSERT INTO NB_Order  VALUES(313,75,205,TO_DATE ('11/13/2017' , 'MM/DD/YYYY'),1,600,1,600)	;
INSERT INTO NB_Order  VALUES(314,44,201,TO_DATE ('11/14/2017' , 'MM/DD/YYYY'),3,800,1.3,1040)	;
INSERT INTO NB_Order  VALUES(315,87,203,TO_DATE ('11/15/2017' , 'MM/DD/YYYY'),2,600,1.2,720)	;
INSERT INTO NB_Order  VALUES(316,39,202,TO_DATE ('11/16/2017' , 'MM/DD/YYYY'),1,300,1,300)	;
INSERT INTO NB_Order  VALUES(317,74,204,TO_DATE ('11/17/2017' , 'MM/DD/YYYY'),3,500,1.3,650)	;
INSERT INTO NB_Order  VALUES(318,97,205,TO_DATE ('11/18/2017' , 'MM/DD/YYYY'),3,700,1.3,910)	;
INSERT INTO NB_Order  VALUES(319,82,201,TO_DATE ('11/19/2017' , 'MM/DD/YYYY'),1,300,1,300)	;
INSERT INTO NB_Order  VALUES(320,26,201,TO_DATE ('11/20/2017' , 'MM/DD/YYYY'),2,400,1.2,480)	;
INSERT INTO NB_Order  VALUES(321,15,205,TO_DATE ('11/21/2017' , 'MM/DD/YYYY'),3,800,1.3,1040)	;
INSERT INTO NB_Order  VALUES(322,3,203,TO_DATE ('11/22/2017' , 'MM/DD/YYYY'),3,1000,1.3,1300)	;
INSERT INTO NB_Order  VALUES(323,84,202,TO_DATE ('11/23/2017' , 'MM/DD/YYYY'),1,500,1,500)	;
INSERT INTO NB_Order  VALUES(324,52,204,TO_DATE ('11/24/2017' , 'MM/DD/YYYY'),2,450,1.2,540)	;
INSERT INTO NB_Order  VALUES(325,86,201,TO_DATE ('11/25/2017' , 'MM/DD/YYYY'),3,850,1.3,1105)	;
INSERT INTO NB_Order  VALUES(326,49,202,TO_DATE ('11/26/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(327,59,205,TO_DATE ('11/27/2017' , 'MM/DD/YYYY'),1,800,1,800)	;
INSERT INTO NB_Order  VALUES(328,13,204,TO_DATE ('11/28/2017' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(329,66,203,TO_DATE ('11/29/2017' , 'MM/DD/YYYY'),2,200,1.2,240)	;
INSERT INTO NB_Order  VALUES(330,5,201,TO_DATE ('11/30/2017' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(331,94,202,TO_DATE ('12/1/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(332,32,205,TO_DATE ('12/2/2017' , 'MM/DD/YYYY'),1,800,1,800)	;
INSERT INTO NB_Order  VALUES(333,55,203,TO_DATE ('12/3/2017' , 'MM/DD/YYYY'),3,900,1.3,1170)	;
INSERT INTO NB_Order  VALUES(334,31,204,TO_DATE ('12/4/2017' , 'MM/DD/YYYY'),3,1200,1.3,1560)	;
INSERT INTO NB_Order  VALUES(335,4,202,TO_DATE ('12/5/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(336,20,201,TO_DATE ('12/6/2017' , 'MM/DD/YYYY'),1,300,1,300)	;
INSERT INTO NB_Order  VALUES(337,25,205,TO_DATE ('12/7/2017' , 'MM/DD/YYYY'),2,700,1.2,840)	;
INSERT INTO NB_Order  VALUES(338,85,202,TO_DATE ('12/8/2017' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(339,100,204,TO_DATE ('12/9/2017' , 'MM/DD/YYYY'),3,200,1.3,260)	;
INSERT INTO NB_Order  VALUES(340,46,201,TO_DATE ('12/10/2017' , 'MM/DD/YYYY'),1,900,1,900)	;
INSERT INTO NB_Order  VALUES(341,76,202,TO_DATE ('12/11/2017' , 'MM/DD/YYYY'),3,1000,1.3,1300)	;
INSERT INTO NB_Order  VALUES(342,2,203,TO_DATE ('12/12/2017' , 'MM/DD/YYYY'),2,1200,1.2,1440)	;
INSERT INTO NB_Order  VALUES(343,34,205,TO_DATE ('12/13/2017' , 'MM/DD/YYYY'),1,800,1,800)	;
INSERT INTO NB_Order  VALUES(344,7,204,TO_DATE ('12/14/2017' , 'MM/DD/YYYY'),3,300,1.3,390)	;
INSERT INTO NB_Order  VALUES(345,9,201,TO_DATE ('12/15/2017' , 'MM/DD/YYYY'),1,700,1,700)	;
INSERT INTO NB_Order  VALUES(346,41,203,TO_DATE ('12/16/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(347,21,205,TO_DATE ('12/17/2017' , 'MM/DD/YYYY'),2,400,1.2,480)	;
INSERT INTO NB_Order  VALUES(348,77,202,TO_DATE ('12/18/2017' , 'MM/DD/YYYY'),3,500,1.3,650)	;
INSERT INTO NB_Order  VALUES(349,61,204,TO_DATE ('12/19/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(350,12,201,TO_DATE ('12/20/2017' , 'MM/DD/YYYY'),1,400,1,400)	;
INSERT INTO NB_Order  VALUES(351,98,201,TO_DATE ('12/21/2017' , 'MM/DD/YYYY'),1,1200,1,1200)	;
INSERT INTO NB_Order  VALUES(352,71,203,TO_DATE ('12/22/2017' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(353,22,204,TO_DATE ('12/23/2017' , 'MM/DD/YYYY'),1,300,1,300)	;
INSERT INTO NB_Order  VALUES(354,63,202,TO_DATE ('12/24/2017' , 'MM/DD/YYYY'),3,700,1.3,910)	;
INSERT INTO NB_Order  VALUES(355,58,205,TO_DATE ('12/25/2017' , 'MM/DD/YYYY'),2,400,1.2,480)	;
INSERT INTO NB_Order  VALUES(356,11,205,TO_DATE ('12/26/2017' , 'MM/DD/YYYY'),3,200,1.3,260)	;
INSERT INTO NB_Order  VALUES(357,51,201,TO_DATE ('12/27/2017' , 'MM/DD/YYYY'),3,800,1.3,1040)	;
INSERT INTO NB_Order  VALUES(358,47,203,TO_DATE ('12/28/2017' , 'MM/DD/YYYY'),1,1000,1,1000)	;
INSERT INTO NB_Order  VALUES(359,95,202,TO_DATE ('12/29/2017' , 'MM/DD/YYYY'),1,500,1,500)	;
INSERT INTO NB_Order  VALUES(360,17,204,TO_DATE ('12/31/2017' , 'MM/DD/YYYY'),2,450,1.2,540)	;
INSERT INTO NB_Order  VALUES(361,48,205,TO_DATE ('1/1/2018' , 'MM/DD/YYYY'),3,850,1.3,1105)	;
INSERT INTO NB_Order  VALUES(362,43,201,TO_DATE ('1/2/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(363,60,202,TO_DATE ('1/3/2018' , 'MM/DD/YYYY'),1,800,1,800)	;
INSERT INTO NB_Order  VALUES(364,91,205,TO_DATE ('1/4/2018' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(365,28,203,TO_DATE ('1/5/2018' , 'MM/DD/YYYY'),2,200,1.2,240)	;
INSERT INTO NB_Order  VALUES(366,81,204,TO_DATE ('1/6/2018' , 'MM/DD/YYYY'),1,400,1.4,560)	;
INSERT INTO NB_Order  VALUES(367,69,202,TO_DATE ('1/7/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(368,64,201,TO_DATE ('1/8/2018' , 'MM/DD/YYYY'),1,800,1.8,1440)	;
INSERT INTO NB_Order  VALUES(369,83,205,TO_DATE ('1/9/2018' , 'MM/DD/YYYY'),3,900,1.3,1170)	;
INSERT INTO NB_Order  VALUES(370,99,205,TO_DATE ('1/10/2018' , 'MM/DD/YYYY'),2,800,1.2,960)	;
INSERT INTO NB_Order  VALUES(371,24,204,TO_DATE ('1/11/2018' , 'MM/DD/YYYY'),3,300,1.3,390)	;
INSERT INTO NB_Order  VALUES(372,65,203,TO_DATE ('1/12/2018' , 'MM/DD/YYYY'),3,700,1.3,910)	;
INSERT INTO NB_Order  VALUES(373,90,201,TO_DATE ('1/13/2018' , 'MM/DD/YYYY'),1,600,1,600)	;
INSERT INTO NB_Order  VALUES(374,27,202,TO_DATE ('1/14/2018' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(375,54,201,TO_DATE ('1/15/2018' , 'MM/DD/YYYY'),2,500,1.2,600)	;
INSERT INTO NB_Order  VALUES(376,92,203,TO_DATE ('1/16/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(377,10,201,TO_DATE ('1/17/2018' , 'MM/DD/YYYY'),3,900,1.3,1170)	;
INSERT INTO NB_Order  VALUES(378,23,203,TO_DATE ('1/18/2018' , 'MM/DD/YYYY'),1,1000,1,1000)	;
INSERT INTO NB_Order  VALUES(379,42,204,TO_DATE ('1/19/2018' , 'MM/DD/YYYY'),2,1200,1.2,1440)	;
INSERT INTO NB_Order  VALUES(380,56,202,TO_DATE ('1/20/2018' , 'MM/DD/YYYY'),3,800,1.3,1040)	;
INSERT INTO NB_Order  VALUES(381,72,205,TO_DATE ('1/21/2018' , 'MM/DD/YYYY'),2,300,1.2,360)	;
INSERT INTO NB_Order  VALUES(382,50,205,TO_DATE ('1/22/2018' , 'MM/DD/YYYY'),1,700,1,700)	;
INSERT INTO NB_Order  VALUES(383,93,201,TO_DATE ('1/23/2018' , 'MM/DD/YYYY'),2,200,1.2,240)	;
INSERT INTO NB_Order  VALUES(384,18,203,TO_DATE ('1/24/2018' , 'MM/DD/YYYY'),1,400,1,400)	;
INSERT INTO NB_Order  VALUES(385,40,202,TO_DATE ('1/25/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(386,33,205,TO_DATE ('1/26/2018' , 'MM/DD/YYYY'),2,800,1.2,960)	;
INSERT INTO NB_Order  VALUES(387,53,204,TO_DATE ('1/27/2018' , 'MM/DD/YYYY'),3,1200,1.3,1560)	;
INSERT INTO NB_Order  VALUES(388,67,203,TO_DATE ('1/28/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(389,78,201,TO_DATE ('1/29/2018' , 'MM/DD/YYYY'),1,300,1,300)	;
INSERT INTO NB_Order  VALUES(390,38,202,TO_DATE ('1/30/2018' , 'MM/DD/YYYY'),1,700,1,700)	;
INSERT INTO NB_Order  VALUES(391,79,201,TO_DATE ('2/1/2018' , 'MM/DD/YYYY'),3,400,1.3,520)	;
INSERT INTO NB_Order  VALUES(392,68,203,TO_DATE ('2/2/2018' , 'MM/DD/YYYY'),2,200,2,400)	;
INSERT INTO NB_Order  VALUES(393,19,204,TO_DATE ('2/3/2018' , 'MM/DD/YYYY'),3,800,1.3,1040)	;
INSERT INTO NB_Order  VALUES(394,14,202,TO_DATE ('2/4/2018' , 'MM/DD/YYYY'),2,400,2,800)	;
INSERT INTO NB_Order  VALUES(395,8,205,TO_DATE ('2/5/2018' , 'MM/DD/YYYY'),3,200,1.3,260)	;
INSERT INTO NB_Order  VALUES(396,36,205,TO_DATE ('2/6/2018' , 'MM/DD/YYYY'),2,400,1.2,480)	;
INSERT INTO NB_Order  VALUES(397,89,201,TO_DATE ('2/7/2018' , 'MM/DD/YYYY'),3,600,1.3,780)	;
INSERT INTO NB_Order  VALUES(398,37,203,TO_DATE ('2/8/2018' , 'MM/DD/YYYY'),2,800,1.2,960)	;
INSERT INTO NB_Order  VALUES(399,29,202,TO_DATE ('2/9/2018' , 'MM/DD/YYYY'),1,900,1,900)	;
INSERT INTO NB_Order  VALUES(400,70,204,TO_DATE ('2/10/2018' , 'MM/DD/YYYY'),1,800,1,800)	;

------------------------------------------------------------------------------------------------------

--TABLE  NB_Product
INSERT INTO NB_Product VALUES(1,'Potato Chips',0.55,1);
INSERT INTO NB_Product VALUES(2,'Corn Chips',0.65,1.2);
INSERT INTO NB_Product VALUES(3,'Sweet Potato Chips',0.75,1.3);

-------------------------------------------------------------------------------------------------------
--TABLE NB_Sales_Associate

INSERT INTO NB_Sales_Associate VALUES(201,'Peter','Parker','610-589-7458','[email protected]');
INSERT INTO NB_Sales_Associate VALUES(202,'Clark','Kent','987-548-2543','[email protected]');
INSERT INTO NB_Sales_Associate VALUES(203,'Barry','Allen','598-578-6589','[email protected]');
INSERT INTO NB_Sales_Associate VALUES(204,'Bruce ','Wayne','256-489-2147','[email protected]');
INSERT INTO NB_Sales_Associate VALUES(205,'Bruce ','Banner','895-247-5142','[email protected]');







--I had to errors ; I do not have idea that what is wrong
--Error report ora-22291 integrity constraint (call_sales_Associate_FK )
--violated -parent key not found

----
--Error 2
--Error report ora-22291 integrity constraint (order_Product_FK )
--violated -parent key not found

Is This A Good Question/Topic? 0
  • +

Replies To: Foreign key errors- oracle SQL

#2 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6735
  • View blog
  • Posts: 27,712
  • Joined: 12-December 12

Re: Foreign key errors- oracle SQL

Posted 26 November 2017 - 12:17 AM

You have almost 500 lines there, so which lines cause the errors?

If, for some reason, you cannot obtain this information then break the code down and run it in blocks until you narrow down the issue(s).

"integrity constraint (call_sales_Associate_FK )
--violated -parent key not found"
Do you not understand what this is telling you? "parent key not found" is quite clear.
Was This Post Helpful? 1
  • +
  • -

#3 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7397
  • View blog
  • Posts: 15,329
  • Joined: 16-October 07

Re: Foreign key errors- oracle SQL

Posted 26 November 2017 - 09:34 AM

View PostNardilla, on 25 November 2017 - 08:32 PM, said:

--Error report ora-22291 integrity constraint (call_sales_Associate_FK )
--violated -parent key not found

Let's just consider this one. First, find that key:
ALTER TABLE NB_Call
ADD CONSTRAINT Call_Sales_Associate_FK FOREIGN KEY
(Sales_Person_ID) REFERENCES NB_Sales_Associate (Sales_Person_ID);



So, what would cause that contraint to be violated? The error is pretty self explanitory, but now that we know the tables involved, we can track it down.

Oh, look, you're calling inserts to NB_Call before you call any inserts to NB_Sales_Associate. So here
INSERT INTO NB_Call  VALUES(1,202,10,1,TO_DATE ('11/1/2017' , 'MM/DD/YYYY'),'Call next month')	;



You are inserting with a Sales_Person_ID of 202. Since NB_Sales_Associate is still empty, well, you see what happens.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1