bat调用带参数存储过程

@bat调用sql文件

  sqlplus user/pass@orcl @F:\factory.sql

@将所有的存储过程封装在sql中

  factory.sql:exec pro_factory(&identifier,&param);

@pro_factory.pro存储过程封装所有的子存储过程,并设置参数identifier区分不同的存储过程

create or replace procedure pro_factory(identifier in number, param in varchar2) is
begin
  if identifier=0 then
    pro_1(param);
    pro_2(param);
    pro_3(param);
    elsif identifier=1  then pro_1(param);
    elsif identifier=2  then pro_2(param);
    elsif identifier=3  then pro_3(param);
    else
      dbms_output.put_line('存储过程编号不存在!');
  end if;
end pro_factory;
/

@&identifier是从bat设置的参数

这样就实现了bat设置多个存储过程参数并调用存储过程。

 

posted @ 2013-06-19 13:11  爱笑的狐狸  阅读(2469)  评论(0编辑  收藏  举报