dear members,
i am using Oracle db 10g
my query: how to separate whole number and fraction
e.g. if the figure is 1503.006 then the result should be like 1503 and 0.006
run script to load data.
CREATE TABLE tab_a
(wt NUMBER(10,3)
)
/
INSERT INTO tab_a
(WT)
VALUES
(1557.54)
/
INSERT INTO tab_a
(WT)
VALUES
(1556.653)
/
INSERT INTO tab_a
(WT)
VALUES
(1555.768)
/
INSERT INTO tab_a
(WT)
VALUES
(1554.883)
/
INSERT INTO tab_a
(WT)
VALUES
(1553.118)
/
INSERT INTO tab_a
(WT)
VALUES
(1552.236)
/
INSERT INTO tab_a
(WT)
VALUES
(1551.356)
/
INSERT INTO tab_a
(WT)
VALUES
(1550.476)
/
INSERT INTO tab_a
(WT)
VALUES
(1549.598)
/
COMMIT
/
SELECT a.wt, FLOOR(a.wt) fl, a.wt-FLOOR(a.wt) fraction
FROM tab_a a
/
here when i run this statement i get FRACTION as rounded off to one decimal place. i want the WT column fractional part as it is. and after separation of fractional part, which fraction is the minimum.
thanks.