Bug #16265 Stored procedure
Submitted: 6 Jan 2006 20:32 Modified: 10 Jan 2006 15:42
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.18 OS:Windows (windows 2000)
Assigned to: CPU Architecture:Any

[6 Jan 2006 20:32] [ name withheld ]
Description:
Hi,
  we just create a stored procedure as below in MYSQL Server
---------
 CREATE PROCEDURE `get_sequence_number`(INOUT tablename varchar(40)  ,INOUT actor_id BIGINT(12) )
begin
     ------
     ------
     ------
end
---------
 
but we will get an exception as follow:
-------------
Data truncation: Out of range value adjusted for column 'actor_id' at row 1 
-------------.
but after we change the stored procedure as 
-------------
CREATE PROCEDURE `get_sequence_number`(INOUT tablename varchar(40)  ,INOUT actor_id VARCHAR(12) )
begin
     ------
     ------
     ------
end

-------------

then it works, so seems that if we want to set a parameter in stored procedure as INOUT, then it have to be data type of VARCHAR, not data type of NUMERIC.
we test this via many applications and all show the same results.

MANY THANKS IN ADVANCE!
ke

How to repeat:
we test this in java/jsp application first then we test this on asp.net. they have the same problem

Suggested fix:
Allow the stored procedure in MYSQL to allow "INOUT" data type for NUMERIC, not only for VARCHAR.
[6 Jan 2006 22:58] [ name withheld ]
i think this is something related with the JDBC driver (we have tried three different version of JDBC drivers but get the same message), not with the My SQL Server.
thanks!
ke
[8 Jan 2006 11:04] Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with mysql command line client and inform about the results. Just copy and paste the SP call and error message from the command line window. If you think it is JDBC and/or ODBC-related problem only, inform about the exact versions of the drivers used.
[9 Jan 2006 15:48] [ name withheld ]
The message i get from my jsp page is something like
-----
Out of range value adjusted for column "columnname" at row 1 
----
the jdbc driver i use is called "mysql-connector-java-3.2.0-alpha-bin.jar"

Many thanks!
[9 Jan 2006 17:08] [ name withheld ]
Please ignore the question we just asked. i think we just found a workaround. that is i will set the inout parameter in MYSQL stored procedure as data type of VARCHAR, then no matter how i am going to call it with smallint , bigint , double or other numeric type from my java codes,  it will always work even though it seems like those are incompatible type between the calling procedure and receiving stored procedure.
Thank for your help here!
[10 Jan 2006 5:54] Valeriy Kravchuk
So, can I close this bug report as there is no bug? If no, please, provide the information I asked about.
[10 Jan 2006 14:44] [ name withheld ]
i think you can close this case for me.
thanks!
[10 Jan 2006 15:42] Valeriy Kravchuk
Closed as not a server bug, anyway, as agreed with bug reporter.