PRB IN ROUND FUNCTION

Go down

PRB IN ROUND FUNCTION

Post by mightyganesh on Fri Mar 19, 2010 2:12 pm

i got
SQL> select PHONE_NO,ROUND(PHONE_NO/100,0) FROM CUSTOMER_336474;

PHONE_NO ROUND(PHONE_NO/100,0)
---------- ---------------------
9046491272 90464913

SQL> select PHONE_NO,ROUND(PHONE_NO/100,1) FROM CUSTOMER_336474;

PHONE_NO ROUND(PHONE_NO/100,1)
---------- ---------------------
9046491272 90464912.7

SQL> select PHONE_NO,ROUND(PHONE_NO/100,2) FROM CUSTOMER_336474;

SQL> select PHONE_NO,ROUND(PHONE_NO/10000,2) FROM CUSTOMER_336474;

PHONE_NO ROUND(PHONE_NO/10000,2)
---------- -----------------------
9046491272 904649.13

why is the precession not working properly?? for select PHONE_NO,ROUND(PHONE_NO/100,2) FROM CUSTOMER_336474;
the output should have been 90464912.72 !! y is this prob caused???
avatar
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 30

View user profile http://ganeshguna.blogspot.com

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by mightyganesh on Fri Mar 19, 2010 2:14 pm

hey when i tried through the browser link they gave it shows

PHONE_NO ROUND(PHONE_NO/10000,4)
9046491272 904649.127

for both
select PHONE_NO,ROUND(PHONE_NO/10000,4) FROM CUSTOMER_336474;
and
select PHONE_NO,ROUND(PHONE_NO/10000,3) FROM CUSTOMER_336474;


y is it so???
avatar
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 30

View user profile http://ganeshguna.blogspot.com

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by Mahee on Fri Mar 19, 2010 2:26 pm

I think the function of round will be wasted in that example....

select ROUND(9046491276/10,1)from dual;
select ROUND(9046491276/100,2)from dual;
select ROUND(9046491276/1000,3)from dual;
select ROUND(9046491276/10000,4)from dual;
select ROUND(9046491276/100000,5)from dual;

case:
No of Zeros == precision value

All the ABOVE will give one precision less than mentioned.. i Think that it is for, some round functionality has to be done.Otherwise No point in using round funtion in above cases....... May be.. I am not sure.
avatar
Mahee

Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia

View user profile

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by mightyganesh on Fri Mar 19, 2010 3:44 pm

no in

SQL> select PHONE_NO,ROUND(PHONE_NO/100,1) FROM CUSTOMER_336474;

PHONE_NO ROUND(PHONE_NO/100,1)
---------- ---------------------
9046491272 90464912.7

i got the correct precision as i mentioned~
avatar
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 30

View user profile http://ganeshguna.blogspot.com

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by mightyganesh on Fri Mar 19, 2010 3:51 pm

machi wat does dual mean???
avatar
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 30

View user profile http://ganeshguna.blogspot.com

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by Mahee on Fri Mar 19, 2010 3:53 pm

yea it will....
I said it will occur ly for cases where the denominator is (10 * x) and the precision given is x...

According to ur view,

9046491272/100 = 90464912.72
and
ROUND(9046491272/100,2)=90464912.72

The answer for the above two were same, so there is no point in using round...
avatar
Mahee

Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia

View user profile

Back to top Go down

Re: PRB IN ROUND FUNCTION

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum