Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 2nd, 2004, 05:58 AM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Table Creation

Hello All,

I have two small problems when attemting to create the following tables:

#1

String orderT = "CREATE TABLE order " +
"(OID INTEGER(6) not null, " +
"CID INTEGER(6), " +
"EID INTEGER(6) not null, " +
"PID INTEGER(6) not null, " +
"WID INTEGER(6), " +
"number INTEGER(6) not null, " +
"issueDate date DEFAULT SYSDATE not null, " +
"paymentStatus VARCHAR2(25), " +
"deliveryStatus VARCHAR2(25), " +
"completionDate date " +
"PRIMARY KEY (OID))";

When I try to create this table I get an error that says "invalid table name". No ideas here.

#2

String storedAtT = "CREATE TABLE storedAt " +
"(PID INTEGER(6) not null, " +
"WID INTEGER(6) not null, " +
"numberStored INTEGER(6) DEFAULT 0 not null, " +
"PRIMARY KEY (PID, WID))";

When I try to create this table I get an error that says "missing right parenthesis". I have a feeling it is due to the DEFAULT 0 not null part.

Any help is appreciated!
Thanks

Chris

Reply With Quote
  #2  
Old May 2nd, 2004, 06:05 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 993 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 8 m 45 sec
Reputation Power: 66
ORDER is a reserved word!

You have to choose a different table name

Reply With Quote
  #3  
Old May 2nd, 2004, 06:34 AM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ta, should have picked that one up...

Now I get the "missing right parenthesis" for both queries.

Any Ideas?

Chris

Reply With Quote
  #4  
Old May 7th, 2004, 06:41 AM
modality modality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 18 modality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 27 sec
Reputation Power: 0
String orderT = "CREATE TABLE order
(OID INTEGER(6),
CID INTEGER(6),
EID INTEGER(6),
PID INTEGER(6),
WID INTEGER(6),
number INTEGER(6),
issueDate date DEFAULT SYSDATE,
paymentStatus VARCHAR2(25),
deliveryStatus VARCHAR2(25),
completionDate date
CONSTRAINT ORDER_PK PRIMARY KEY (OID),
CONSTRAINT ORDER_NN NOT NULL (EID, PID, NUMBER, ISSUEDATE)
);

From what i've been taught of Oracle, I would have thought it went like that ... but what do I know?

Also, I wouldn't have thought you'd create a primary key and also add a Not Null constraint, won't it already have that with it being a primary key?

Reply With Quote
  #5  
Old May 8th, 2004, 11:36 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 993 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 8 m 45 sec
Reputation Power: 66
You need a comma after completionDate date

And no, a primary key does not imply a NOT NULL. A pimary key only implies that the key values are unique.
One could image a situation where it might be interesting to flag certaing data with a PK that is NULL (but only one!)

Reply With Quote
  #6  
Old May 8th, 2004, 09:52 PM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Guys,

That was on the money but there was one more bug...

number is a reserved word!!

Cheers

Chris

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Table Creation


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 6 hosted by Hostway