Consultor Eletrônico



Kbase P98725: CASE statement truncates decimals if ELSE expression is not decimal
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/09/2008
Status: Verified

SYMPTOM(s):


CASE statement truncates decimals if ELSE expression is not decimal

Executing the following SQL-92 statement against the sports2000 database:

SELECT balance, CASE WHEN State = 'MA' THEN 9.999 ELSE 0 END FROM PUB.Customer;

truncates the values of the decimal result 9.999.

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.0x
All Supported Operating Systems

CAUSE:

Bug# OE00111942

FIX:

Option #1
Upgrade to OpenEdge 10.1A or later.

Option #2
In 10.0B: Execute the same SQL-92 statement with the ELSE expression written with a decimal point:

SELECT balance, CASE WHEN State = 'MA' THEN 9.999 ELSE 0.00 END FROM PUB.Customer;

Option #3
In 9.1D and 9.1E: Use the TO_CHAR function:

SELECT balance, CASE WHEN State = 'MA' THEN TO_CHAR(balance) ELSE TO_CHAR(0.000) END FROM PUB.Customer;