[MySQL] 创建带参的存储过程

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 ;

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页