On Fri, Aug 5, 2011 at 11:11 AM, Ismael L. Donis Garcia <
[email protected]> wrote:

> I accomplish the following (I no if it will be OK )
>
> SET TERM ^ ;
> CREATE PROCEDURE P_NUM_REC (
>    VCH_ENTIDAD VARCHAR(7),
>    SIN_ALMACEN SMALLINT )
> RETURNS (
>    INT_NREC INTEGER )
> AS
> BEGIN
>  /* Update the number of the reception */
>  select a.no_r from vtaconteo a where ((a.entidad = :vch_entidad) and
> (a.almacen = :sin_almacen)) into :int_nrec;
>  update vtaconteo set no_r = no_r + 1 where ((vtaconteo.entidad =
> :vch_entidad) and (vtaconteo.almacen = :sin_almacen));
>  suspend;
> END^
> SET TERM ; ^
>

It will get update conflicts and serialize whatever operations you're doing.
 If you don't mind unnecessarily serializing inserts and dealing with update
conflicts, wonderful.  Why not use a generator and the returning clause?

Ann


[Non-text portions of this message have been removed]

Reply via email to