Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5)
Constraint dept_id_fk Foreign Key(DeptId)
References Department(DeptId)
)
Error I am getting: Constraint specification are not
allowed here
Answers were Sorted based on User's Feedback
Answer / durgarao k
There are two ways in specifying constraints
Table level and Column level
In your question you specified Foreign key constraint as column level constraint.so, at that time you write as
Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5)
Constraint dept_id_fk
References Department(DeptId)
)
if you want to specify Foreign key constraint at table level
you just do as
Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5),
Constraint dept_id_fk Foreign Key(DeptId)
References Department(DeptId)
)
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / durgarao k
Create table Employee
(
Employee_Id varchar2(8) Constraint emp_id_pk primary key,
FirstName varchar2(50),
LastName varchar2(50),
DeptID Number(5),
Constraint dept_id_fk Foreign Key(DeptId)
References Department(DeptId)
)
| Is This Answer Correct ? | 1 Yes | 0 No |
how do u know the total no of rows in a table?
Will the Optimizer always use COST-based approach if OPTIMIZER_MODE is set to "Cost"?
How to use an explicit cursor without open statements?
How to find out what privileges a user currently has in oracle?
Can we create index on views?
19 Answers CTS, Syntel, TCS,
Iam learning oracle developer 2000.. can anyone give me then tutorials sites or PDF related to developer 2000 please send me the details @ mak2786@gmail.com thanks Arun
Explain the use of show option in imp command.
What is SYSTEM tablespace and When is it Created?
What is the difference between implicit index and explicit index?
Explain 1st, 2nd, 3rd normalization form of data base
How to define default values for formal parameters?
A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.