>How to use transactions on a DBPROC?

>The reference manual don't show a valid example

>From our point of view transactions should not be started or ended inside 
>db-procedures,
instead transactions should be driven from outside a procedure.
This is why the <commit statement> and <rollback statement> is not supported
directly inside db-procedures. 
Instead a procedure call should behave like any other sql statement, i.e.
all or nothing should be executed. To achieve this goal a db-procedure
should be embedded inside a subtransaction, which should be rolled back
in case of an error. Please note, that these subtransactions are not 
generated automatically. Example :

CREATE DBPROC EXAMPLE AS
SUBTRANS BEGIN;
TRY
   /* your coding */
SUBTRANS END;
CATCH
SUBTRANS ROLLBACK;

If you don't share our point of view you have the possibility to end transactions
inside a db-procedure via dynamic sql :

CREATE DBPROC COMMIT AS
VAR 
   COMMIT_STATEMENT CHAR(20);
COMMIT_STATEMENT = 'COMMIT WORK';
EXECUTE COMMIT_STATEMENT;

Best Regards,
Thomas
 


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to