db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamatha Kodigehalli Venkatesh" <Mamatha.Venkat...@ness.com>
Subject URGENT HELP NEEDED: Trigger to update column of one table based on insert to an another table
Date Mon, 21 Jun 2010 08:56:26 GMT
Hello,

 

Derby version = db-derby-10.5.1.1

 

I need to pick up the value of myTable.size as soon as the record is inserted and need to
update the targetable.size column 

Where myTable .myTableID = targetable.MyTableID using a Trigger.

 

Please help me out on this.

 

CREATE TABLE myTable (

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

Name     VARCHAR (50),

size INTEGER NOT NULL);

 

INSERT INTO myTable (name,size) VALUES ('Jon231232', 9);

INSERT INTO myTable (name,size) VALUES ('Mamatha', 7);

INSERT INTO myTable (name,size) VALUES ('Star', 4);

 

 

CREATE TABLE targetTable (

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

myTableID INTEGER NULL,

size INTEGER);

 

Thanks

Mamatha


Mime
View raw message