首页 > 代码库 > ORCALE 增加两列字段
ORCALE 增加两列字段
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 增加两列字段