db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sushil Khekare" <Sushil.Khek...@symphonysv.com>
Subject RE: Counting subscribers
Date Wed, 28 Jun 2006 05:54:31 GMT
 I want to write a trigger for example here is what we wrote in mysql

Mysql
trigger*****************************************************************
*****

CREATE TRIGGER testcalc1 BEFORE INSERT ON emailworddtls
FOR EACH ROW BEGIN
DECLARE wId VARCHAR(255) DEFAULT '';
SELECT WMappingID into wId FROM wordmst where WMappingID =
NEW.WMappingID;
IF wId = '' THEN 
INSERT INTO wordmst (WMappingID, occurrenceinallemails)
VALUES(NEW.WMappingID,0);
END IF;
END;

************************************************************************
***********

I tried with following type in derby it works but what I am interested
in is use of variables like 'wId'.

Derby*******************************************************************
***********

CREATE TRIGGER testcalc after INSERT ON emailworddtls
REFERENCING new AS insertedrow
FOR EACH ROW mode db2sql
UPDATE wordmst SET occurrenceinallemails = occurrenceinallemails +
insertedrow.Occurrence where WMappingID = insertedrow.WMappingID;

************************************************************************
***********

Is it possible using derby?

Sushil

Mime
View raw message