mysql - LAST_INSERT_ID remain same without increment -
i have 3 tables named fullview,dimtab , facttab.i want insert data fullview other 2 tables using stored procedure.primary key of dimtab table should insert column value facttab table.i have tried below procedure rows of foreign key remained same without increment.highly appreciate help.
delimiter // create procedure tranxdata6() begin declare out_param integer; insert dimtab (itm_no,itm_type) select itm_no,itm_type fullview; set out_param = last_insert_id() ; insert facttab (id,name,company,itm_key) select f.id,f.name,f.company,out_param fullview f; end // delimiter ;
Comments
Post a Comment