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