Incorrect parameters in the call to native function 'concat'

mysql, sql

Solution

You are missing a comma after `tablName`:

 set @cmd = concat('Create table', tablName, ' as ( select name from   samprojects.projects  where type=''',projName, ''')');

Problem

I am trying to create store procedure as follows ``` CREATE PROCEDURE `Test1` (IN projName VARCHAR(200), IN tablName VARCHAR(200)) BEGIN set @cmd = concat('Create table', tablName ' as ( select name from samprojects.projects where type=',projName')'); PREPARE stmt FROM @cmd; EXECUTE stmt; END ``` And getting below error ERROR 1583: Incorrect parameters in the call to native function 'concat' Any idea how to resolve this. I am using MYSQL workbench for running sql queries SQL script generated by MYSQL workbench is as follows ``` USE `samprojects`; DROP procedure IF EXISTS `Test1`; DELIMITER $$ USE `samprojects`$$ CREATE PROCEDURE `Test1` (IN projName VARCHAR(200), IN tablName VARCHAR(200)) BEGIN set @cmd = concat('Create table', tablName, ' as ( select name from samprojects.projects where type=',projName')'); PREPARE stmt FROM @cmd; EXECUTE stmt; END$$ DELIMITER ; ```

Original source