Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Rounding vs Truncation

Rounding vs Truncation

From: Ben Groeneveld <BenG_at_WorkTechnologies.com>
Date: Sat, 30 Oct 1999 19:40:44 -0600
Message-ID: <381B9E1C.703843C7@WorkTechnologies.com>


It seems that Oracle Lite rounds to a sqlplus format specification, but truncates to a table field format. I would like to see rounding everywhere. Is there a setting for this? Does big oracle behave the same? This can be demoed with the following code segment:

SQL> set numformat 9999.999;
SQL> select (19/60 + 6/60)/2 from dual;

(19/60+6/60)/2


          .208

SQL> set numformat 9999.99;
SQL> select (19/60 + 6/60)/2 from dual;

(19/60+6/60)/2


           .21

SQL> create table truncates ( shortfield number(6,2), longfield number(6,3) );

Table created.

SQL> insert into truncates (shortfield, longfield) select (19/60 + 6/60)/2, (19/60 + 6/60)/2 from dual;

1 row created.

SQL> select * from truncates;

SHORTFIELD LONGFIELD
---------- ---------

       .20 .21

Any clarification would be appreciated. Thanks, --
Ben Groeneveld
@Work Technologies, Inc., 775 Lindsay Blvd., Idaho Falls, ID 83402 Mailto:BenG_at_WorkTechnologies.com, phone:208.529.2640, fax:208.522.4202 Received on Sat Oct 30 1999 - 20:40:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US