Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How are params updated with a Before trigger?

3 posts in AEP Last posting was on 2006-07-24 14:22:24.0Z
James Relyea Posted on 2006-07-22 14:36:52.0Z
Reply-To: "James Relyea" <jrelyea@verizon.net>
From: "James Relyea" <jrelyea@verizon.net>
Newsgroups: Advantage.AEP
Subject: How are params updated with a Before trigger?
Date: Sat, 22 Jul 2006 10:36:52 -0400
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
NNTP-Posting-Host: 141.150.108.237
Message-ID: <44c23724@solutions.advantagedatabase.com>
X-Trace: 22 Jul 2006 08:33:08 -0700, 141.150.108.237
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!141.150.108.237
Xref: solutions.advantagedatabase.com Advantage.AEP:511
Article PK: 1103799

My goal is to use a Before Trigger, but I'm failing.

I am now using Instead Of triggers with something like the example below,
and it's working
...
x=(select paramName from __new);
do some calculations on the field
...
insert into TheTableName (FieldName) values (MyNewValue)

Below is what I tried with the Before Triggers, but it's failing on me:
...
do some calculations
...
update __new set FieldName=ANewValue <<-- this generates errors.


Does anyone know where I can find a Before trigger update statement?

Thanks


Jeremy Mullin Posted on 2006-07-24 14:22:24.0Z
Date: Mon, 24 Jul 2006 14:22:24 +0000 (UTC)
Message-ID: <886edc15167e48c87d116d41667f@devzone.advantagedatabase.com>
From: Jeremy Mullin <no@email.com>
Subject: Re: How are params updated with a Before trigger?
Newsgroups: Advantage.AEP
References: <44c23724@solutions.advantagedatabase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=iso-8859-1; format=flowed
X-Newsreader: JetBrains Omea Reader 928.2
NNTP-Posting-Host: 10.24.38.116
X-Trace: 24 Jul 2006 08:18:39 -0700, 10.24.38.116
Lines: 38
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.38.116
Xref: solutions.advantagedatabase.com Advantage.AEP:516
Article PK: 1103803

Hi James,

I believe your implementation using an INSTEAD OF trigger is the correct
way to accomplish this task, unless your calculations do not affect wheter
the record is written to disk or not (meaning there is no condition that
causes an error on purpose so that the record update is cancelled).

If you don't need your calculation to cancel the record post, you could use
an AFTER trigger to do your calculations and update the record. That is usually
easier because you only need to update the field(s) you are modifying, as
opposed to having to write an UPDATE statement that specifies all fields
(like you have to in an INSTEAD OF UPDATE trigger).

J.D. Mullin
Advantage R&D

> My goal is to use a Before Trigger, but I'm failing.
>
> I am now using Instead Of triggers with something like the example
> below,
> and it's working
> ...
> x=(select paramName from __new);
> do some calculations on the field
> ...
> insert into TheTableName (FieldName) values (MyNewValue)
> Below is what I tried with the Before Triggers, but it's failing on
> me:
> ...
> do some calculations
> ...
> update __new set FieldName=ANewValue <<-- this generates errors.
> Does anyone know where I can find a Before trigger update statement?
>
> Thanks
>


Joachim Duerr (ADS Support) Posted on 2006-07-24 08:01:21.0Z
From: "Joachim Duerr (ADS Support)" <jojo.duerr@gmx.de>
Subject: Re: How are params updated with a Before trigger?
Newsgroups: Advantage.AEP
References: <44c23724@solutions.advantagedatabase.com>
Organization: iAnywhere
User-Agent: XanaNews/1.18.1.2
X-Face: ,QMv7[luB)BpWAQ~:"kw6n%0ieY63.:g2K3n~8ky0;||5Xle*Xq+=~<Fy:0CVC2nx@8~vZ
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 195.2.185.25
Message-ID: <44c47041@solutions.advantagedatabase.com>
Date: 24 Jul 2006 01:01:21 -0700
X-Trace: 24 Jul 2006 01:01:21 -0700, 195.2.185.25
Lines: 11
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!195.2.185.25
Xref: solutions.advantagedatabase.com Advantage.AEP:513
Article PK: 1103804


James Relyea wrote in <44c23724@solutions.advantagedatabase.com>:

> My goal is to use a Before Trigger, but I'm failing.

you can't use a BEFORE Trigger to update the actual record.

--
Joachim Duerr
Senior Product Support Analyst (Advantage Database Server)
iAnywhere Solutions / Extended Systems
advantage[AT]extendsys.de