Oracle执行DDL语句结束后加/,打补丁把/换成GO

来源:互联网 发布:华为网络机顶盒怎么样 编辑:程序博客网 时间:2024/05/21 07:55

declare vCount1 int := 0;

       vCount2 int :=0;

begin

selectcount(1)into vCount1from user_all_Tableswhereupper(Table_Name) = upper('ZJZHBG');

  if(vCount1 >0 )then /*如果表存在才增加*/

   selectcount(1)into vCount2 from user_col_commentswhere upper(TABLE_NAME) = upper('ZJZHBG')and UPPER(COLUMN_NAME) = upper('ZJZHBG_NM');

   if(vCount2 >0 )then

     executeimmediate('alter table ZJZHBG modify(ZJZHBG_NMvarchar(36))');

                endif;

  endif;

end;

/

declare vCount1 int := 0;

       vCount2 int :=0;

begin

selectcount(1)into vCount1from user_all_Tableswhereupper(Table_Name) = upper('ZJZHBG');

  if(vCount1 >0 )then /*如果表存在才增加*/

   selectcount(1)into vCount2 from user_col_commentswhere upper(TABLE_NAME) = upper('ZJZHBG')and UPPER(COLUMN_NAME) = upper('ZJZHBG_ZHNM');

   if(vCount2 >0 )then

     executeimmediate('alter table ZJZHBG modify(ZJZHBG_ZHNMvarchar(36))');

                endif;

  endif;

end;

0 0