0

This is what I am trying:

CREATE PROCEDURE `sp_insert`(IN TableName varchar(100))
BEGIN
    INSERT INTO TableName  (....) 
    VALUES (....); 
END

CALL sp_insert('table1');

But I get an error

table not found

Can anyone let me know how I can achieve my goal?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Rohan kumar
  • 111
  • 11
  • 1
    you'll need to use dynamic sql, look at the answer here for a very similar example on how to do that: https://stackoverflow.com/a/5728155/519348 – TZHX May 20 '22 at 12:39

0 Answers0