/**
* 描述:帮扶对象追加字段脚本
*/
DECLARE
num1 NUMBER;
num2 NUMBER;
BEGIN
SELECT COUNT(1) INTO num1 FROM cols
WHERE table_name = upper('T_ZZ_SUPPORT_OBJECT')
AND column_name = upper('creator_id');
SELECT COUNT(1) INTO num2 FROM cols
WHERE table_name = upper('T_ZZ_SUPPORT_OBJECT')
AND column_name = upper('create_time');
IF num1 < 1 THEN
execute immediate 'alter table T_ZZ_SUPPORT_OBJECT add creator_id NUMBER(9)';
END IF;
IF num2 < 1 THEN
execute immediate 'alter table T_ZZ_SUPPORT_OBJECT add create_time DATE';
END IF;
END;
/
COMMIT;
原文链接:https://www.f2er.com/oracle/210077.html