Linux bash中存储过程的调用

在bash中调用存储过程,需要模拟sqlplus输入,通过<<管道与EOF结尾标识处理。

#!/bin/bash
user=aps2
passwd=aps2
sid=192.168.11.129/orcl

#there is no space before last EOF
function call_procedure()
{
value=`sqlplus -s /nolog << EOF
conn ${user}/${passwd}@${sid};
call $1;
quit;
EOF`;#此处的EOF不能有空格,之前我的就一直报需要EOF结束就是次原因
}

call_procedure 'P_S01_CORP_CUST_BASIC_INFO()'  #存储过程的名字作为参数数
call_procedure 'P_S05_LOAN_ACCT_FIN_EVT()'

猜你喜欢

转载自jilin.iteye.com/blog/2391949
今日推荐