UNABLE TO ADD PK CONSTRAINT TO A EXISTED COLUMN

109 views
Skip to first unread message

airfor...@gmail.com

unread,
Jun 20, 2012, 12:56:18 PM6/20/12
to idba-...@googlegroups.com
Hi Javid,

I am unable to add the primary key constraint to a existed column(which is not a PK).

Error starting at line 20 in command:
alter table
    pavan_employees
    add 
      (
        dept_no PRIMARY KEY
      )
Error report:
SQL Error: ORA-02263: need to specify the datatype for this column
02263. 00000 -  "need to specify the datatype for this column"
*Cause:    The required datatype for the column is missing.
*Action:   Specify the required datatype

Please suggest......

idba Javed

unread,
Jun 20, 2012, 1:38:20 PM6/20/12
to idba-...@googlegroups.com
Thanks for using this site.

You need to use this statement.

alter table pavan_employees
modify dept_no PRIMARY KEY;

Note that because no constraint name is provided, the constraint is automatically named by Oracle server.

Cheers!!
Reply all
Reply to author
Forward
0 new messages