oracle表中增加字段sql


declare v_Count1 int := 0;
v_Count2 int := 0;
begin
select count(1) into v_Count1 from user_all_tables where Upper(Table_Name) = Upper('LSZGZD');
if(v_Count1 > 0 ) then
select count(1) into v_Count2 from user_tab_cols where Upper(Table_name) = Upper('LSZGZD') and Upper(Column_Name) = Upper('LSZGZD_CODE');
if(v_Count2 <= 0 ) then
execute immediate('alter table LSZGZD add LSZGZD_CODE varchar2(36) ');
end if;
end if;
end;
go
declare v_Count1 int := 0;
v_Count2 int := 0;
begin
select count(1) into v_Count1 from user_all_tables where Upper(Table_Name) = Upper('LSZGZD');
if(v_Count1 > 0 ) then
select count(1) into v_Count2 from user_tab_cols where Upper(Table_name) = Upper('LSZGZD') and Upper(Column_Name) = Upper('LSZGZD_TYPE');
if(v_Count2 <= 0 ) then
execute immediate('alter table LSZGZD add LSZGZD_TYPE varchar2(240) ');
end if;
end if;
end;
go


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM