CREATE FUNCTION Statement (Java UDF)

Creates a new external Java table UDF function in the database.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

CREATE [ OR REPLACE | TEMPORARY ] FUNCTIONowner.]function-name  
   ( [ parameter, ...] )
   [ SQL SECURITYINVOKER | DEFINER } ]
   RETURNS data-type
   ON EXCEPTION RESUME
   | [ NOT ] DETERMINISTICcompound-statementAS tsql-compound-statementEXTERNAL NAME 'java-call' LANGUAGE JAVA [ ALLOW | DISALLOW SERVER SIDE REQUESTS ] environment-name}

parameter - (back to Syntax)
   IN parameter-name data-typeDEFAULT expression ]

tsql-compound-statement - (back to Syntax)
   sql-statement 
   sql-statement

java-call - (back to Syntax)
   '[ package-name.]class-name.method-name method-signature'

method-signature - (back to java-call)
   ( [ field-descriptor, ...] ) return-descriptor

field-descriptor and return-descriptor - (back to method-signature)
   Z | B | S | I | J | F | D | C | V | [ descriptor | L class-name;

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

When functions are executed, not all parameters need to be specified. If a default value is provided in the CREATE FUNCTION statement, missing parameters are assigned the default values. If an argument is not provided by the caller and no default is set, an error is given.

Standards

(back to top)

Permissions

(back to top)

For function to be owned by self – Requires the CREATE PROCEDURE system privilege

For function to be owned by any user – Requires one of:
  • CREATE ANY PROCEDURES system privilege.
  • CREATE ANY OBJECT system privilege.
To create a function containing an external reference, regardless of whether or not they are the owner of the function, also requires the CREATE EXTERNAL REFERENCE system privilege.