I am trying to create a stored procedure in mySQL Workbench. The goal is to clean-up/standardize a field that reside in ad hoc tables that get loaded. Here is a snippet of the code....many many Update lines missing.
CREATE DEFINER=`root`@`localhost` PROCEDURE `Address`(TBL VARCHAR(50))
BEGIN
SET @table_name = TBL;
UPDATE table_name SET AD1 = REPLACE(AD1,"P.O. BOX ","BOX ");
UPDATE table_name SET AD1 = REPLACE(AD1,"POBOX ","BOX ");
UPDATE table_name SET AD1 = REPLACE(AD1,"P O BOX ","BOX ");
END
Issue: The function is NOT recognizing the table.
Error Code:
146 'kalo.table_name' does not exist
What am I doing wrong?