Arithmetic operation , don't understand the result

Hello

Arithmetic operation , don't understand the result
Hi , i'm trying this :
SELECT
13 * 3600000000,
36* 60000000,
FROM SYSIBM.SYSDUMMY1

and i get
COL1 COL2
----------- -----------
46800000000 ???????????

The SQL Ref says that if the 2 operands are integers , then the result will
be an integer .
The max for INT is 2147483647
36*60 000 000 > 21..... so i understand the result
3600000000 is also > 21... but the computation is made , what is the type
of the result : 46800000000 ?

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

nguyen duc tuan

Re: Arithmetic operation , don't understand the result
(in response to Hello)
Try this :

SELECT
13*3600000000,
36*DECIMAL(60000000,15,0)

and joyeux Noel !

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

Bernd Oppolzer

Re: Arithmetic operation , don't understand the result
(in response to nguyen duc tuan)
Because 3600000000 is > 21... already, it is not an integer, but a decimal
value. So the 13 is promoted to decimal and the whole calculation is done in
decimal.

Regards (merry christmas to all, froehliche Weihnachten)

Bernd



Am Freitag, 24. Dezember 2004 14:19 schrieben Sie:
> Hi , i'm trying this :
> SELECT
> 13 * 3600000000,
> 36* 60000000,
> FROM SYSIBM.SYSDUMMY1
>
> and i get
> COL1 COL2
> ----------- -----------
> 46800000000 ???????????
>
> The SQL Ref says that if the 2 operands are integers , then the result will
> be an integer .
> The max for INT is 2147483647
> 36*60 000 000 > 21..... so i understand the result
> 3600000000 is also > 21... but the computation is made , what is the type
> of the result : 46800000000 ?
>
> ---------------------------------------------------------------------------
>------ Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives
> and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that
> page select "Join or Leave the list". The IDUG DB2-L FAQ is at
> http://www.idugdb2-l.org. The IDUG List Admins can be reached at
> [login to unmask email] Find out the latest on IDUG conferences at
> http://conferences.idug.org/index.cfm

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm