Bug #13837 allow SP parameter in CREATE/DROP TABLE as tablename

Submitted: 7 Oct 2005 11:40 Modified: 12 Jun 2012 14:14
Reporter: Frank Maas (Basic Quality Contributor) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S4 (Feature request)
Version:5.0.13rc OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[7 Oct 2005 11:40] Frank Maas
Description:
It would be a good feature if a parameter can be used to name a table in a CREATE/DROP TABLE statement.

How to repeat:
delimiter $$
drop procedure if exists `cre_tbl`$$
create procedure `cre_tbl` (in y varchar(10))
begin drop table if exists y; create table y (id int); end $$
delimiter ;

call cre_tbl('a');
/* this then would result in the creaton of table `a` */
[7 Oct 2005 11:53] Frank Maas
* changed category
* as was mentioned in the comments on my earlier bugreport, this "feature" is not conformant to SQL spec. Therefor it might be not such a wise idea... Simply elaborating on it in the documentation is still a good idea IMHO.
[12 Jun 2012 14:14] Valeriy Kravchuk
This can be easily done for a long time already using prepared statements in SP. Read http://dev.mysql.com/doc/refman/5.5/en/sql-syntax-prepared-statements.html for details.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.