Re: Manipulating strings in SQL, SPL
Posted in 1997
Tin Zaw wrote: > > I am trying to do following in an Informix stroed procedure: > > DEFINE string CHAR(80); > DEFINE another CHAR(80); > DEFINE substring CHAR(4); > DEFINE number INT; > -- Copy first 4 characters from "string" to "substring" > -- convert "substring" to "number" (integer type) to do calculation > -- concatenate "substring" to "anotherstring" > > Are there any functions that manipulate strings and do type > conversions? A cc: will be much appreciated. Tin, these are mostly easy enough: let substring = string[1,4] -- Character positions 1 through 4 -- Calculations I don't know about let anotherstring = anotherstring || substring There, that's 2 out of 3. Luckily, you know exactly which character positions you needed. As of my current knowlege (release 7.2), SPL does not (yet) support a variable subscript in a string. eg. let xyz = string[m,n] where m and n are integer variables. -- -- Jake . . _..-'( )`-.._ ./'. '||\\\\. }\\_/{ .//||` .`\\. ./'.|'.'||||\\\\|.. )o o( ..|//||||`.`|.`\\. ./'..|'.|| |||||\\`````` \\'@'/ ''''''/||||| ||.`|..`\\. ./'.||'.|||| ||||||||||||. | .|||||||||||| ||||.`||.`\\. /'|||'.|||||| ||||||||||||{ | }|||||||||||| ||||||.`|||`\\ '.|||'.||||||| ||||||||||||{ | }|||||||||||| |||||||.`|||.` '.||| ||||||||| |/' ``\\||`` | ''||/'' `\\| ||||||||| |||.` |/' \\./' `\\./ \\!|\\ /|!/ \\./' `\\./ `\\| V V V }' `\\ /' `{ V V V \\ \\ \\ V / / / +-----------------------------------------------------------+ | Impeccable Logic: A thought process which successfully | | resists chicken bites | +-----------------------------------------------------------+