MySQL Forums
Forum List  »  Stored Procedures

CREATE DATABASE with variable name
Posted by: Fabricio Rodriguez
Date: September 04, 2012 02:34AM

I'm trying to create a routine in MySQL Workbench which creates a database with whichever name I pass it in a parameter. So:

DELIMITER $$

CREATE PROCEDURE `db1`.`create_database` (databaseName varchar(45))
BEGIN
CREATE DATABASE databaseName;
END

The problem is that if I run this routine, it will create a database named "databaseName", and not the name that I pass it in the databaseName parameter. Anyone know how to get around this? Thank you...

Options: ReplyQuote


Subject
Views
Written By
Posted
CREATE DATABASE with variable name
3124
September 04, 2012 02:34AM
962
September 04, 2012 08:29AM


Sorry, you can't reply to this topic. It has been closed.

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.