Home  >  Article  >  Database  >  exec 和 call 用法详解

exec 和 call 用法详解

WBOY
WBOYOriginal
2016-06-07 17:46:052456browse

exec 和 call 用法详解

exec 和 call 执行一个procedure时,

 declare
s_in     varchar2(30):= '   where   col=13 ' ';
v_sql_str       varchar2(200);
begin
  v_sql_str   :=   '   *   from   t1 '||s_in;
  execute   immediate   v_sql_str;
end;

exec是sqlplus的命令,只能在sqlplus中使用。


call是sql命令,任何工具都可以使用

CALL TRANSACTION ta { [AND SKIP FIRST SCREEN]   
                    | [USING bdc_tab [bdc_options]] }.  

先看例子:

CALL TRANSACTION 'FD01' USING bdc_tab [bdc_options].

继续深入:
CALL TRANSACTION 'FD01' USING IT_DATA MODE 'N' UPDATE 'S' MESSAGE INTO IT_MSG.
上例说明,调用了T-Code FD01,执行这个tcode所用的数据来自内表IT_DATA,mode参数使用'N',说明使用tcode的时候不显示该tcode屏幕,update参数使用'S',说明同步执行更新,最后执行成功与否的message,会插入内表中。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn