Subject RE: [firebird-support] Store Procedure for updating data, why it is need to commit?
Author Svein Erling Tysvær
>Hi guys,
>
>I have a simple stored procedure to update data, like this :
>
>SET TERM ^ ;
>CREATE PROCEDURE REG 
>AS
>BEGIN
>    UPDATE table a set a.field1 = '123';
>    exit;
>END^
>SET TERM ; ^
>
>When I run that procedure on flamerobin with this command:
>execute procedure Reg.
>
>It runs ok, but without a commit command, the field1 on table won't get update.
>I rarely use store procedure to do update / insert / delete, but is this a normal behavior?
>
>Is there any commands to add so commit is no needed?

Normally, it is the client that should decide whether something should be committed or rolled back. You wouldn't expect an update on a table to commit by itself, nor should you expect a stored procedure to do it.

I think it is possible to use code like

in autonomous transaction do
UPDATE table a set a.field1 = '123';

if you really want something to be committed immediately, but must admit I've never tried.

HTH,
Set