|Oracle9i SQL Reference
Release 2 (9.2)
Part Number A96540-01
SQL Statements: CREATE LIBRARY to CREATE SPFILE, 5 of 16
OPERATOR statement to create a new operator and define its bindings.
Operators can be referenced by indextypes and by DML and query SQL statements. The operators, in turn, reference functions, packages, types, and other user-defined objects.
To create an operator in your own schema, you must have
OPERATOR system privilege. To create an operator in another schema, you must have the
OPERATOR system privilege. In either case, you must also have
EXECUTE privilege on the functions and operators referenced.
REPLACE to replace the definition of the operator schema object.
Restriction on replacing an operator: You can replace the definition only if the operator has no dependent objects (for example, indextypes supporting the operator).
Specify the schema containing the operator. If you omit
schema, Oracle creates the operator in your own schema.
Specify the name of the operator to be created.
binding_clause to specify one or more parameter datatypes (
parameter_type) for binding the operator to a function. The signature of each binding (that is, the sequence of the datatypes of the arguments to the corresponding function) must be unique according to the rules of overloading.
parameter_type can itself be an object type. If it is, you can optionally qualify it with its schema.
Restriction on the binding_clause: You cannot specify a
PL/SQL User's Guide and Reference for more information about overloading
Specify the return datatype for the binding.
return_type can itself be an object type. If so, you can optionally qualify it with its schema.
Restriction on the RETURN clause: You cannot specify a
TO clause to indicate that the operator binding is ancillary to the specified primary operator binding (
primary_operator). If you specify this clause, do not specify a previous binding with just one number parameter.
context_clause to specify the name of the implementation type used by the functional implementation of the operator as a scan context.
DATA to indicate that the operator binding computes ancillary data.
using_function_clause lets you specify the function that provides the implementation for the binding.
function_name can be a standalone function, packaged function, type method, or a synonym for any of these.
This example creates a very simple functional implementation of equality and then creates an operator that uses the function: