Subject | Re: [firebird-support] problem with insert or update |
---|---|
Author | Antonio Galicia |
Post date | 2008-08-13T15:38:25Z |
On Wed, Aug 13, 2008 at 9:48 AM, calou_3324 <calou_3324@...> wrote:
your code and get:
Statement failed, SQLCODE = -104
invalid request BLR at offset 43
-generator CODECOMPTA_GEN is not defined
After I created "CODECOMPTA_GEN" all work ok and when do
SQL> update or insert into CODECOMPTA
ID
============
1
SQL> show trigger CODECOMPTA_ID;
Triggers on Table CODECOMPTA:
CODECOMPTA_ID, Sequence: 0, Type: BEFORE INSERT, Active
AS
begin
if ( (new.ID is null) or (new.ID = 0) )
then new.ID = gen_id(CODECOMPTA_GEN, 1);
end
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SQL>
--
Saludos,
PP
> CREATE TABLE CODECOMPTA...
> (
> );This is OK.
> SET TERM ^^ ;Do you have create the generator? Is the trigger generated? I Try
> CREATE TRIGGER CODECOMPTA_ID FOR CODECOMPTA ACTIVE BEFORE INSERT
> POSITION 0 AS
> begin
> if ( (new.ID is null) or (new.ID = 0) )
> then new.ID = gen_id(CODECOMPTA_GEN, 1);
> end
> ^^
> SET TERM ; ^^
your code and get:
Statement failed, SQLCODE = -104
invalid request BLR at offset 43
-generator CODECOMPTA_GEN is not defined
After I created "CODECOMPTA_GEN" all work ok and when do
SQL> update or insert into CODECOMPTA
> (ID,TYPE_DEPENSE,CODE_COMPTA,TYPE_MONTANT,SOCIETE)valuesget this:
> ('0','test','test','HT','VALOREM') returning(id);
ID
============
1
SQL> show trigger CODECOMPTA_ID;
Triggers on Table CODECOMPTA:
CODECOMPTA_ID, Sequence: 0, Type: BEFORE INSERT, Active
AS
begin
if ( (new.ID is null) or (new.ID = 0) )
then new.ID = gen_id(CODECOMPTA_GEN, 1);
end
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SQL>
--
Saludos,
PP