Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread "_Balance" DECIMAL(20, 2),
Sun, Mar 11 2007 6:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Should this field type allow me to enter 4 decimal places?

Roy Lambert
Sun, Mar 11 2007 8:23 AMPermanent Link

"Ole Willy Tuv"
Roy,

I'm not sure how Tim has implemented the BCD type in ElevateDB, but since
ElevatedDB is based on the VCL, I'd guess that declaring DECIMAL(20,2) would
actually define a (DECIMAL(18,2)) type.

<< Should this field type allow me to enter 4 decimal places? >>

Numbers are assignment compatible, so specifying a source value having a
larger scale than the target column wouldn't throw any errors. However, the
stored value should be rounded or truncated to fit the target type. Whether
an exact numeric value is rounded or truncated is implementation-defined.

Example:

create table test (col1 decimal(18,2));
insert into test values (10.2555);

select col1 from test

The correct col1 value can be either 2.55 or 2.56, depending on truncation
or rounding. Some RDBMS use truncation (e.g. Mimer SQL and NexusDB, others
use rounding (e.g. SQL Server and Interbase).

ElevatDB currently stores the value 10.2555 (scale 4), which looks like a
bug since the column type is an exact numeric with scale 2.

Ole Willy Tuv

Sun, Mar 11 2007 9:02 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Thanks. I'll wait for Tim's response on Tuesday (assuming he sobers up after his birthday by then) before deciding wether or not to rounding of fields into my triggers.

Roy Lambert
Mon, Mar 12 2007 4:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Thanks. I'll wait for Tim's response on Tuesday (assuming he sobers up
after his birthday by then) before deciding wether or not to rounding of
fields into my triggers. >>

Yeah right, what I'm doing right now is what I get to do for my birthday, my
friend.

I'm looking into the issue and will let you know.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image