Donnie Rakes wrote:
> Hey... I'm REAL NEW to this so bear with me...
> I've been trying to learn triggers for a few days
> and I'm stuck with this problem.I'm trying to create
> a trigger as described below.I get an SQL error that
> tells me that PONO has NOT been declared as a
> variable. It's actually a field in the "JEBDATA"."FAXPODEV"
> file that needs to be updated. I have no idea how
> to fix this. The UPDATE will work fine if I take
> out the SET N.PONO part. Any help would be
> appreciated and pointers on where to get some
> good literature :) BTW... what I've learned about
> triggers so far, I've learned from reading here.
>
> CREATE TRIGGER SETFAXPONO
> AFTER INSERT ON "JEBDATA"."FAXPODEV"
> REFERENCING NEW AS N
> FOR EACH ROW
> MODE DB2ROW
>
> BEGIN ATOMIC
> SET N.PONO = ( SELECT MAX(LSTFPO)
> FROM "JEBDATA"."STORESDEV"
> WHERE STORE# = 1);
> UPDATE "JEBDATA"."STORESDEV"
> SET LSTFPO = LSTFPO +1;
> END
>
> -----------------
> Donnie Rakes
>
> DB2 on AS/400
> Client Access V5R1
> Delphi 6 Enterprise
> dbExpress
>
>
>
Do you want the before trigger instead?