3. Statements : OpenROAD SQL Statements : Rollback Statement : Example—Rollback Statement
 
Share this page                  
Example—Rollback Statement
Back out a database statement:
insert into employees(salary, age)
     values(:salfield, :agefield);
if iierrornumber != 0 then
     message 'A bad thing happened.';
     rollback work;
endif;
/* Give the user a choice at close */
on terminate =
begin
     if CurFrame.ConfirmPopup(messagetext =
          'Commit database changes?') = PU_OK then
          commit work;
     else
          rollback work;
     endif;
end