我想知道如何撰寫一個訪問 oracle 資料庫的 shell 腳本并檢查之前執行的程序是否成功或回傳錯誤
uj5u.com熱心網友回復:
如果你想知道之前執行的程序(在不同的會話中?),你不能,除非結果以某種方式持續存在。Oracle 本身并不存盤有關每個程序呼叫的資訊。
如果您只想從 shell 腳本中立即運行并檢查存盤程序,這是一種標準模式,請使用whenever sqlerror/oserror子句:
sqlplus [connection_string] <<-EOF
whenever oserror exit failure;
whenever sqlerror exit failure;
exec [stored_procedure];
EOF
if [[ $? != 0 ]]; then
echo "Procedure failed!"
exit 1
fi
->參考
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/441828.html
上一篇:從納秒時間戳按天分組
