1 --1.旧表改名 2 ALTER TABLE APP_MULTI_PARAM_test RENAME TO APP_MULTI_PARAM_test_bk; 3 4 --2.创建新表 5 CREATE TABLE APP_MULTI_PARAM_test ( 6 ID VARCHAR2(64 CHAR)PRIMARY KEY, 7 PARAM_CODE VARCHAR2 ( 255 CHAR ) NOT NULL, 8 PARAM_NAME VARCHAR2 ( 150 CHAR) NOT NULL, 9 UPDATE_DATE DATE 10 ); 11 --表注释 12 COMMENT ON TABLE APP_MULTI_PARAM_test IS '多格式参数配置表'; 13 14 15 --3.创建触发器,实现旧数据导入自动插入UUID 16 CREATE OR REPLACE TRIGGER APP_MULTI_PARAM_test_bk 17 BEFORE INSERT ON APP_MULTI_PARAM_test 18 FOR EACH ROW 19 BEGIN 20 IF :NEW.ID IS NULL THEN 21 SELECT LOWER(SYS_GUID()) 22 INTO :NEW.ID 23 FROM DUAL; 24 END IF; 25 END; 26 / 27 28 --同步数据 29 INSERT INTO APP_MULTI_PARAM_test(PARAM_CODE, PARAM_NAME, UPDATE_DATE) 30 SELECT PARAM_CODE, PARAM_NAME, UPDATE_DATE FROM APP_MULTI_PARAM_test_bk; 31 commit; 32 33 34 --删除触发器 35 DROP TRIGGER APP_MULTI_PARAM_test_bk;