日期:2014-05-16  浏览次数:20441 次

修改字段信息

?

?

--添加ID字段
alter table UTDICTIONARYT_TEMP drop column ID;
alter table UTDICTIONARYT_TEMP add ID number;
--创建存储过程
CREATE OR REPLACE PROCEDURE TEST_TEMPINFO is
    cursor 
        crs_ut 
    is 
        select * from utdictionaryt_temp for update;
        var_index_id NUMBER;
BEGIN
         var_index_id := 1;
         FOR r_ut in crs_ut LOOP
             UPDATE utdictionaryt_temp SET id = var_index_id WHERE current of crs_ut;
             var_index_id := var_index_id + 1;
          END LOOP;
END;
/
COMMIT;
execute test_tempinfo;
commit;
--添加主键
alter table UTDICTIONARYT_TEMP add constraint utdictionaryT_TEMP_1001 primary key (ID);
commit;

?