• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help with triggers/FrontBase (was: sequential numbering across more instances)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with triggers/FrontBase (was: sequential numbering across more instances)


  • Subject: Re: Help with triggers/FrontBase (was: sequential numbering across more instances)
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Wed, 20 Aug 2008 10:09:11 -0400


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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help with triggers/FrontBase (was: sequential numbering across more instances)
      • From: Francis Labrie <email@hidden>
References: 
 >sequential numbering across more instances (From: Ondřej Čada <email@hidden>)
 >Re: sequential numbering across more instances (From: Florijan Stamenkovic <email@hidden>)
 >Re: sequential numbering across more instances (From: Ondřej Čada <email@hidden>)
 >Re: sequential numbering across more instances (From: Chuck Hill <email@hidden>)
 >Re: sequential numbering across more instances (From: Guido Neitzer <email@hidden>)
 >Re: sequential numbering across more instances (From: Chuck Hill <email@hidden>)
 >Re: sequential numbering across more instances (From: Ondřej Čada <email@hidden>)
 >Re: sequential numbering across more instances (From: Chuck Hill <email@hidden>)
 >Re: sequential numbering across more instances (From: Mike Schrag <email@hidden>)
 >Re: sequential numbering across more instances (From: Chuck Hill <email@hidden>)
 >Re: sequential numbering across more instances (From: Alan Ward <email@hidden>)
 >Re: sequential numbering across more instances (From: Chuck Hill <email@hidden>)
 >Re: sequential numbering across more instances (From: Ondřej Čada <email@hidden>)
 >Help with triggers/FrontBase (was: sequential numbering across more instances) (From: Ondřej Čada <email@hidden>)

  • Prev by Date: Re: sequential numbering across more instances
  • Next by Date: Re: Help with triggers/FrontBase (was: sequential numbering across more instances)
  • Previous by thread: Help with triggers/FrontBase (was: sequential numbering across more instances)
  • Next by thread: Re: Help with triggers/FrontBase (was: sequential numbering across more instances)
  • Index(es):
    • Date
    • Thread