Create a table in a procedure

Submitted by:Andery Smith

Date added:16 July, 2011

Category:SQL

Here are the procedure example to create table. you can call this procedure by command like : call myProc();

Tags: procedure

Code Snippet:

CREATE PROCEDURE myProc()
BEGIN
DECLARE i INT DEFAULT 1;

SET autocommit=0;

DROP TABLE IF EXISTS test_table ;
CREATE TABLE test_table (
id INT PRIMARY KEY,
some_data VARCHAR(30))
ENGINE=innodb;

END$$
 
 

Comments