MySQL Forums
Forum List  »  Stored Procedures

Re: Drop table from procedure
Posted by: Andrew Gilfrin
Date: February 01, 2006 04:36AM

You need to use dynamic sql via prepared statements. Check the following link and other messages in this forum for details.

http://dev.mysql.com/doc/refman/5.0/en/sqlps.html

The reason for this is MySQL assumes that any SQL statments contain valid table names, it's possible that a variable name could also be a valid table name in your database, MySQL cannot make the decision about when to use the variable name as the table name or when to use the value of the varibale, therefore you need to tell it.


Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information



Edited 1 time(s). Last edit at 02/01/2006 04:38AM by Andrew Gilfrin.

Options: ReplyQuote


Subject
Views
Written By
Posted
5123
February 01, 2006 04:11AM
Re: Drop table from procedure
2238
February 01, 2006 04:36AM
1956
February 01, 2006 05:33AM
2109
February 01, 2006 05:47AM


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.