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



Create table Employee ( Employee_Id varchar2(8) Constraint emp_id_pk primary key, FirstName var..

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

Create table Employee ( Employee_Id varchar2(8) Constraint emp_id_pk primary key, FirstName var..

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

Post New Answer

More Oracle General Interview Questions

What is the difference between a hot backup and a cold backup in oracle?

0 Answers  


What is the parameter mode that can be passed to a procedure?

0 Answers  


How to define and use table alias names in oracle?

0 Answers  


Select all the employees who were hired in last 2 years and who works in dept where max managers are working.

0 Answers   ESS,


How to view the tablespaces in the current database?

0 Answers  






what is the use of triggers in Java program? I mean where do we use triggers in Java programming?

0 Answers  


what is port in oracle? how is it related to database application.

0 Answers  


What is a trigger oracle?

0 Answers  


Is there a function to split a string in plsql?

0 Answers  


How to convert characters to numbers in oracle?

0 Answers  


What do you understand by a database object?

0 Answers  


What are different Oracle database objects?

1 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)