no....you are asking about transactions in a database...this must all occur in one segment of code..
begin trans
insert
if insert fails
rollback
else
commit
end if
end trans
also be aware that not all databases support transactions. check your DB documentation for specifics.
hth
Bastien