Oracle 5.0 Reference Manual page 2835

Table of Contents

Advertisement

char **args
communicates information to the initialization function about the general nature of
args->args
the arguments passed to your function. For a constant argument i,
argument value. (See below for instructions on how to access the value properly.) For a nonconstant
argument,
args->args[i]
such as
or
or
3
4*7-2
values that may change from row to row, such as column names or functions that are called with
nonconstant arguments.
For each invocation of the main function,
passed for the row currently being processed.
If argument
represents NULL,
i
functions can refer to it as follows:
• An argument of type
of binary data or data of arbitrary length. The string contents are available as
and the string length is args->lengths[i]. Do not assume that the string is null-terminated.
• For an argument of type INT_RESULT, you must cast
long long int_val;
int_val = *((long long*) args->args[i]);
• For an argument of type REAL_RESULT, you must cast
double
real_val;
real_val = *((double*) args->args[i]);
• For an argument of type DECIMAL_RESULT, the value is passed as a string and should be
handled like a
STRING_RESULT
arguments are not implemented.
ROW_RESULT
unsigned long *lengths
For the initialization function, the
argument. You should not change these. For each invocation of the main function,
contains the actual lengths of any string arguments that are passed for the row currently being
processed. For arguments of types
maximum length of the argument (as for the initialization function).
char *maybe_null
For the initialization function, the
argument value might be null (0 if no, 1 if yes).
char **attributes
args->attributes
argument i, the attribute name is available as a string in
length is args->attribute_lengths[i]. Do not assume that the string is null-terminated.
By default, the name of a UDF argument is the text of the expression used to specify the argument.
For UDFs, an argument may also have an optional
argument name is alias_name. The
whether an alias was given.
Suppose that a UDF
SELECT my_udf(expr1, expr2 AS alias1, expr3 alias2);
Adding a New User-Defined Function
is 0. A constant argument is an expression that uses only constants,
[914]. A nonconstant argument is an expression that refers to
SIN(3.14)
args->args
args->args[i]
is given as a string pointer plus a length, to enable handling
STRING_RESULT
value.
array indicates the maximum string length for each
lengths
INT_RESULT
maybe_null
communicates information about the names of the UDF arguments. For
attributes
is invoked as follows:
my_udf()
2815
args->args[i]
contains the actual arguments that are
is a null pointer (0). If the argument is not NULL,
args->args[i]
args->args[i]
or REAL_RESULT,
lengths
array indicates for each argument whether the
args->attributes[i]
[AS] alias_name
value for each argument thus depends on
points to the
args->args[i]
to a
value:
long long
to a
value:
double
lengths
still contains the
and the attribute
clause, in which case the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents