Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
newbie EDB FUNCTiON |
Thu, May 19 2011 5:30 PM | Permanent Link |
Adam Brett Orixa Systems | I am just feeling my way with functions & have a really simple one which returns NULL though I don't _think_ it should.
CREATE FUNCTION SeasonStartDate() RESULT DATE BEGIN DECLARE RESULT DATE DEFAULT CAST('2010-11-01' AS DATE); END ... I just want to be able to put the function call "SeasonStartDate()" into my SQL statements so I don't have to write out CAST('2010-11-01' as Date) every time & so when the next season starts I only have to change things in 1 place. However the above returns a null. Probably there is an easier way! -- More samples of functions & how to use them (I have looked through the EDB samples, which are really helpful) would be great, if anyone can point me at any. |
Fri, May 20 2011 2:10 AM | Permanent Link |
Ralf Bieber EDV Dienstleistungen Ralf Bieber | Adam Brett wrote:
> I am just feeling my way with functions & have a really simple one > which returns NULL though I don't think it should. > > CREATE FUNCTION SeasonStartDate() > RESULT DATE > BEGIN > DECLARE RESULT DATE DEFAULT CAST('2010-11-01' AS DATE); > END > Adam, use this: CREATE FUNCTION SeasonStartDate() RETURNS DATE BEGIN DECLARE RESULT DATE DEFAULT CAST('2010-11-01' AS DATE); Return Result; END Ralf |
Fri, May 20 2011 2:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Adam
Using RESULT lead you into thinking in Delphi terms where Result is the thing returned. Not so here - ALTER FUNCTION "SeasonStartDate" () RETURNS DATE BEGIN DECLARE RESULT DATE DEFAULT CAST('2010-11-01' AS DATE); RETURN RESULT; END Roy Lambert |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |