i have 2 function called in stored procedure:
call createpost(in value,@outvalue);
now want pass '@outvalue' other stored procedure:
call createpostmedia(@outvalue);
- value retrieved when run select @outvalue; @outvalue value not pass createpostmedia() in parameters
i created small test can useful:
delimiter // create procedure `createpost`( in `_value` varchar(50), out `_out_post_id` bigint unsigned ) begin insert `post` (`value`) values (`_value`); set `_out_post_id` := last_insert_id(); end// create procedure `createpostmedia`( in `_in_post_id` bigint unsigned ) begin insert `postmedia` (`post_id`) values (`_in_post_id`); end// create procedure `sp_test`() begin call `createpost`('post_one', @`_out_post_id`); call `createpostmedia`(@`_out_post_id`); end// call `sp_test`// delimiter ;
Comments
Post a Comment