Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Trying to Create tables

2fddb624-7170-40d0-8686-8962507bdc12Dec 16 2017 — edited Dec 16 2017

I'm trying to create these tables but for some reason the SC_CAR table gets an error saying "table or view doesn't exist". The other 2 table are perfectly fine to make and have no problems. I've remade them and tried to organize them in a different way but that doesn't work. Does anyone know what is wrong with the table?

create table SC_CAR(

CARSERIAL CHAR(8)

, CUSTNAME VARCHAR(20)

, make VARCHAR(10) NOT NULL

, model CHAR(2) NOT NULL

, caryear CHAR(4) NOT NULL

, extcolour VARCHAR(15)  NOT NULL

, trim VARCHAR(15) NOT NULL

, enginetype VARCHAR (10) NOT NULL

, baselistprice DECIMAL(10,2) NOT NULL

, PURCHINVNO CHAR(6)

, purchcost DECIMAL(10,2)

, CONSTRAINT pkcar PRIMARY KEY(CARSERIAL)

, CONSTRAINT fkcar1 FOREIGN KEY(CUSTNAME) REFERENCES SC_CUST(CUSTNAME)

, CONSTRAINT fkcar2 FOREIGN KEY(PURCHINVNO) REFERENCES SC_PURCHINV(PURCHINVNO));

create table SC_CUST(

CUSTNAME VARCHAR(20)

, custaddress VARCHAR(30) NOT NULL

, custcity VARCHAR(15) NOT NULL

, custprovince VARCHAR(10) NOT NULL

, custpostal CHAR(6) NOT NULL

, custhomephone CHAR(10) NOT NULL

, custworkphone CHAR(10)

, CONSTRAINT pkcust PRIMARY KEY(CUSTNAME));

create table SC_PURCHINV(

PURCHINVNO CHAR(6)

, purchasedfrom VARCHAR(20) NOT NULL

, purchdate DATE NOT NULL

, CONSTRAINT pkpurchinv PRIMARY KEY(PURCHINVNO));

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2018
Added on Dec 16 2017
3 comments
126 views