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 |
what are indexes..how many types of index's are there and what are they?
7 Answers Green Info Solutions, TCS,
In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?
What is backup in Oracle?
How to run queries on external tables?
What are temporal data types in oracle?
Difference between varchar and varchar2 data types?
Point the difference between translate and replace?
how to do daily transactions with out sql* loader control file regesterd in apps?
What is max rowid in oracle?
How do I know if oracle client is installed on windows?
Is a rollback possible to any savepoint?
What is snapshot is too old? Give and example for better understand.