what do you mean by last statement. ? Update statement is the last statement right. If the update is not running succesfully, it should go to SQLERROR label and exit with return code 50 right. correct me if am wrong.
and in my actual script , there is only 1 update statement. in this sample sript which i attached i have a create table statement and an update statement. If y]you are saying that 'create table' statement is the last statement that ran succesfully, then in my original script there is no create table statement. It just has an update statement with a missing colon and that error is not being caught.
Every SQL statement is termintated by a semicolon and this is missing before the 'IF', so the '.IF' is part of the UPDATE statement (I already wrote that in the 2nd copy of your question).
This is the actual statement sent to Teradata and it's obviously no valid syntax:
UPdate a from example.table1 a, example.table2 b
where a.GCI =b.GCI
.IF ERRORCODE <> 0 THEN .GOTO SQLERROR;
There's no '.IF' after this.