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
Answer Posted / 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 |
Post New Answer View All Answers
Explain cascading triggers.
Explain the use of compress option in exp command.
How to define a cusotmer as a supplier in ORACLE R12
how to use select statement as formal parameter in procedure specification?(someone said that using string) ex:-procedure(a in number,select ename from emp ) i am asking syntax like this?
Can we commit inside a function in oracle?
What is the max number of columns in an oracle table?
What happens to the indexes if a table is recovered?
How to create a new table in your schema?
How to download oracle database 10g xe?
How is it different from a normal table?
What are the built-in functions used for sending Parameters to forms ?
In not less than 100 words what's the main difference between Rolap and Molap in ORACLE ?
How do we represent comments in oracle?
What is java oracle used for?
What is a subquery?