Re: Adding Constraints

From: Marwan Samra <marwansamara_at_msn.com>
Date: 12 Mar 2002 10:09:25 -0800
Message-ID: <70d9d132.0203121009.4347b221_at_posting.google.com>


"Bob Swerdlow" <swerdlow_at_maine.rr.com> wrote in message news:<9i7j8.6674$26.619241_at_typhoon.maine.rr.com>...
> I cannot figure out how to add a constraint to an existing table.
>
> For example, I have a table with an "id" field that should have been created
> as the primary key but was not. The documentation seems to indicate that I
> can do:
>
> ALTER TABLE MyTable MODIFY(id INTEGER PRIMARY KEY);
>
> but this results in:
> ERROR at line 1:
> ORA-02253: constraint specification not allowed here
>
The above command is used to modify a column format or length with some rules (Ex. if data already exists, and the length of the column values).

> In other cases I want to add a REFERENCES constraint, but they all produce
> an error similar to this.
>
> Thanks for your help!
If you do have data in the table. Make sure that the Primary key rules are met. (Ex. Unique, and Not Null). Received on Tue Mar 12 2002 - 19:09:25 CET

Original text of this message