When i execute the following command I'm a little bit surprised of the result.
select -12345678901234.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -123456789012345.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -1234567890123456.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -12345678901234567.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -123456789012345678.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -1234567890123456789.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -12345678901234567890.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -123456789012345678901.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -1234567890123456789012.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -12345678901234567890123.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -123456789012345678901234.0001 as TestVal, str( TestVal, 40, 2) as stringVal
union all
select -1234567890123456789012345.0001 as TestVal, str( TestVal, 40, 2) as stringVal
order by TestVal desc
The result is in iSQL
TestVal stringVal
------------------------------- -----------------------------------------
-12345678901234.0001 -12345678901234.00
-123456789012345.0001 -123456789012345.00
-1234567890123456.0001 -1234567890123456.00
-12345678901234567.0001 -12345678901234566.00
-123456789012345678.0001 -123456789012345680.00
-1234567890123456789.0001 -1234567890123456800.00
-12345678901234567890.0001 -12345678901234567000.00
-123456789012345678901.0001 -123456789012345680000.00
-1234567890123456789012.0001 -1234567890123456800000.00
-12345678901234567890123.0001 -12345678901234568000000.00
-123456789012345678901234.0001 -123456789012345690000000.00
-1234567890123456789012345.0001 -1234567890123456800000000.00
(12 rows)Execution time: 0.016 seconds
The Function STR is described as
Syntax
STR( numeric-expression [, length [, decimal ] ] )
Parameters
numeric-expression Any approximate numeric (float, real, or double precision) expression between -1E126 and 1E127.
length The number of characters to be returned (including the decimal point, all digits to the right and left of the decimal point, and blanks). The default is 10.
decimal The number of decimal digits to be returned. The default is 0.
I think I did not overcome a length described as -1E127
I have tested this with SA 11.0.1.2355 and SA 10.0.1
Thanks for your help.
Thomas
asked
05 Feb '10, 11:49
Thomas Dueme...
2.7k●28●38●64
accept rate:
17%