MySQL Forums
Forum List  »  Stored Procedures

Stored Procedure Data Type
Posted by: Jem Ker
Date: October 25, 2007 07:44PM

Hi All,

Please help me to understand the following: I would like to have my data (double type) to always to be 2 decimal places, what happens is that, inside the stored procedure the value is always set to 2.10 in the example show below i.e to 2 decimal places, but when I call the Stored procedure from my client it returns as 2.1 rather than 2.10 ,some times for value 5.00 it returns as 5 only. Please let me know what is the correct way to achieve this.

Example:

DELIMITER $$

DROP PROCEDURE IF EXISTS `test`.`sp_decimal`$$

CREATE PROCEDURE `sp_decimal`(IN data1 double(10,2),OUT out1 double(10,2))
BEGIN
SET out1=data1;
END$$

DELIMITER ;

execute stored procedure as following:
CALL test.sp_decimal(2.10,@out5);
SELECT @out5;

The value expected is 2.10, but it returns 2.1.

Is this a bug ? I am using mysql 5.0.19,5.0.45 windows and linux.

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure Data Type
2633
October 25, 2007 07:44PM
938
October 25, 2007 11:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.