0
我有以下使用BTEQ执行Teradata存储过程的shell脚本。存储过程返回一个名为BATCH_KEY的varchar。您能否解释如何:在Teradata BTEQ脚本中捕获存储过程输出
捕获存储过程的输出在BTEQ脚本中?将输出传递给shell脚本?让shell脚本自己返回输出值?
echo "Check if number of parameters is correct"
if [ "$#" -ne 4 ]; then
echo "You must enter exactly 4 command line arguments"
exit 0
fi
echo "Call bash profile"
source ~/.bash_profile
echo "Setting parameters value for the stored procedure"
in_P_BATCH_OWNER=$1
in_P_ACTION=$2
in_P_START_DATETIME=$3
in_P_END_DATETIME=$4
echo "Logging into Teradata"
Server=server
LoginId=user
Password=password
DbName=db
echo "Calling stored procedure"
bteq<<EOF
.logon ${Server}/${LoginId},${Password};
CALL $DbName.SP_AUDIT_BATCH('$in_P_BATCH_OWNER', '$in_P_ACTION', '$in_P_START_DATETIME', '$in_P_END_DATETIME');
.logoff;
.quit;
EOF
if [ $? == 0 ]
then
echo "Script executed sucessfully"
exit 1
else
echo "Script executed with failure"
exit 0
fi