using variables to index into substrings
Posted in 2000
Topics: General Discussion
All, I would *really* like to use variables to index substring arguments, but the Infomix 9 manual blithely states that only constants are allowed to be used to index substrings. Duh! e.g. something like: ....... DEFINE in_index INTEGER; DEFINE out_index INTEGER; DEFINE in_str CHAR(60); DEFINE out_str CHAR(4); ....... LET out_str[1] = in_str[1]; --should work LET out_str[out_index] = in_str[in_index]; --not allowed ....... Has anyone written DataBlade wrappers to the std C library for string handling routines like substr? many thanks, Andrew.
Andrew McPherson wrote: > All, > I would *really* like to use variables to index substring arguments, but the > Infomix 9 manual blithely states that only constants are allowed to be used > to index substrings. Duh! There is another UDR in 9.20, called SUBSTR(), that does take variable arguments. SELECT SUBSTR( W.Word, T1.OffSet, T2.OffSet ) FROM TABLE(SET{'Hello','There','my','little','chickadee' }::SET(LVARCHAR NOT NULL)) W ( Word ), TABLE(SET{1,2,3,4,5,6,7,8}::SET(INTEGER NOT NULL)) T1 ( OffSet ), TABLE(SET{1,2,3,4,5,6,7,8}::SET(INTEGER NOT NULL)) T2 ( OffSet ) WHERE T1.OffSet + T2.OffSet < Length(W.Word);