Icon View Incident Report

Serious Serious
Reported By: Francisco Fernandez
Reported On: 3/28/2011
For: Version 2.05 Build 4
# 3413 Assigning a DECIMAL Column with a Larger Scale to a Column in a Routine Can Cause Rounding Issue

The following query results one record but this record have field EXIST=0 and I don't know why.

This table is managed by triggers on tables COMPRASLINEAS and VENTASLINEAS. I think that the problem can be that field EXIST in table LOTES is decimal scale 2 and the fields that add and subtract this field in tables COMPRASLINEAS and VENTASLINEAS is decimal scale 3 and in VENTASLINEAS are a row with 3 decimals in field CANTIDAD. I will resize field EXIST in table LOTES to decimal scale 3.

Table:

CREATE TABLE "TestDecimal"
(
"Amount1" DECIMAL(19,2),
"Amount2" DECIMAL(19,3)
)

Script to reproduce:

SCRIPT
BEGIN
   DECLARE TestCursor CURSOR FOR TestStmt;
   DECLARE TestVar DECIMAL(19,3);

   PREPARE TestStmt FROM 'SELECT * FROM TestDecimal';
   OPEN TestCursor;

   UPDATE TestCursor SET 'Amount2'=0.001;
   FETCH FROM TestCursor ('Amount2') INTO TestVar;
   UPDATE TestCursor SET 'Amount1'=TestVar;

END

Query to return results:

SELECT * FROM testDecimal WHERE Amount1=0



Comments Comments
The problem was caused specifically by situations where cursor-based INSERT or UPDATE statements in a routine (SCRIPT, TRIGGER, FUNCTION, PROCEDURE, or JOB) were assigning values from the column with a larger scale to the column with the smaller scale, and the column with a larger scale actually had digits past the scale of the target of the column. In such cases, the value would not be rounded properly. Above is an example of such a routine.


Resolution Resolution
Fixed Problem on 3/20/2011 in version 2.05 build 5


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image