1 – bind-site-clause
Syntax options: BIND ON CLIENT SITE | BIND ON SERVER SITE Selects the execution model and environment for external routine execution. CLIENT site binding causes the external routine to be activated and executed in the OpenVMS database client (application) process. This is the default binding. This binding offers the most efficient execution characteristics, allows sharing resources such as I/O devices, and allows debugging of external routines as if they were part of the client application. However, this binding may suffer from address space limitations. Because it shares virtual memory with the database buffers, this binding is restricted to the client process system user environment, and prohibits external routine execution in cases of an application running with elevated privileges. SERVER site binding causes the external routine to be activated in a separate process from the database client and server. The process is started on the same node at the database process. This binding offers reasonable execution characteristics, a larger address space, a true session user environment, and has no restrictions regarding client process elevated privileges. However, this binding does not permit sharing resources such as I/O devices with the client (in particular, there is no connection to the client interactive terminal), and debugging of routines is generally not possible.
2 – bind-scope-clause
Syntax options: BIND SCOPE CONNECT | BIND SCOPE TRANSACTION Defines the scope during which an external routine is activated and at what point the external routine is deactivated. The default scope is CONNECT. o CONNECT An active routine is deactivated when you detach from the database (or exit without detaching). o TRANSACTION An active routine is deactivated when a transaction is terminated (COMMIT or ROLLBACK). In the event that a transaction never occurs, the scope reverts to CONNECT.
3 – COMMENT IS string
Adds a comment about the function. SQL displays the text of the comment when it executes a SHOW FUNCTIONS statement. Enclose the comment in single quotation marks (') and separate multiple lines in a comment with a slash mark (/). This clause is equivalent to the COMMENT ON FUNCTION statement.
4 – COMPILE
The COMPILE option forces the Oracle Rdb server to recompile the stored (SQL) function. External functions are not affected. Use COMPILE when a function has been made invalid by the execution of a DROP . . . CASCADE operation. This mechanism is preferred over the SET FLAGS 'VALIDATE_ROUTINE' method available in previous versions.
5 – DETERMINISTIC
Syntax options: DETERMINISTIC | NOT DETERMINISTIC These clauses are synonyms for the VARIANT and NOT VARIANT clauses for conformance to the SQL/PSM standard. The DETERMINISTIC clause indicates that the same inputs to the function will generate the same output. It is the same as the NOT VARIANT clause. The NOT DETERMINISTIC clause indicates that the output of the function does not depend on the inputs. It is the same as the VARIANT clause.
6 – external-body-clause
Identifies key characteristics of the routine: its name, where the executable image of the routine is located, the language in which the routine is coded, and so forth.
7 – external-body-name
The name of the external routine. If you do not specify a name, SQL uses the name you specify in the external-routine-name clause. This name defines the routine entry address that is called for each invocation of the routine body. The named routine must exist in the external routine image selected by the location clause. Unquoted names are converted to uppercase characters.
8 – external-location-clause
Syntax options: DEFAULT LOCATION LOCATION 'image-location' A default or specific location for the external routine image. The resulting file specification must include the type .exe. This can be an image file specification or merely a logical name. SQL selects a routine based on a combination of factors: o Image string The location defaults to DEFAULT LOCATION, which represents the file specification string RDB$ROUTINES. o Logical name translation The WITH ALL LOGICAL_NAME TRANSLATION and the WITH SYSTEM LOGICAL_NAME TRANSLATION clauses specify how logical names in the location string are to be translated. If no translation option is specified, or if WITH ALL LOGICAL_ NAME TRANSLATION is specified, logical names are translated in the default manner. If WITH SYSTEM LOGICAL_NAME TRANSLATION is specified, any logical names in the location string are expanded using only EXECUTIVE_MODE logical names from the SYSTEM logical name table.
9 – LANGUAGE language-name
The name of the host language in which the external routine was coded. You can specify ADA, C, COBOL, FORTRAN, PASCAL, or GENERAL. The GENERAL keyword allows you to call routines written in any language.
10 – notify-clause
Specifies the name of a second external routine called (notified) when certain external routine or database-related events occur. This name defines the routine entry address that is called, for each invocation of the notify routine. The named routine must exist in the external routine image selected by the location clause. The events of interest to the notify routine are ON BIND, ON CONNECT, and ON TRANSACTION. Multiple events can be specified. The following describes the events and scope of each event: BIND Routine activation to routine deactivation CONNECT Database attach to database disconnect TRANSACTION Start transaction to commit or roll back transaction
11 – RENAME_TO
Changes the name of the function being altered. See the RENAME for further discussion. If the new name is the name of a synonym then an error will be raised.
12 – ON_NULL_INPUT
Syntax options: RETURNS NULL ON NULL INPUT | CALLED ON NULL INPUT These clauses control how an external function is invoked when one or more of the function arguments is NULL. The CALLED ON NULL INPUT clause specifies that the function should be executed normally. A normal execution when the PARAMETER STYLE GENERAL clause is specified means that SQL should return a run-time error when the NULL value is detected. The RETURNS NULL ON NULL INPUT clause instructs Oracle Rdb to avoid the function call and just return a NULL result. This option is valuable for library functions such as SIN, COS, CHECKSUM, SOUNDEX, and so on, that usually return an UNKNOWN result if an argument is NULL. The CALLED ON NULL INPUT clause is the default.
13 – VARIANT
Syntax options: VARIANT | NOT VARIANT These clauses are synonyms for the DETERMINISTIC and NOT DETERMINISTIC clauses for conformance to the SQL/PSM standard. The DETERMINISTIC clause indicates that the same inputs to the function will generate the same output. It is the same as the NOT VARIANT clause. The NOT DETERMINISTIC clause indicates that the output of the function does not depend on the inputs. It is the same as the VARIANT clause.