General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 30th, 2004, 03:04 AM
sandra11 sandra11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 sandra11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question ORA-00922: missing or invalid option

Hi all,

I had encountered a problem when trying to create this table in Oracle 8i. Need professional views on this. Many thanks!

EXECUTE DBMS_OUTPUT.PUT_LINE('Creating Customer Table')
EXECUTE DBMS_OUTPUT.PUT_LINE('=======================')
CREATE SEQUENCE customer_id_seq
INCREMENT BY 1
START WITH 00000001
MAXVALUE 99999999
NOCACHE
NOCYCLE;
CREATE TABLE customer
(customer_id NUMBER(8) NOT NULL PRIMARY KEY,
customer_name CHAR(30) NOT NULL,
customer_NRIC CHAR(10) NOT NULL UNIQUE,
customer_address VARCHAR2(50) NOT NULL,
customer_email CHAR(30) NOT NULL,
customer_contact NUMBER(8) NOT NULL,
order_id NUMBER(8) NOT NULL,
CONSTRAINT customer_customer_id CHECK (customer_id between 00000001 and 99999999),
CONSTRAINT customer_order_id_fk FOREIGN KEY(order_id) references orders(order_id)on delete cascade));

The error is at the last line. It says - ERROR at line 10: ORA-00922: missing or invalid option
I can create the table without the foreign key constraint.

Reply With Quote
  #2  
Old November 30th, 2004, 07:46 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
CONSTRAINT customer_order_id_fk FOREIGN KEY(order_id) references orders(order_id)on delete cascade));

Should there be a space inbetween orders(order_id) and on

Reply With Quote
  #3  
Old December 1st, 2004, 01:32 AM
sandra11 sandra11 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 sandra11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I added the space but it still doesn't work. HELP!!!

Quote:
Originally Posted by MadCowDzz
CONSTRAINT customer_order_id_fk FOREIGN KEY(order_id) references orders(order_id)on delete cascade));

Should there be a space inbetween orders(order_id) and on

Reply With Quote
  #4  
Old December 2nd, 2004, 09:54 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
is your table orders already created?
and do the field types match?

try posting your updated code... a i suggest putting [ code ] tags (without the spaces) around it to preserve any indenting [it'll be easier for us to read].

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > ORA-00922: missing or invalid option


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway