🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #300

Re: trigger to get sum

#300
From: Bill Todd [TeamB]
Date: Sun, 18 May 2008 15:39
33 lines
2154 bytes
Isaac wrote:

> Ok thanks but how I can pass the current record value to the select
> parameter ?
>
A trigger executes when you make a change to a record in a table. You
can access all of the field values in the record that caused the
trigger to fire using the OLD and NEW context variables. In a before
insert trigger only the NEW values exist; in a before delete trigger
only the OLD values exist; in a before update trigger both the OLD and
NEW values exist. Assuming a before update trigger then OLD.FIELD1 is
the original value in FIELD1 and NEW.FIELD1 is the new value of FIELD1.
This is all explained in the Data Definition Guide.
 
> 
> - Which is better to let the trigger do this or to create a procedure
> and execute it ?

Since I have no idea what you are trying to do or when you are trying
to do it I do not know whether you should use a stored procedure or
trigger.

> 
> sorry but I cant find an answer in the manual

The OLD and NEW context variables are explained on page 10-8 of the
Data Definition Guide.




-- 
Bill Todd (TeamB)
Technical Details
Message-ID: <48304da8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail
References: <482f63f1$1@newsgroups.borland.com> <482f7efc@newsgroups.borland.com> <483029a4@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,c564685cdb1305db
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bill Todd [TeamB]" <no@no.com>
Subject: Re: trigger to get sum
Newsgroups: borland.public.interbase.sql
References: <482f63f1$1@newsgroups.borland.com> <482f7efc@newsgroups.borland.com> <483029a4@newsgroups.borland.com>
Organization: The Database Group, Inc.
User-Agent: XanaNews/1.18.1.9
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 76.208.40.243
Message-ID: <48304da8$1@newsgroups.borland.com>
Date: 18 May 2008 08:39:20 -0700
X-Trace: newsgroups.borland.com 1211125160 76.208.40.243 (18 May 2008 08:39:20 -0700)
Lines: 33
X-Authenticated-User: btodd
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail