Subject | Re: [firebird-support] Store Procedure for updating data, why it is need to commit? |
---|---|
Author | Josef Kokeš |
Post date | 2014-04-29T05:31:17Z |
> Hi guys,Yes.
>
> 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?You could perform a commit in the procedure (via EXECUTE STATEMENT
'commit'), but it's not a good idea - inside the procedure, you don't
know how much data you are committing (what was left uncommitted from
before calling the procedure).
You could also use autocommit (also not recommended).
Josef