Home » SQL & PL/SQL » SQL & PL/SQL » constraints
constraints [message #9361] Thu, 06 November 2003 00:50 Go to next message
lok
Messages: 4
Registered: November 2003
Junior Member
is UNIQUE is a constrints?

if so how can i alter table

SQL> desc station;
Name Null? Type
------------------------------- -------- ----
STATION NOT NULL VARCHAR2(20)
TWO_L VARCHAR2(2)
THREE_L NOT NULL VARCHAR2(3)

on the col station.

thanks for kond co-operation.
Re: constraints [message #9365 is a reply to message #9361] Thu, 06 November 2003 01:19 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Yes it is a constraint type.

Again, an ALTER TABLE will help you out:
ALTER TABLE your_table ADD CONSTRAINT your_constraint_name UNIQUE(your_column);
Remember, the column should already contain unique values. If you want to create the constraint and you have duplicate values, you can add the 'DISABLE' keyword. That way, the constraint will be created but in a disabled state. Now you can modify the values until they are unique, and enable the constraint by...alter table your_table enable constraint constraint_name.

MHE
Previous Topic: Installing 9i
Next Topic: Deadlock while deletion/updation of a particular table
Goto Forum:
  


Current Time: Sat Apr 27 00:03:55 CDT 2024