Is there a database where we can create user defined functions so that it is not necessary to qualify them with the databasename when we use them. The UDFs that have been created by the Teradata installation are all in the TD_SYSFNLIB database, and don't need to be prefixed with the databasename. What I'm after is a place to put our own functions so we can use them in a similar way. I don't think it is recommended to create new fiunctions in the TD_SYSFNLIB database.
Is there a dbscontrol parameter that can be set to say to look for them in a default database?
Like TD_SYSFNLIB, SYSLIB gets searched by default and contains some system-supplied functions. Unlike TD_SYSFNLIB, you can potentially add your own functions to SYSLIB.
But be aware that all functions in a database (inclulding SYSLIB) get re-linked into a single library whenever you add, recompile, or delete one of them. So you should develop and test in some other database.
Is it recommended to use this database? Ideally I'd be able to create a new database, USER_SYSFNLIB, and get Teradata to search that database for functions as well as the system databases.
I am looking for the exact same thing. We have a library of functions that we want to be able to use without having to qualify them. I was hoping there was a way to add my own database to the "function" path. The other option is put them in your user default database, but that isn't a great answer either...
In order to do so, EXECUTE FUNCTION on SYSLIB must be granted to PUBLIC. This way, you do not have to qualify the database when using the function. I just tried it today, and it worked.
No no no, never grant Execute Function on Syslib to public on database level:
All PMon-API functions are located in this database including dangerous ones like AbortSessions.