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 April 20th, 2004, 02:45 PM
cmezoom56 cmezoom56 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cmezoom56 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Newbie needs help creating database using SQL+ Worksheet

I'm trying to create my first database using SQL+ Worksheet for a CD collection. My first table, "artist", and 2nd table, "reclable" have only primary keys, no foreign key. The 3rd table, "catelog", is where I get stuck. When using this create statement:
CREATE TABLE Catelog
CatNum DECIMAL(4,0) primary key,
Title CHAR(50) not null,
Genre CHAR(2),
foreign key (labelcode) references reclabel,
check (CatNum > 0),
check (Genre in ('AR', 'BL', 'C', 'JZ', 'P', 'RB', 'RK', 'RP')))
;

I get this error:
foreign key (labelcode) references reclabel,
*
ORA-00904: invalid column name

labelcode IS a valid column name in reclabel. When using command: describe * reclabel
results are:
NAME
LABELCODE
LABELNAME

I don't understand what I'm doing wrong. I have a feeling I'm missing something very basic, but I don't know what it is. Please help before I pull out more hair that I can't afford to lose!

Thanking you in advance for your time.
Cheryl

Reply With Quote
  #2  
Old April 21st, 2004, 01:27 AM
dhananjayshetty dhananjayshetty is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 24 dhananjayshetty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 16 sec
Reputation Power: 0
Foreign Key

try this...........
create table catelog
(
LableCode char(4) not null,
CatNum number(4)primary key,
Title char(50) not null,
Genre char(2),
foreign key(LableCode) references Table2_name(reclable)
)
/

Reply With Quote
  #3  
Old April 21st, 2004, 03:48 AM
cmezoom56 cmezoom56 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cmezoom56 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you so much! That worked.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Newbie needs help creating database using SQL+ Worksheet


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 3 hosted by Hostway
Stay green...Green IT