mysql> delimiter $$
mysql>
mysql>
mysql> 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$$
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> delimiter ;
mysql> call myProc();
Query OK, 0 rows affected, 1 warning (0.08 sec)
mysql> drop procedure myProc;
Query OK, 0 rows affected (0.00 sec)
mysql> desc test_table;
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | | |
| some_data | varchar(30) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> drop table test_table;
Query OK, 0 rows affected (0.03 sec)
mysql>
|