To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 12-11-2002, 03:32 PM
curlydog curlydog is offline
Junior Member
 
Join Date: Dec 2002
Posts: 6
Angry Referential Integrity

Apologies for the simplicity of this question, but it's driving me mad.

Can anyone tell me what is wrong with this sql statement.

create table Quote(quoteID varchar(10) primary key, customerID varchar(10) references Customer on delete restrict on update cascade, quoteDate date not null)

Yes the table Customer already exists. I've taken out "on delete restrict on update cascade" and the table is created, so obviously this part is causing the problem but I can't see why.

The error I'm getting is that a keyword is missing.

TIA
Curlydog
Reply With Quote
  #2  
Old 12-11-2002, 04:35 PM
skhanal skhanal is offline
Experts
 
Join Date: Nov 2002
Location: New Jersey, USA
Posts: 3,369
What is your DBMS?. If it is SQL Server, "Restrict" is not supported.
Reply With Quote
  #3  
Old 12-12-2002, 03:09 AM
curlydog curlydog is offline
Junior Member
 
Join Date: Dec 2002
Posts: 6
It's an Oracle database. I am aware that some do not support "restrict" & "Delete". I was told that "triggers" are used and that it was ok to use restrict & delete.

The work I'm doing is part of a university course and our instructors have told us to use restrict & delete. I thought that perhaps there was a problem with the structure of my statement, although I can't see what.
Reply With Quote
  #4  
Old 12-13-2002, 09:26 AM
edorne edorne is offline
Junior Member
 
Join Date: Dec 2002
Posts: 3
I had the same problem (i was using Oracle 8.1.7) and had to figure it out by myslef looking through documentation (which btw sucks for Oracle). Anyways the answer is as following (if yours behaves the same way as oracle 8.1.7):

by DEFAULT the "on delete restrict" option is used in Oracle. In other words if you try to delete a parent record, and the primary key of that record is accessed by the foreign key(s) of any children, the application will not allow you to delete that parent record EVEN if you do not have any constraints explicitly written . You must write something like ON DELETE CASCADE (or other referential integity constraints) if you wish to delete a parent record refernced by children records. Otherwise if you want to have on delete restrict just leave this message out , and the system will take care of that for you.
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:15 AM.


DatabaseJournal Recent Articles


 » Searching and Sorting Strings in Oracle

 » Preparing To Upgrade Access Tables to SQL ...

 » Sun Expands MySQL With Closed Source

 » Microsoft Demos New SQL Server Features at...

 » Wipro and Oracle Launch First Joint Innova...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.