Sunday, 15 May 2011

sql - Removing all references from a tuple using Oracle/Access -


I have created a simple database using Oracle, which has several tables and some obstacles, I want to interact with the database I am using Access 2007. .

My problem is that I have a table called "customer" which holds many fields, especially a primary key called CUSTID.

I have an "order" which uses the primary key as "primary" in the primary key

Obviously, if I'm a customer being used in "order" If I try to delete, I get an error because it is being used that means I have to delete the special order that refers to the customer and then I can remove the customs record.

I know that "Cascade" should remove all the things associated with it, my question is how can I do this from access? My database has limited knowledge, but enough to make an etc

It is more of a recognized object, before I can remove anybody else, there is just one problem to remove some tuples.

This is a database created for Oracle:

 - "Clean" slate drop table item used to make cascade constructor; Drop Table Customer Cascade Consultants; Drop table corner cassettentants; Drop Table Platform Cascade Constructions; Table Item (ItemID Number (4) No NULL, Name CHAR (15) No NULL, Category CHAR (15) No NULL, Value Number (8) No NULL, Handicap ITEM_PK Primary Key (Itemid)); INSERT (1000, 'Carat Seeds', 'Packet Seeds', 2.99) in ITEMS Value; Insert item values ​​(2250, 'Ros', 'flower', 5.99); INSERT in Items Value (3300, 'Tomotose', 'Packet Seeds', 2.99); Include item values ​​(4050, 'gourmet', 'packet seeds', 1.99); (Client ID number table customer (4) No NULL, fName CHAR (10) No NULL, LNAME CHAR (10) No NULL, ADDRESS CHAR (40) No NULL, City CHAR (15) No NULL, PCODE CHAR (7) No Zero, number CNUMBER (11) noise, contract CUSTOMER_PK primary key (CUSTID)); Include in Customer Prices (1010, 'Jamie', 'Kelling', '149 Old Mansfield Road ',' Derry ',' DE214SA ', 07500966490); Insert in Customer Prices (2020, 'Helen', 'Darlington', '27 Morpark Avenue ',' Rockdale ',' All 113JQ ', 07890189802); Insert in Customer Prices (3030, 'Steven', 'Segal', '123 Folk Street', 'Ohio', 'S 090 BG', 01559345467); Customer values ​​include INSERT (4040, 'Bruce', 'Wayne', '17 lecrous crescent ',' Chicago, 'MN 432 BD, 07500966490); (4) No NULL, SHIPPCODE CHAR (7) No NULL, SHIPDATE Date, ItemID Number (4) No NULL, Quantity Number (4) No NULL, SHIPADD CHAR (40) No NULL, 3) No NULL, Total Number (8) No NULL, Obstacle ORDER_PK Primary Key (OrderID), FK_CUSTOMER Foreign Key (Customer ID), Reference Customer (Customer ID), Obstacle FK_ITEM Foreign Key Reference Item (Itemid) ; INSERT (10001010, '149 Old Mansial Road ',' DE214SA ', '12 -Jan-07', 1000,100,100.00) in the Corder Value; Include the order value ($ 2020, '27 MOORPARK Avenue ',' All 113 JQ ',' 04-Novi-10 ', 2250,200,100.00); INSERT (3000, 3030, '123 Folk Street', 'SE 095 BG', '30-OCT -08 ', 3300,150,100.00) in the Corder Value; INSERT (40004040, '17 lecrous crescent ',' MN 432 BD ',' 25-Jul-7 ', 4050,125,100.00) at the Cord value; Create table forums (FORUMID number (4) No NULL, title CHAR (30) No NULL, THREADNAME CHAR (30) No NULL, poster CHAR (20) No NULL, postdate, DATE, FORUM_PK primary key (FORUMID); Insert Forum Value (1001, 'General Chat', 'Beginner Question', 'Jamie Kelling', '25 -Nova-09'); Insert in Forum Values ​​(2002, 'OF TOPIC', 'FAYIVET BAND', 'HELLIN DARLINGTON', '12 -JAN-09 '); Include in Forum Value (3003, 'General Chat', 'Bulwest to?', 'Bruce Wayne', '02 -NOV-08 '); Insert form values ​​(4004, 'Off toxin', 'where do you live?', 'Steven Seal', '13 -JN-08 '); 

The following is the standard SQL method to create with Disley Cascade. I do not know that it supports access, but Oracle has support for Delight Cascade.

 change the table to add the foreign key to the cd. FK_CUSTOMER Reference Delete the cccad to the customer (custid) 

If you are re-creating the tables, you remove the cascade in the table creation details With foreign key can also define. I.e.

 constraint FK_CUSTOMER foreign key (customer ID) customer (customer ID) reference 

with this

 barrier FK_CUSTOMER foreign key (customer ID) reference Customer (Customer ID) on DELETE CASCADE 

No comments:

Post a Comment