Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with transactions

Status
Not open for further replies.

mynwo

Technical User
Jul 12, 2003
75
IN
Dear All,

I have IDS 9.3 on sun solaris 8. My database is created with buffered logging. I execute the below steps thgough a script / dbaccess.

begin work;

execute procedure 1;
execute procedure 2;

commit work;

The first procedure executes properly, but there is an error in the second one. I want my script to behave in such a way that if there is an error in second procedure
the first one should also rollback. I have also set the env variable DBACCNOIGN to 1, but still no luck. Appreciate ur reply.

Regards,

lloyd



 
have a look at the command

ON EXCEPTION

with which you can make your procedure do a rollback in case of an unwanted error.

You can also code an exception handler that way, so different errors result in different actions.

create procedure checktable()
returning integer;

DEFINE li_count integer;

ON EXCEPTION IN (-206)

RETURN -1;

END EXCEPTION;

-- Dummy-Select
-- if table does not exists error 206 is raised which
-- calls the exception block and returns -1 instead of
-- crashing with error
select count(*)
into li_count
from sometable;

RETURN 0;

end procedure;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top