db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamatha Kodigehalli Venkatesh" <Mamatha.Venkat...@ness.com>
Subject derby trigger --- after insert
Date Thu, 05 Aug 2010 11:52:43 GMT
Hello ,

 

Here are my 2 tables tidlrblt and  tidlggls.

 

I want to insert an record into tidlggls table as soon as an record is inserted into tidlrblt
table using a trigger.

 

But currently the trigger gls_blt_trg is able to insert into tidlggls table only when an existing
record is updated in tidlrblt table.

 

CREATE TABLE tidlrblt 

  ( 

     blt_number   INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY
1),

     blt          VARCHAR(4000) NOT NULL, 

     size         INTEGER NOT NULL, 

     min_max_size INTEGER NOT NULL,

     CONSTRAINT blt_pk PRIMARY KEY (blt_number)

);

 

 

 

CREATE TABLE tidlggls 

  ( 

     blt_number       INTEGER DEFAULT 0 NOT NULL,

     min_max_size     INTEGER DEFAULT 0 NOT NULL,

     create_date      CHAR (8) NOT NULL, 

     glossary_status  CHAR (2) NOT NULL, 

     application_ver  CHAR (8) NOT NULL, 

     time_stamp       CHAR (26) NOT NULL

  );

 

 

CREATE TRIGGER gls_blt_trg

AFTER UPDATE ON tidlrblt

REFERENCING OLD AS UPDATEDROW

FOR EACH ROW

INSERT INTO tidlggls1(blt_number,create_date, glossary_status,

    time_stamp,min_max_size,application_ver )

VALUES (UPDATEDROW.blt_number, CURRENT_DATE, '00' , CURRENT_TIMESTAMP, UPDATEDROW.min_max_size,'7.0.1');

 

Thanks

Mamatha

 


Mime
View raw message