So I am having an issue with MySQL 5.5 that is about to drive me insane. I have a few nested stored procedures and one of them inserts some data into a table and then selects the LAST_INSERT_ID() into an out-bound parameter. The following is my stored procedure:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `createNewSession`(
in inputIP varchar(15),
in inputPostTime bigint,
in inputPostInterval bigint,
in inputPlatform varchar(45),
out outSessionID int)
BEGIN
insert into myDB.session (IP, StartTime, LastPost, Platform)
values (inputIP, inputPostTime - inputPostInterval, inputPostTime, inputPlatform);
select LAST_INSERT_ID() into outSessionID;
END;$$
Now, if I pass the correct parameters (ie: parameters that I have tested against the insert statement and are properly working) and call the following I will get the correct ID back
CALL myDB.createNewSession('127.0.0.1', 1310062874228, 1310062894228, 'Platform', @outVar);
select LAST_INSERT_ID();
However if I call the following then I am returned a BLOB parameter with a ? value.
CALL myDB.createNewSession('127.0.0.1', 1310062874228, 1310062894228, 'Platform', @outVar);
select @outVar;
Why would this be happening? This stored procedure has been working for a month+ at this point and as far as I know nothing has changed to the DB settings. Why would I be receiving anything other than LAST_INSERT_ID() upon selecting the outbound parameter from the stored procedure?
Any help would be greatly appreciated. Going crazy over here…
EDIT
The error that I’m getting when calling the top-level stored procedure is as follows:
Error Code: 1264. Out of range value adjusted for column 'outSessionID' at row 68
EDIT 2
Here is the table structure
Field Type Null Key Extra
'SessionID', 'int(11)', 'NO', 'PRI', NULL, 'auto_increment'
'IP', 'varchar(15)', 'NO', '', NULL, ''
'StartTime', 'bigint(20)', 'NO', '', NULL, ''
'LastPost', 'bigint(20)', 'NO', '', NULL, ''
'Platform', 'varchar(45)', 'NO', '', NULL, ''
EDIT 3
So after messing around some more I have found that the following queries when called together will also select a BLOB parameter with value of ‘?’
set @tempVar = 25;
select @tempVar;
Shouldn’t this return 25?
Please try
within the proc instead of doing the SELECT.