Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 84294 invoked from network); 21 Jun 2010 08:57:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Jun 2010 08:57:02 -0000 Received: (qmail 74796 invoked by uid 500); 21 Jun 2010 08:57:02 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 74644 invoked by uid 500); 21 Jun 2010 08:56:59 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 74633 invoked by uid 99); 21 Jun 2010 08:56:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 08:56:58 +0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=AWL,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Mamatha.Venkatesh@ness.com designates 59.145.150.86 as permitted sender) Received: from [59.145.150.86] (HELO mail7.ness.com) (59.145.150.86) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 08:56:51 +0000 Received: from unknown (HELO INBLRNT11.ness.com) ([192.168.105.65]) by mail7.ness.com with ESMTP; 21 Jun 2010 14:26:25 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CB111F.85DC600D" Subject: URGENT HELP NEEDED: Trigger to update column of one table based on insert to an another table Date: Mon, 21 Jun 2010 14:26:26 +0530 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: URGENT HELP NEEDED: Trigger to update column of one table based on insert to an another table Thread-Index: AcsN34lnv99MqP61QOeaW6MreSulGAA6ybCQAJUy7yA= References: From: "Mamatha Kodigehalli Venkatesh" To: This is a multi-part message in MIME format. ------_=_NextPart_001_01CB111F.85DC600D Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, =20 Derby version =3D db-derby-10.5.1.1 =20 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=20 Where myTable .myTableID =3D targetable.MyTableID using a Trigger. =20 Please help me out on this. =20 CREATE TABLE myTable ( myTableID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, = INCREMENT BY 1), Name VARCHAR (50), size INTEGER NOT NULL); =20 INSERT INTO myTable (name,size) VALUES ('Jon231232', 9); INSERT INTO myTable (name,size) VALUES ('Mamatha', 7); INSERT INTO myTable (name,size) VALUES ('Star', 4); =20 =20 CREATE TABLE targetTable ( targetTableID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH = 1, INCREMENT BY 1), myTableID INTEGER NULL, size INTEGER); =20 Thanks Mamatha ------_=_NextPart_001_01CB111F.85DC600D Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello,

 

Derby version =3D 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 =3D 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

=
------_=_NextPart_001_01CB111F.85DC600D--