delimiter $
create procedure sp_total_raw_to_total1(
in datetodaty date
)
begin
insert into tb_total_1
(select a.id,a.client,a.legal_entity,a.bu,a.source,a.make_buy,ifnull(d.id,11) as inv_category_id,
c.id as site_id,a.mater_type,a.plant,a.material,a.material_desc,a.where_use_sku,a.loc,a.loc_desc,
a.original_bu,e.id as bui_id,a.stock_qty,a.rop,a.sis,a.stock_value,
a.currency,a.instansit,a.filepath,a.filename,a.rectime
from tb_total_raw_1 a
LEFT JOIN tb_site c on a.site = c.name
LEFT JOIN tb_inv_category d on a.inv_category = d.name
LEFT JOIN tb_bui e on a.bui = e.name
where a.rectime = datetodaty);
end $
delimiter ;
[MySQL] 创建带参的存储过程
最新推荐文章于 2024-06-29 13:56:33 发布