Help - Search - Members - Calendar
Full Version: I am new to databases and i have a problem with sql
Oracle DBA Forums > Oracle > Oracle Forum
dbaman11
hi,
i am new to database and i am taking a course right now in it. we have a project and i have created the schema on notepad and while pasting it i faced some problems.
my table that i had a problem with is
create Table holder
(
HoldId NUMBER(4) CONSTRAINT holder_holdid_pk PRIMARY KEY,
htype CHAR(10) CONSTRAINT holder_htype_nn NOT NULL CONSTRAINT holder_htype_ck CHECK ((htype='Mother') or (htype='Father') or (htype='Sister') or (htype='Brother') or (htype='Son') or (htype='Daughter') or (htype='Wife') or (htype='Husband')),
custId CHAR(3) customer_custId_fk REFERENCES customer (custId)
);

here are the problems i faced:
error at line 3:
ora-00911

on the other hand when i didnt copy the table and paste in sql (i typed the same table inside sql immediately) i had a different error which is:
error at line 2:
ora-00922: missing or invalid option
thanks for your help.
jal
Hi,
You have a keyword missing the following will work

create Table holder
(
HoldId NUMBER(4) CONSTRAINT holder_holdid_pk PRIMARY KEY,
htype CHAR(10) CONSTRAINT holder_htype_nn NOT NULL CONSTRAINT holder_htype_ck CHECK ((htype='Mother') or (htype='Father') or (htype='Sister') or (htype='Brother') or (htype='Son') or (htype='Daughter') or (htype='Wife') or (htype='Husband')),
custId CHAR(3) constraints customer_custId_fk REFERENCES customer (custId)
)

and make sure you don't have any other characters at the end of the statement.








QUOTE (dbaman11 @ Jun 28 2008, 01:53 PM) *
hi,
i am new to database and i am taking a course right now in it. we have a project and i have created the schema on notepad and while pasting it i faced some problems.
my table that i had a problem with is
create Table holder
(
HoldId NUMBER(4) CONSTRAINT holder_holdid_pk PRIMARY KEY,
htype CHAR(10) CONSTRAINT holder_htype_nn NOT NULL CONSTRAINT holder_htype_ck CHECK ((htype='Mother') or (htype='Father') or (htype='Sister') or (htype='Brother') or (htype='Son') or (htype='Daughter') or (htype='Wife') or (htype='Husband')),
custId CHAR(3) customer_custId_fk REFERENCES customer (custId)
);

here are the problems i faced:
error at line 3:
ora-00911

on the other hand when i didnt copy the table and paste in sql (i typed the same table inside sql immediately) i had a different error which is:
error at line 2:
ora-00922: missing or invalid option
thanks for your help.
dbaman11
QUOTE (dbaman11 @ Jun 28 2008, 12:53 PM) *
hi,
i am new to database and i am taking a course right now in it. we have a project and i have created the schema on notepad and while pasting it i faced some problems.
my table that i had a problem with is
create Table holder
(
HoldId NUMBER(4) CONSTRAINT holder_holdid_pk PRIMARY KEY,
htype CHAR(10) CONSTRAINT holder_htype_nn NOT NULL CONSTRAINT holder_htype_ck CHECK ((htype='Mother') or (htype='Father') or (htype='Sister') or (htype='Brother') or (htype='Son') or (htype='Daughter') or (htype='Wife') or (htype='Husband')),
custId CHAR(3) customer_custId_fk REFERENCES customer (custId)
);

here are the problems i faced:
error at line 3:
ora-00911

on the other hand when i didnt copy the table and paste in sql (i typed the same table inside sql immediately) i had a different error which is:
error at line 2:
ora-00922: missing or invalid option
thanks for your help.




Thanks for your help. it was useful
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.