dbTalk Databases Forums  

Re: Unloading a DECIMAL with no period

comp.databases.informix comp.databases.informix


Discuss Re: Unloading a DECIMAL with no period in the comp.databases.informix forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Carsten Haese
 
Posts: n/a

Default Re: Unloading a DECIMAL with no period - 10-26-2007 , 10:39 AM






On Fri, 2007-10-26 at 07:17 -0700, Omar Muņoz wrote:
Quote:
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




Reply With Quote
  #2  
Old   
Fernando Nunes
 
Posts: n/a

Default Re: Unloading a DECIMAL with no period - 10-26-2007 , 06:41 PM






Omar Muņoz wrote:
Quote:
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.

thanks in advance
Omar Muņoz.

P. By the way, I'm working with Informix 9.4 FC7.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
unload to temp_file.unl
select trunc(20.01)||"" from systables where tabid = 1;

It stinks, but for a one time job it will work on any version...
Regards.

--
Fernando Nunes
Portugal

http://informix-technology.blogspot.com
My email works... but I don't check it frequently...


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.