Unix Technical Forum

Query for decimal part

This is a discussion on Query for decimal part within the Informix forums, part of the Database Server Software category; --> Hi Everybody, I got a table with a column named amount of type decimal(26,8) . I need to make ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 07:29 PM
Francisco Roldan
 
Posts: n/a
Default Query for decimal part


Hi Everybody,
I got a table with a column named amount
of type decimal(26,8) .
I need to make a query to select the rows
with no-integers values on this column (amount).
I mean the rows with decimal part on its value.

Something like this :

select * from shclog
where get_decimals(amount) <> 0

Assuming that the function get_decimals return the
decimal part of the column amount.

Does exist a function like this ?

Thanks in advance
sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 07:29 PM
John Carlson
 
Posts: n/a
Default Re: Query for decimal part

On Thu, 21 Aug 2003 10:32:29 -0600, Francisco Roldan
<froldan@5b.com.gt> wrote:

>
>Hi Everybody,
>I got a table with a column named amount
>of type decimal(26,8) .
>I need to make a query to select the rows
>with no-integers values on this column (amount).
>I mean the rows with decimal part on its value.
>
>Something like this :
>
>select * from shclog
>where get_decimals(amount) <> 0
>
>Assuming that the function get_decimals return the
>decimal part of the column amount.
>
>Does exist a function like this ?
>


Well, not exactly, but this may do . . . . the trunc() frunction.

e.g.
select * from shclog
where (amount-trunc(amount)) = 0


amount is 57.95
trunc(amount) would be 57
difference would be 0.25

amount is 34.00
trunc(amount would be 34
difference would be 0
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 07:29 PM
Paul Watson
 
Posts: n/a
Default Re: Query for decimal part

I haven't tried it but

select *
from table
where decimal_col != decimal_col::INT

should work

Francisco Roldan wrote:
>
> Hi Everybody,
> I got a table with a column named amount
> of type decimal(26,8) .
> I need to make a query to select the rows
> with no-integers values on this column (amount).
> I mean the rows with decimal part on its value.
>
> Something like this :
>
> select * from shclog
> where get_decimals(amount) <> 0
>
> Assuming that the function get_decimals return the
> decimal part of the column amount.
>
> Does exist a function like this ?
>
> Thanks in advance
> sending to informix-list


--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:10 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com