I'm not clear why you need the character string, but...
SELECT ROUND(123.456, 2) FROM RateTbl;
will return you the (DECIMAL) value 123.46. If you really want it to be
returned as a string, then I suppose you can do:
SELECT ROUND(123.456, 2) || "" FROM RateTbl;
Using the first version and selecting the data into a string variable will
produce a string anyway, and it will be clearer and quicker (and it's what
I'd do):
SELECT ROUND(123.456, 2)
INTO string_variable
FROM RateTbl;
There is an assumption here -- either you are declaring cursors to process
each row in turn or there is a single row in RateTbl. Just nit-picking;
I recognize that what was sent was an example. :-)
Incidentally, the ROUND (and TRUNC) functions are in the manual -- Informix
Guide to SQL: Syntax Version 7.1, p1-564 and thereabouts.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: "Stefan P. Romankiw" <SRomankiw@ExecRisk.com>
>Date: Wed, 11 Sep 1996 13:43:09 -0400
>X-Informix-List-Id: <list.11326>
>
>We are running OnLine 7.12. I am looking for a way to convert a numeric
>to a character. The query would look something like this:
>
>Select string(123.456,2) from ratetbl;
>
>Where :
>123.456 is the value to convert
>2 is the scaling factor
>
>The result of this query would be '123.46'.
>
>Any thoughts?