On Aug 20, 2008, at 08:40, Ondřej Čada wrote:

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

Your update problem aside,

SELECT MAX(column) FROM table

will return null when there are no values yet for that column. I believe you need to do something like:

SELECT CASE WHEN MAX(column) IS NOT NULL THEN MAX(column) ELSE 0 END FROM table

F _______________________________________________
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