- From me Oracle Latest SQL Recall Walkthrough 11 blog post http://blog.csdn.net/luozhonghua2014/article/details/45729669
- Just re-publish once, is to extract experience, so that we can find a solution
--------Modify the field type of the existing data (the first 4 steps will cause the constraint in the table to be lost) --1 rename field ALTER TABLE example rename column ID to Sid; --2 Add ID field ALTER TABLE example add ID varchar2 ($); --3 Updating Data Update example set id = SID; --4 Delete the backup data field ALTER TABLE example drop column SID; --5 new constraint ALTER TABLE example ADD constraint exmaple_id primary key (ID); -----------------------------add constraint-------------------------------------- ALTER TABLE example add Unique (age); ALTER TABLE example drop unique (age); --Lookup Table uniqueness constraints (including name, constituent columns) Select column_name from user_cons_columns cu, user_constraints au where Cu.constraint_name = Au.constraint_name and cu.table_name = ' example ';
Oracle field (primary key) type modification method for processing existing data