background image
<< ReturnDataType | RETURNS NULL ON NULL INPUT >>

EXTERNAL SECURITY

<< ReturnDataType | RETURNS NULL ON NULL INPUT >>
Derby Reference Manual
31
Declares that the function is deterministic, meaning that with the same set of input
values, it always computes the same result. The default is NOT DETERMINISTIC. Derby
cannot recognize whether an operation is actually deterministic, so you must take care to
specify the
DeterministicCharacteristic
correctly.
ParameterStyle
JAVA | DERBY_JDBC_RESULT_SET
The function will use a parameter-passing convention that conforms to the Java language
and SQL Routines specification. INOUT and OUT parameters will be passed as single
entry arrays to facilitate returning values. Result sets can be returned through additional
parameters to the Java method of type java.sql.ResultSet[] that are passed single entry
arrays.
Derby does not support long column types (for example Long Varchar, BLOB, and so
on). An error will occur if you try to use one of these long column types.
The PARAMETER STYLE is DERBY_JDBC_RESULT_SET if and only if this is a
Derby-style table function, that is, a function which returns
TableType
and which is
mapped to a method which returns a JDBC ResultSet. Otherwise, the PARAMETER
STYLE must be JAVA.
EXTERNAL SECURITY
If SQL authorization mode is enabled, a function runs by default with the privileges
specified for the user who invokes the function (invoker's rights). To specify that the
function should run with the privileges specified for the user who defines the function
(definer's rights), create the function with EXTERNAL SECURITY DEFINER. Those
privileges include the right to set the current role to a role for which the definer has
privileges. When the function is first invoked, no role is set; even if the invoker has set a
current role, the function running with definer's rights has no current role set initially.
See
derby.database.sqlAuthorization
for details about setting SQL authorization mode.
When a function with definer's rights is invoked, the current default schema is set to the
eponymously named schema of the definer. For example, if the defining user is called
OWNER, the default schema will also be set to OWNER.
When a function with invoker's rights is called, the current default schema and current
role are unchanged initially within the function. Similarly, if SQL authorization mode is not
enabled, the current default schema is unchanged initially within the function.
When the call returns, any changes made inside the function to the default current
schema (and current role, if relevant) are reset (popped).
If SQL authorization mode is not enabled, an attempt to create a function with
EXTERNAL SECURITY will result in an error.
NO SQL, CONTAINS SQL, READS SQL DATA
Indicates whether the function issues any SQL statements and, if so, what type.
CONTAINS SQL
Indicates that SQL statements that neither read nor modify SQL data can be
executed by the function. Statements that are not supported in any function return a
different error.
NO SQL
Indicates that the function cannot execute any SQL statements
READS SQL DATA
Indicates that some SQL statements that do not modify SQL data can be included
in the function. Statements that are not supported in any stored function return a
different error. This is the default value.