In the query (pl / sql), I need to filter only values with a fractional part. How can I do that?
4 answers
where ... and (value > floor(value) -- для положительных or (value < 0 and value < ceil(value)) -- для отрицательных )
Depending on the values in the column, the second condition may not be necessary.
- And regardless of the values, too. - alexlz
- @alexlz, reproof or confirmation? :-) Simply if the values in the column are positive (some amounts), then there is no sense to analyze the negative ones. And if there is, then the
floor
no longer fits & nbsp; & mdash; needceil
. - orkaan - one@orkaan why is the floor unsuitable for negative numbers? - alexlz
- @alexlz, thanks for your perseverance. ;) floor (5.9) - would return 5 floor (34.29) - would return 34 floor (-5.9) - would return -6 Therefore, really, the conditions
value > floor(value)
will suffice. - orkaan - @orkaan Please wear to health. - alexlz
|
It is possible, for example,
WHERE Ceil(val) != Floor(val);
|
You can write something like this:
SELECT SomeField FROM SomeTable WHERE SomeField - ROUND(SomeField) != 0
Smacks of some kind of a crutch, but I think it may well fit
|
So
where t.a_value - trunc(t.a_value) > 0
Or so
where mod(t.a_value,1) > 0
|