码迷,mamicode.com
首页 > 其他好文 > 详细

ORCALE 增加两列字段

时间:2017-04-28 10:35:26      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:count   ice   table   comm   alt   bsp   exe   column   arc   


declare v_cnt number;
 V_SQL VARCHAR2 (500) := ‘‘;
begin
 select count(*) into v_cnt from dual where exists(SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME = UPPER(‘TB_FDN_DEVICEACCOUNT‘) AND COLUMN_NAME = ‘NSBFL‘);
   if v_cnt = 0 then
    V_SQL := ‘ALTER TABLE TB_FDN_DEVICEACCOUNT ADD NSBFL NVARCHAR2(50)‘;
    EXECUTE IMMEDIATE V_SQL;
    V_SQL := ‘comment on column TB_FDN_DEVICEACCOUNT.NSBFL is ‘‘原设备分类‘‘‘;
    EXECUTE IMMEDIATE V_SQL;
end if;
 select count(*) into v_cnt from dual where exists(SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME = UPPER(‘TB_FDN_DEVICEACCOUNT‘) AND COLUMN_NAME = ‘NSBLX‘);
   if v_cnt = 0 then
    V_SQL := ‘ALTER TABLE TB_FDN_DEVICEACCOUNT ADD NSBLX NVARCHAR2(50)‘;
    EXECUTE IMMEDIATE V_SQL;
    V_SQL := ‘comment on column TB_FDN_DEVICEACCOUNT.NSBLX is ‘‘原设备类型‘‘‘;
    EXECUTE IMMEDIATE V_SQL;
end if;
end;

ORCALE 增加两列字段

标签:count   ice   table   comm   alt   bsp   exe   column   arc   

原文地址:http://www.cnblogs.com/daimaxuejia/p/6780125.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!