-- sorry, it looks so like the assemble language struct
-- when power not enough, or memory capacity not enough, or other reasons
delete from table1 where id='123456789'
-- @@ERROR is a global error variable, it will err when its variable is not 0
if @@ERROR!=0 goto catch
-- do something, when all are right.
-- after do something, you should go to do final thing
goto finally
catch:
print 'an exception has occured!'
finally:
print 'do something finally'