954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Scope of UDF in MySQL

Hello everyone,

I am creating UDF using CREATE FUNCTION statement.

The question is how can I make them globally accessible to all the databases, rather than specific database?

Regards,

tanha
Posting Whiz in Training
218 posts since Aug 2007
Reputation Points: 8
Solved Threads: 1
 

Grant access to the UDF to all involved parties and call it with the database name as a dot-terminated prefix, like in

call testDB.myUDF();
smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

Thank you for the response.

There is no way omitting the database_name? to write something as follow:

SELECT myUDF();
tanha
Posting Whiz in Training
218 posts since Aug 2007
Reputation Points: 8
Solved Threads: 1
 

The default path to search for database objects is the database currently in use. If there is no object of that name (myUDF) in the database, you have either to switch the database or to include the search path (the database name) in the function call.

smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: