Reputation: 2339
I have used MySQL for a few months and have really liked it. I have a question about using procedures between different schemas.
To give some context, I am working with a local copy of a database from my job. When I create procedures for the database, some of them I want to upload to the server, but others I rather want to keep on my local computer. However, the ones that I keep in my computer will be deleted when I load a new backup copy of the production database.
Where would be a safe place or way to save these procedures in my computer. Should I keep a separate schema for my local procedure, and then will I be able to call them from the backed up schema? Is there another way to do this?
Upvotes: 1
Views: 949
Reputation: 562358
Yes, you can put procedures in a separate schema. Any query that references a table inside the procedure should be qualified by schema name.
BEGIN
SELECT ... FROM dbname.tablename;
END
Upvotes: 1