梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
create or replace PROCEDURE EMAIL_ADD
IS
CNT NUMBER;
BEGIN    
     FOR C IN (SELECT * FROM TAB WHERE TNAME LIKE 'EMAILS_%'  ORDER BY TNAME) LOOP
          SELECT COUNT(*) INTO CNT
            FROM USER_TAB_COLS
           WHERE TABLE_NAME = C.TNAME
             AND COLUMN_NAME = 'SEND_IP';
           IF CNT = 0 THEN
             EXECUTE IMMEDIATE ' ALTER TABLE '||C.TNAME||' ADD SEND_IP VARCHAR(15) '; 
             COMMIT;    
           END IF;           
          
           SELECT COUNT(*) INTO CNT
            FROM USER_TAB_COLS
           WHERE TABLE_NAME = C.TNAME
             AND COLUMN_NAME = 'SENDER';
           IF CNT = 0 THEN
             EXECUTE IMMEDIATE ' ALTER TABLE '||C.TNAME||' ADD SENDER VARCHAR(64) '; 
             COMMIT;    
           END IF;       
     END LOOP;
END;
posted on 2008-05-11 23:51 HUIKK 阅读(160) 评论(0)  编辑  收藏 所属分类: DataBase

只有注册用户登录后才能发表评论。


网站导航: