Re: Scientific notation for SCN
- From: "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 Sep 2009 17:41:12 +0200
Ganesh escribió:
**********
SQL> select MAX(NEXT_CHANGE#) from V$ARCHIVED_LOG;
MAX(NEXT_CHANGE#)
-----------------
1.3278E+10
SQL> select TO_CHAR(MAX(NEXT_CHANGE#)) from V$ARCHIVED_LOG;
TO_CHAR(MAX(NEXT_CHANGE#))
----------------------------------------
13278230177
SQL> select TO_CHAR(MAX(NEXT_CHANGE#), 999999999999999999999) from V
$ARCHIVED_LOG;
TO_CHAR(MAX(NEXT_CHANGE#))
----------------------------------------
13278230177
**********
But when I give input 1.3278E+10 to my calculator it returns me the
value as 13278000000. So I am not sure why "TO_CHAR" returned
13278230177. So what oracle is doing extra that we are not getting
here.
The 1.3278E+10 you see is the representation of a long number chosen by your SQL console. When you use TO_CHAR() you generate a string so you no longer have a number.
TO_CHAR() accepts an optional argument ("fmt") to specify the format. Docs say:
"If you omit fmt, then n is converted to a VARCHAR2 value exactly long enough to hold its significant digits."
Your SQL console rounds the number to five significant digits but prints the string as-is.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
.
- References:
- Scientific notation for SCN
- From: Ganesh
- Scientific notation for SCN
- Prev by Date: Re: Scientific notation for SCN
- Next by Date: Re: DBMS_STATS
- Previous by thread: Re: Scientific notation for SCN
- Next by thread: Re: Scientific notation for SCN
- Index(es):
Relevant Pages
|
Loading