Informix 4GL INSERT statement with SERIAL
Posted in 2009
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi people, i have a "large" table with a SERIAL as pk. In I4GL i have
a record variable like this table, then i try to use insert statement
with the record.* but always fail because the pk (serial) is null, how
can i fix this ?
DEFINE lr_ope RECORD LIKE operaciones.*
--
LET lr_ope.ope_cod = NULL -- SERIAL FIELD (PK)
--
INSERT INTO operaciones VALUES (lr_ope.*)
-- Cannot insert a null into column (operaciones.ope_cod)
Thanks !!
Try initializing lr_ope.ope_cod to 0 instead of NULL.
On Mon, 16 Feb 2009 15:58:50 +0100, eferreyra <eferreyra@gmail.com> wrote:
> Hi people, i have a "large" table with a SERIAL as pk. In I4GL i have
> a record variable like this table, then i try to use insert statement
> with the record.* but always fail because the pk (serial) is null, how
> can i fix this ?
>
> DEFINE lr_ope RECORD LIKE operaciones.*
> --
>
> LET lr_ope.ope_cod = NULL -- SERIAL FIELD (PK)
> --
>
> INSERT INTO operaciones VALUES (lr_ope.*)
> -- Cannot insert a null into column (operaciones.ope_cod)>
> Thanks !!
>
It works! thank you!
On 16 feb, 13:05, ar <nos...@email.com> wrote:
> Try initializing lr_ope.ope_cod to 0 instead of NULL.
>
> On Mon, 16 Feb 2009 15:58:50 +0100, eferreyra <eferre...@gmail.com> wrote:
> > Hi people, i have a "large" table with a SERIAL as pk. In I4GL i have
> > a record variable like this table, then i try to use insert statement
> > with the record.* but always fail because the pk (serial) is null, how
> > can i fix this ?
>
> > DEFINE lr_ope RECORD LIKE operaciones.*
> > --
>
> > LET lr_ope.ope_cod = NULL -- SERIAL FIELD (PK)
> > --
>
> > INSERT INTO operaciones VALUES (lr_ope.*)
> > -- Cannot insert a null into column (operaciones.ope_cod)>
> > Thanks !!