Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
Function |
Mon, Jun 1 2009 9:52 AM | Permanent Link |
Dieter Nagy | Hello,
please tell me if it possible to make a function without bindung to a table. I will try this: EXECUTE IMMEDIATE 'CREATE FUNCTION "Wochentag" (IN "IN" SMALLINT) RETURNS VARCHAR(10) COLLATE ANSI BEGIN DECLARE Result varchar; CASE ........... wHEN ..... THEN..... I will give back the name of the weekday with this function. Can anybody help me please. TIA Dieter NAgy |
Mon, Jun 1 2009 11:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dieter
Roy Lambert Dieter Nagy <dieter.nagy@tele2.at> wrote on Mon, 1 Jun 2009 09:52:33 -0400 >Hello, >please tell me if it possible to make a function without bindung to a table. Sure can eg FUNCTION "Demo" (IN "IN" SMALLINT) RETURNS VARCHAR(10) COLLATE ANSI BEGIN RETURN 'Works'; END Roy Lambert [Team Elevate] |
Mon, Jun 1 2009 12:12 PM | Permanent Link |
Dieter Nagy | Roy,
thanks for your answer, but how can I handle this: FUNCTION "Demo" (IN "IN" SMALLINT) <-------- My Input is for example 1 then I should get back 'Sunday' 2 then I should get back 'Monday' ........... Thanks Dieter Nagy . Roy Lambert wrote: Dieter Roy Lambert Dieter Nagy <dieter.nagy@tele2.at> wrote on Mon, 1 Jun 2009 09:52:33 -0400 >Hello, >please tell me if it possible to make a function without bindung to a table. Sure can eg FUNCTION "Demo" (IN "IN" SMALLINT) RETURNS VARCHAR(10) COLLATE ANSI BEGIN RETURN 'Works'; END Roy Lambert [Team Elevate] |
Mon, Jun 1 2009 1:05 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dieter
>My Input is for example 1 then I should get back 'Sunday' > 2 then I should get back 'Monday' That's a different question FUNCTION "Demo" (IN "IN" SMALLINT) RETURNS VARCHAR(10) COLLATE ANSI BEGIN DECLARE DoW VARCHAR; CASE WHEN IN = 1 THEN SET DoW = 'Monday'; WHEN IN = 2 THEN SET DoW = 'Tuesday'; WHEN IN = 3 THEN SET DoW = 'Wednesday'; WHEN IN = 4 THEN SET DoW = 'Thursday'; WHEN IN = 5 THEN SET DoW = 'Friday'; WHEN IN = 6 THEN SET DoW = 'Saturday'; WHEN IN = 7 THEN SET DoW = 'Sunday'; ELSE SET DoW = 'Unknown'; END CASE; RETURN DoW; I don't know if the integers represent the right days if EXTRACT(DAYOFWEEK..) is used Roy Lambert [Team Elevate] |
Mon, Jun 1 2009 11:42 PM | Permanent Link |
Dieter Nagy | Roy,
thanks for the answer. Dieter Nagy Roy Lambert wrote: Dieter >My Input is for example 1 then I should get back 'Sunday' > 2 then I should get back 'Monday' That's a different question FUNCTION "Demo" (IN "IN" SMALLINT) RETURNS VARCHAR(10) COLLATE ANSI BEGIN DECLARE DoW VARCHAR; CASE WHEN IN = 1 THEN SET DoW = 'Monday'; WHEN IN = 2 THEN SET DoW = 'Tuesday'; WHEN IN = 3 THEN SET DoW = 'Wednesday'; WHEN IN = 4 THEN SET DoW = 'Thursday'; WHEN IN = 5 THEN SET DoW = 'Friday'; WHEN IN = 6 THEN SET DoW = 'Saturday'; WHEN IN = 7 THEN SET DoW = 'Sunday'; ELSE SET DoW = 'Unknown'; END CASE; RETURN DoW; I don't know if the integers represent the right days if EXTRACT(DAYOFWEEK..) is used Roy Lambert [Team Elevate] |
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 |