In mySQL
the name of the table can not be passed to it as a parameter. You need to use Dynamic SQL.
DELIMITER $$
CREATE DEFINER='root'@'localhost'
PROCEDURE 'create_tb_one'(In tableName varchar(255))
BEGIN
SELECT COUNT(1) INTO @table_exists
FROM information_schema.tables
WHERE table_schema=DATABASE()
AND table_name=tableName;
IF @table_exists = 0 THEN
SET @sql = CONCAT('CREATE TABLE ',tableName,' ');
SET @sql = CONCAT(@sql,'(ID INT NOT NULL,SNAME VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'SSTATE VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'TIME_STAMP VARCHAR(45) NOT NULL,');
SET @sql = CONCAT(@sql,'constraint FK_SENSOR ');
SET @sql = CONCAT(@sql,'foreign key (SNAME) ');
SET @sql = CONCAT(@sql,'references sensorInfo(SName) on delete set null)');
PREPARE s FROM @sql;
EXECUTE s;
DEALLOCATE PREPARE s;
END IF;
END $$
DELIMITER ;
Source