My Table Structure is:
DROP TABLE IF EXISTS `child`;
CREATE TABLE `child` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KE
You might have already solved this by now, but the first thing I noticed about your stored procedure is that you have a local variable with the same name as the output variable (parent_id). It looks to me that you're setting the value of the local variable rather than the return variable, so the caller never sees the correct value.
Perhaps removing the local parent_id variable declaration will solve your problem.