> > I have tried dynamically assigning a database name to a stored proc via
> > its parameter list:
> >
> > CREATE STORED PROCEDURE testStoredProc (IN test_db_name CHAR)
> >    BEGIN
> >    SELECT * FROM test_db_name.test_table;
> >    END;
> >
> > MySQL does not resolve test_db_name to the value passed in the
> > parameter, and the query fails because there is no database with that
> name.
> >
> > Is there any way around this?
> >
>
> Use a "prepared statement". Build your SQL statement as a string, prepare
> it, and execute it. It's all right there in the manual.

Indeed, I stand corrected.

This page:
http://dev.mysql.com/doc/refman/5.0/en/news-5-0-13.html

says that this is now possible in Stored Procedures :-)

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to