思路如下
DECLARE
tmp INTEGER;
BEGIN
SELECT COUNT(1) INTO tmp FROM SYS.ALL_TAB_COLS WHERE OWNER = 'SYSDBA' AND TABLE_NAME = '表名大写' AND COLUMN_NAME = '列名大写';
IF (tmp = 0) THEN EXECUTE IMMEDIATE '
ALTER TABLE SYSDBA.表名 ADD 列名 VARCHAR(50);
';END IF;
END;
网友评论