Archives of the TeradataForum
Message Posted: Thu, 08 Mar 2007 @ 12:38:34 GMT
To set a global trap on error level, the "set errorlevel" command should work. I don't know why it didn't work for you, perhaps you should post a short example that doesn't work.
Note that you must set maxerror *before* the query that is likely to fail.
.set maxerror 4 drop table blahblah;
will cause the script to abort if blahblah doesn't exist (at least it does for me).
drop table blahblah; .set maxerror 4
Will not cause the script to fail if blahblah doesn't exist. This is because the errorlevel trap isn't set until after the erroneous query.
Note also that this is a minimum setting. If the query fails with an "errorlevel" that is 1,2,3 or 4, then set maxerror 4 will not cause the script to abort. Only errorlevels 5 and above will cause the script to fail after a set errorlevel 4 command.
I hope this helps
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|