谢谢。
答案 0 :(得分:1)
创建一个xxxx.sql文件并执行它:
set serveroutput on;
execute STORED_PROCEDURE;
set serveroutput off;
exit
您需要一种方法来执行脚本,我在基于* nix的系统上使用CRON。我的脚本看起来像这样
#!/bin/sh
# This short shell script calls the XXXX Stored Procedure
# drive.
PATH=$PATH:/opt/oracle/local/bin:/usr/local/bin
export ORACLE_SID=XXXX;
export ORAENV_ASK=NO;
export TWO_TASK=XXXXXXXXX;
. /usr/local/bin/oraenv
sqlplus USERID/PASSWPRD @SQL_Script_to_call_stored_Proceudre.sql
exit
答案 1 :(得分:0)
以下是一个例子:
创建一个sh文件“callProcedureFromBash.sh”
#!/bin/bash this is a comment
#if you can access sqlplus already, you don't need following 2 lines
export ORACLE_HOME = /efs/dist/oracledb/client/10G/exec
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus "userid/password@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = WWW.YOURHOST.COM) (PORT = 12345) (CONNECT_DATA = (SID = HXZ524))))" <<END
DECLARE
a int;
BEGIN
packagename.Procedurename(a);
END;
/
commit;