DB2 AS400
Problème de calculs numériques avec DB2 (sur AS400):
1)La requête suivante:
SELECT 1/4 FROM SYSIBM.SYSDUMMY1
Retourne 0 !!!!
Solution:
Pour avoir le nombre juste, utiliser la fonction DECIMAL:
SELECT DECIMAL(1.0 * 1/4,13,2)FROM SYSIBM.SYSDUMMY1
Retourne: 0.25
2)La requête suivante:
SELECT 1.0 * 12/24 FROM SYSIBM.SYSDUMMY1
Retourne : .5000000000000000000
Solution:
Pour éliminer ces zéros, utiliser la fonction DECIMAL:
SELECT DECIMAL(1.0 * 12/24,13,3) FROM SYSIBM.SYSDUMMY1
Retourne : .500 NB: 13,3 étant le type décimal voulu à la sortie.
Tags: -
Related entries:
Auteur: Michel Preti
Révision: 1.0
Vous ne pouvez pas commenter cet enregistrement
Commenté par ygXC2n1K4ye7:
pick up signed coieps Yes, in the two expert sessions I have, we'll be giving away a few coieps (see asktom homepage for info on those sessions). As well we are trying to set up something else in/near the bookstore, but that isn't finalized yet. the title is different This is for this book. Not sure which one you were looking at.
Added at: 2015-12-21 10:29
Commenté par ZPSHhxg8J7Y:
Your site is fine. I just want to comment on the diesgn. Its too loud. Its doing way too much and it takes away from what youve got to say –wch I think is really important. I don’t know if you didnt think that your words could hold everyones attention, but you were wrong.
Added at: 2015-12-22 19:20