Chapter 9 SQL Statements
445
CREATE FUNCTION statement
Use this statement to create a new function in the database.
CREATE FUNCTION [
owner
.]
function-name
( [
parameter
, … ] )
RETURNS
data-type
{ EXTERNAL NAME
library-call
| EXTERNAL NAME
java-call
LANGUAGE JAVA
| [ ON EXCEPTION RESUME ]
…
compound-statement
}
parameter
:
IN
parameter-name
data-type
library-call
:
'[
operating-system
:]
function-name@library.dll
; …'
operating-system
:
Windows95 | WindowsNT | NetWare | UNIX
java-call:
'[
package-name
.]
class-name
.
method-name
method-signature
'
method-signature
:
( [
field-descriptor
, … ] )
return-descriptor
field-descriptor
|
return-descriptor
:
Z | B | S | I | J | F | D | C | V | [
descriptor
| L
class-name
;
Must have RESOURCE authority.
External functions, including Java functions, must have DBA authority.
Automatic commit.
"DROP statement" on page 505
"BEGIN statement" on page 404
"CREATE PROCEDURE statement" on page 453
"RETURN statement" on page 593
"Using Procedures, Triggers, and Batches" on page 435 of the book ASA
User’s Guide
The CREATE FUNCTION statement creates a user-defined function in the
database. A function can be created for another user by specifying an owner
name. Subject to permissions, a user-defined function can be used in exactly
the same way as other non-aggregate functions.
CREATE FUNCTION clause Parameter names must conform to the rules
for database identifiers. They must have a valid SQL data type, and must be
prefixed by the keyword IN, signifying that the argument is an expression
that provides a value to the function.
Function
Syntax
Permissions
Side effects
See also
Description
Parameters