I'm new to DB2, and asking the database guy here, he says that we're running on an iSeries. Hopefully that will make sense to you...
My question is regarding a stored procedure that's kicking off a bunch of inserts, other stored procedures, etc. I need an example of how to implement a commit/rollback depending if any errors are thrown by the stored procedure (or any stored procedures within).
In the Create Procedure statement at the top of the sproc there's a ton of statments, most of which I don't understand and they're put there automatically when the procedure is created (I think). Included below is everything after any parameters would be listed, up to the first BEGIN:
DYNAMIC RESULT SETS 1
LANGUAGE SQL
SPECIFIC DBNAME.STOREDPROCEDURENAME
DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
SET OPTION ALWBLK = *ALLREAD ,
ALWCPYDTA = *OPTIMIZE ,
COMMIT = *ALL ,
DECRESULT = (31, 31, 00) ,
DFTRDBCOL = *NONE ,
DYNDFTCOL = *NO ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
After all the reading that I've done, I changed the bold COMMIT section above from *NONE to *ALL, but I'm not sure if this is needed for what I'm trying to accomplish.
Basically, when everything has processed what code is needed to know if all's successful or not? In SQL Server if @@error <> 0 then we KNOW that something's happened. What do I need for DB2? Examples would be nice too!
Thanks for your help.
SkydiverMN
