Connecting Tech Pros Worldwide Help | Site Map

add constrain in exsiting table

karthickkuchanur's Avatar
Familiar Sight
 
Join Date: Dec 2007
Posts: 135
#1: Sep 5 '09
Please help me how rename my column and add contrain to my table

I have tried alter but i cant able to add constrain
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,500
#2: Sep 5 '09

re: add constrain in exsiting table


To rename a column in an existing table, the ALTER TABLE syntax is:

Expand|Select|Wrap|Line Numbers
  1.     ALTER TABLE table_name
  2.      RENAME COLUMN old_name to new_name;
note ---it supports Oracle 9i Release 2 onwards


to add a constraint try the following sample syntax
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE order_status2
  2. ADD CONSTRAINT order_status2_id_ck CHECK (id > 0);
Reply