On Fri, 2007-10-26 at 07:17 -0700, Omar Muñoz wrote:
> Hi.
> I have to deliver an unload-like file from a query
> with many DECIMAL data, but they require that numbers
> be rounded and be shown with no period. But when I use
> unload the final file shows "250.0" instead of "250",
> which is what they want.
> I didn't find anything about this issue in the SQL
> Reference (It just mentions that DECIMAL uses format
> #.# and INT uses #, but I'm afraid of getting overflow
> error if I convert query results in integer) or in que
> GLS Reference. I wonder if somebody can help me on
> this.
It would help if you mentioned the version of engine and/or operating
system and/or client language you're using, since that defines the set
of tools available to solve your problem. Conceivable solutions include:
* If your engine is sufficiently new, you could try to cast the decimal
column(s) to int8.
* Let the file be created by unload as it is now, and post-process the
fil with awk, sed, or perl to remove the decimals.
* Don't use unload at all and instead write a simple program in ESQL/C,
Python, Perl, Ruby, PHP, or whatever, to create the file in the format
you need.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net