Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
Variable Character Literals |
Fri, Feb 21 2014 3:04 PM | Permanent Link |
Terry Swiers | I need to be able to append a character to a string by it's decimal representation within a EDB Script. I know that I can do the following using a literal value: DECLARE SomeVarChar VarChar; SET SomeVarChar = 'ABC' + #190; But I need to use a variable as I need to increment the value while walking through some data: DECLARE SomeVarChar VarChar; DECLARE NextChar Integer default 190; WHILE <some condition> THEN DO SET NextChar = NextChar + 1; SET SomeVarChar = 'ABC' + #NextChar; END WHILE; Is this possible? --------------------------------------- Terry Swiers Millennium Software, Inc. --------------------------------------- |
Sat, Feb 22 2014 11:38 PM | Permanent Link |
Barry | Unfortunately, no.
You could of course write your own functionm Chr(), based on this thread: http://www.elevatesoft.com/forums?action=view&category=edb&id=edb_sql&page=1&msg=4879#4879 for more info. This Chr(aPosition) function returns a VarChar(1) and declares a string with all possible characters: Declare AllChars Char(255) Default #1+#2+#3+#4 ... #250+#251+#252+#253+#254+#255; and does a: Return SubStr(AllChars, aPosition,1); to return the character at position aPosition (where aPosition is an integer parameter). It is a bit dorky, but doable. If aPosition is greater than 255, it returns an empty string. Others in this forum may find a faster way of doing it but this should work for the moment. You can always change the Chr() function later if you find something faster. Or you can write an extension to do it in Delphi which may be overkill. Barry |
Sun, Feb 23 2014 5:55 PM | Permanent Link |
Terry Swiers | Hi Barry,
> Unfortunately, no. OK. At least I wasn't missing something obvious. Went with a case statement to set the character value since I only had to deal with 20 or so entries. --------------------------------------- Terry Swiers Millennium Software, Inc. http://www.1000years.com http://www.atrex.com --------------------------------------- |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |