因此,我在plsql中创建了一个过程,但我希望在shellscript中自动执行它。例如,如果我使用CSV文件插入表,则该过程将使用Unix外壳脚本自动运行。我使用的软件是Cygwin。
rekjcdws1#
我在MS Windows上,不知道Unix,也从未使用过Cygwin,正如标签描述所说的那样,它是.....。在MS Windows上运行的GNU和其他类似Unix的自由/开源软件工具的集合
如果我理解正确的话,你就会
这是一个过程:
SQL> create or replace procedure p_test is 2 begin 3 dbms_output.put_line('Hello!'); 4 end; 5 /Procedure created.SQL>
SQL> create or replace procedure p_test is
2 begin
3 dbms_output.put_line('Hello!');
4 end;
5 /
Procedure created.
SQL>
.SQL脚本(其名称为run_proc.sql):
run_proc.sql
set serveroutput onbegin p_test;end;/exit;
set serveroutput on
begin
p_test;
end;
/
exit;
MS DOS批处理(.bat)脚本;其名称为run_proc.bat:
run_proc.bat
sqlplus scott/tiger@pdb1 @run_proc.sql
测试很简单-在MS DOS提示符下,调用批处理脚本:
c:temp>run_procc:temp>sqlplus scott/tiger@pdb1 @run_proc.sqlSQL*Plus: Release 21.0.0.0.0 - Production on Sun Sep 18 07:51:59 2022Version 21.3.0.0.0Copyright (c) 1982, 2021, Oracle. All rights reserved.Last Successful login time: Sat Sep 17 2022 17:43:08 +02:00Connected to:Oracle Database 21c Express Edition Release 21.0.0.0.0 - ProductionVersion 21.3.0.0.0Hello!PL/SQL procedure successfully completed.Disconnected from Oracle Database 21c Express Edition Release 21.0.0.0.0 - ProductionVersion 21.3.0.0.0c:temp>
c:temp>run_proc
c:temp>sqlplus scott/tiger@pdb1 @run_proc.sql
SQL*Plus: Release 21.0.0.0.0 - Production on Sun Sep 18 07:51:59 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Sat Sep 17 2022 17:43:08 +02:00
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Hello!
PL/SQL procedure successfully completed.
Disconnected from Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
c:temp>
1条答案
按热度按时间rekjcdws1#
我在MS Windows上,不知道Unix,也从未使用过Cygwin,正如标签描述所说的那样,它是...
..。在MS Windows上运行的GNU和其他类似Unix的自由/开源软件工具的集合
如果我理解正确的话,你就会
这是一个过程:
.SQL脚本(其名称为
run_proc.sql
):MS DOS批处理(.bat)脚本;其名称为
run_proc.bat
:测试很简单-在MS DOS提示符下,调用批处理脚本: