脚本:陷阱ORA错误
while read -r records
do
sErrors=`sqlplus /<<EOF
WHENEVER SQLERROR EXIT SQL.SQLCODE;
select id from table where name='"$records"';
#if select succeeds then update
update table set name='xyz';
exit;
EOF`
if [[ $sErrors = "ORAsomenumber" ]]
then
echo "Failed for $records with error:$sErrors">>logfile.log
fi
done<file
我需要捕获特定的选择查询(即“没有内容”)或任何
数据库的具体错误的任何错误可能会发生在一个while循环的记录,并继续 没有退出,直到读取所有记录
Oracle版本的结尾:10.2.0.5.0
注意:它不是强制性的只获得特定的ORA错误,任何提示表明具体的数据库错误将是足够的
谢谢。
我固定的格式设置,但你恢复它。请在代码后删除段落中的缩进。 –
感谢David-SkyMesh – user1502952