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 PROTECTED]               http://www.ocs.cz
private         [EMAIL PROTECTED]             http://www.ocs.cz/oc



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to