Oracle9i SQL Reference
Release 1 (9.0.1)

Part Number A90125-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

SQL Statements:
CREATE LIBRARY to CREATE SPFILE, 5 of 16


CREATE OPERATOR

Purpose

Use the CREATE 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.

See Also:

Oracle9i Data Cartridge Developer's Guide and Oracle9i Database Concepts for a discussion of these dependencies and of operators in general 

Prerequisites

To create an operator in your own schema, you must have CREATE OPERATOR system privilege. To create an operator in another schema, you must have the CREATE ANY OPERATOR system privilege. In either case, you must also have EXECUTE privilege on the functions and operators referenced.

Syntax

create_operator::=


Text description of statements_619.gif follows
Text description of create_operator

binding_clause::=


Text description of statements_69a.gif follows
Text description of binding_clause

implementation_clause::=


Text description of statements_620.gif follows
Text description of implementation_clause

context_clause::=


Text description of statements_621.gif follows
Text description of context_clause

using_function_clause::=


Text description of statements_622.gif follows
Text description of using_function_clause

Keywords and Parameters

OR REPLACE

Specify OR REPLACE to replace the definition of the operator schema object.

Restriction: You can replace the definition only if the operator has no dependent objects (for example, indextypes supporting the operator).

schema

Specify the schema containing the operator. If you omit schema, Oracle creates the operator in your own schema.

operator

Specify the name of the operator to be created.

binding_clause

Use the 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.

The parameter_type can itself be an object type. If it is, you can optionally qualify it with its schema.

Restriction: You cannot specify a parameter_type of REF, LONG, or LONG RAW.

See Also:

PL/SQL User's Guide and Reference for more information about overloading 

RETURN Clause

Specify the return datatype for the binding.

The return_type can itself be an object type. If so, you can optionally qualify it with its schema.

Restriction: You cannot specify a return_type of REF, LONG, or LONG RAW.

implementation_clause

ANCILLARY TO Clause

Use the ANCILLARY 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

Use the context_clause to specify the name of the implementation type used by the functional implementation of the operator as a scan context.

COMPUTE ANCILLARY DATA

Specify COMPUTE ANCILLARY DATA to indicate that the operator binding computes ancillary data.

using_function_clause

The 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.

Example

CREATE OPERATOR Example

This example creates an operator called MERGE in the scott schema with two bindings. The first binding is for merging two VARCHAR2 values and returning a VARCHAR2 result. The second binding is for merging two geometries into a single geometry. The corresponding functional implementations for the bindings are also specified. (The example assumes that the text.merge and spatial.merge functions have been declared.)

CREATE OPERATOR oe.merge 
BINDING (varchar2, varchar2) RETURN varchar2 
         USING text.merge, 
   (spatial.geo, spatial.geo) RETURN spatial.geo 
         USING spatial.merge; 

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback