我创建了一个.bat文件来执行这些行的过程:
echo off
sqlplus username/password@databasename
set heading off
set feedback off
BEGIN
AML.DO_ACCOUNT_AML() ;
COMMIT
END;
/
exit;
!
。它只能连接到数据库,但无法执行查询。
答案 0 :(得分:0)
我将SQL / SQL * Plus命令分离到一个单独的脚本:
myscript.sql:
set heading off
set feedback off
BEGIN
AML.DO_ACCOUNT_AML() ;
COMMIT
END;
/
让批处理脚本只处理控制流:
myscript.bat:
echo off
sqlplus username/password@databasename @myscript.sql
!
答案 1 :(得分:0)
两个步骤(正如您所知):批处理脚本+ SQL脚本。
批量脚本
sqlplus scott/tiger@orcl @run_proc.sql
SQL脚本(run_proc.sql)
set serveroutput on
begin
p_test;
end;
/
exit
存储过程
create or replace procedure p_test is
begin
dbms_output.put_line('Hello!');
end;
/
在OS命令提示符下运行runme.bat
会产生以下结果:
M:\>runme
M:\>sqlplus scott/tiger@orcl @run_proc.sql
SQL*Plus: Release 11.2.0.1.0 Production on Sri Lip 13 11:28:00 2018
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
hello
PL/SQL procedure successfully completed.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
M:\>
显然,它有效。现在,您可以使用不同的设置(回声,反馈,等等),但是 - 通常,就是这样。