plsql批量导出procedure脚本

plsql批量导出procedure脚本 

plsql批量导出procedure脚本 

方法1.

PL/SQL Developer    menu: Tools -> Export User Objects + File per object / spec & body in a single file

方法2.Utl_File

create or replace directory BCCCGC as 'C:\log';

DECLARE

 File_Handle Utl_File.File_Type;

  Stor_Text   Varchar2(4000);

  n           Number;

  i           Number;

Begin

  For a In (Select object_Name As Name From User_Objects where Object_type= Upper('procedure') AND object_Name LIKE '%EBCAR%' ) Loop

 File_Handle := UTL_FILE.FOPEN('BCCCGC', a.name || '.txt', 'W');

 Select Max(Line) Into n From All_Source Where Owner = Upper( 'cb' ) And Name = a.name;

  While i <= n Loop

    Select Text Into Stor_Text From All_Source Where Owner = Upper( 'cb' ) And Name = a.name And Line = i;

    i := i + 1;

  Utl_File.Put_Line(File_Handle, Stor_Text);

  End Loop;

i := 1;

  Utl_File.Fclose(File_Handle);

  Commit;

  End Loop ;

END;

猜你喜欢

转载自kavinhub.iteye.com/blog/1979565