Stored Procedures that creates a table

mysql, stored-procedures

Solution

You can create tables using procedures in mysql.

delimiter |
CREATE PROCEDURE SP_CREATE_TABLE_TEST ()
   BEGIN
      CREATE TABLE TEST 
      (
        TestID int(11) default NULL,
        TestName varchar(100) default NULL
      ) 
      ENGINE=InnoDB DEFAULT CHARSET=utf8;
   END;

|

Reference link.

Problem

Can I create tables using Stored Procedures? I am using MySQL. I had searched the web for instructions on how to create a table using stored procedure, but I didn't find any results, I just found that you can create temporary tables. Is there any problem if I create tables using stored procedures? Actually I want to check whether a table exists or not, then I have to create it.

Original source