Re: String Functions
Posted in 1998
> I'm trying to find some convenience functions for strings and >text in INFORMIX such as >left (return the leftmost n characters) or right (return the rightmost n >characters). Anyone knows where I can find a list of all available >functions in INFORMIX? Good luck. But seriously, version 7.3 of Online Dynamic Server is supposed to have more functionality for the developer. However, we're using Informix 7.22 Online Workgroup Server under NT, and with it you can specify substrings of string columns. For instance, SELECT lname[1,5] FROM mytable This will return characters 1 thru 5 of column lname (assuming lname is character type). There is a LENGTH function, but I tried using it as part of the substring expression, but the SQL Editor kicked it back saying it wasn't syntactically correct. SELECT lname[LENGTH(lname) - 3, LENGTH(lname)] FROM mytable SELECT LENGTH(lname) AS temp_length, (LENGTH(lname) - 3) AS starting_position, lname[starting_position,temp_length] FROM mytable According to the manual, you have to use literal numbers between the square brackets [].