Help with triggers/FrontBase (was: sequential numbering across more instances)
Help with triggers/FrontBase (was: sequential numbering across more instances)
- Subject: Help with triggers/FrontBase (was: sequential numbering across more instances)
- From: Ondřej Čada <email@hidden>
- Date: Wed, 20 Aug 2008 14:40:02 +0200
Hello,
On Aug 16, 2008, at 3:52 AM, Ondřej Čada wrote:
Actually, the fun begins sooner I've supposed. Probably I just have
my dumb day today or should go to catch a Z or two, or should just
learn SQL thoroughly :), but I can't create a simplest trigger in
FrontBase :( Can someone please point me out to my mistake?
Well, I have found the culprit: since with FB the default is FOR EACH
STATEMENT, one must set explicitly FOR EACH ROW to make REFERENCING
work.
Though, solving that, I am stuck with another problem. For reference,
the following insert trigger works perfectly for me (to set the next
available number to ORDERNUMBER whenever a row is inserted; OID is the
PK, am working in extra table TEST for the moment):
CREATE TRIGGER test_insert AFTER INSERT ON TEST REFERENCING NEW x FOR
EACH ROW BEGIN update test set ordernumber=(SELECT MAX(ordernumber)
FROM test)+1 where oid=x.oid AND ordernumber=-1; END
On the other hand, the (more or less same) update trigger
CREATE TRIGGER test_update AFTER UPDATE ON TEST REFERENCING NEW x FOR
EACH ROW BEGIN update test set ordernumber=(SELECT MAX(ordernumber)
FROM test)+1 where oid=x.oid AND ordernumber=-1; END
causes an error
Exception 049. Expected TIME not found.
I'd be pretty grateful for any insight and/or advice how to solve the
problem.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden