|Oracle® Database SQL Reference
10g Release 2 (10.2)
|PDF · Mobi · ePub|
Operators can be referenced by indextypes and by SQL queries and DML statements. The operators, in turn, reference functions, packages, types, and other user-defined objects.
See Also:Oracle Data Cartridge Developer's Guide and Oracle Database Concepts for a discussion of these dependencies and of operators in general
To create an operator in your own schema, you must have the
OPERATOR system privilege. To create an operator in another schema, you must have the
OPERATOR system privilege. In either case, you must also have the
EXECUTE object privilege on the functions and operators referenced.
REPLACE to replace the definition of the operator schema object.
Specify the schema containing the operator. If you omit
schema, then the database 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, then you can optionally qualify it with its schema.
See Also: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, then you can optionally qualify it with its schema.
Use this clause to describe the implementation of the binding.
TO clause to indicate that the operator binding is ancillary to the specified primary operator binding (
primary_operator). If you specify this clause, then do not specify a previous binding with just one number parameter.
context_clause to describe the functional implementation of a binding that is not ancillary to a primary operator binding.
If you specify this clause, then the signature of the function implemented must include one extra
See Also:Oracle Data Cartridge Developer's Guide for instructions on using the
using_function_clause lets you specify the function that provides the implementation for the binding. The
function_name can be a standalone function, packaged function, type method, or a synonym for any of these.
If the function is subsequently dropped, then the database marks all dependent objects
INVALID, including the operator. However, if you then subsequently issue an
BINDING statement to drop the binding, then subsequent queries and DML will revalidate the dependent objects.
CREATE FUNCTION eq_f(a VARCHAR2, b VARCHAR2) RETURN NUMBER AS BEGIN IF a = b THEN RETURN 1; ELSE RETURN 0; END IF; END; / CREATE OPERATOR eq_op BINDING (VARCHAR2, VARCHAR2) RETURN NUMBER USING eq_f;