I want to apply these updates to multiple tables (ba, cd, cc, ca) but not sure how to do this. I tried:
drop procedure if exists updateCCCat;
delimiter //
create procedure updateCCCat(tbl varchar(20))
begin
update tbl set cat='Alcohol',sub_cat='Liquor' where d like 'total wine%' or d like '%liquor%';
update tbl set cat='Alcohol',sub_cat='Wine' where d like '%winery%';
update tbl set cat='Automotive',sub_cat='Repairs' where d like '%nissan%' or d like '%firestone%';
update tbl set cat='Automotive',sub_cat='Gas' where d like '%costco gas%' or d like '%oil%' or d like '% bp %';
end //
delimiter ;
but that didn't work.
I also tried in the above, using the variable @newtbl:
set @newtbl = tbl
But that also didn't work either
drop procedure if exists updateCCCat;
delimiter //
create procedure updateCCCat()
begin
update ba set cat='Alcohol',sub_cat='Liquor' where d like 'total wine%' or d like '%liquor%';
update ba set cat='Alcohol',sub_cat='Wine' where d like '%winery%';
update ba set cat='Automotive',sub_cat='Repairs' where d like '%nissan%' or d like '%firestone%';
update ba set cat='Automotive',sub_cat='Gas' where d like '%costco gas%' or d like '%oil%' or d like '% bp %';
end //
delimiter ;