Using BEGIN ATOMIC will ensure the statements between BEGIN and END will execute completely or not at all. If there are many SQL statements between BEGIN ATOMIC and END and an error occurs in any of those statements, everything done to the database since the BEGIN ATOMIC will be undone.