To create and use an SQL UDF, follow these steps:
- Use CREATE FUNCTION or REPLACE FUNCTION to define the UDF.
- Use GRANT to grant privileges to users who are authorized to use the UDF.
- Call the function.
Here is a synopsis of the steps you take to develop, compile, install, and use an external UDF:
- Write, test, and debug the C, C++, or Javacode for the UDF.
- If you are using Java, place the class or classes for the UDF in an archive file (JAR or ZIP) and call the SQLJ.INSTALL_JAR external stored procedure to register the archive file with the database.
- Use CREATE FUNCTION or REPLACE FUNCTION to create a database object for the UDF.
- Use GRANT to grant privileges to users who are authorized to use the UDF.
- Call the function.