Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
Operators, 10 of 10
Like built-in operators, user-defined operators take a set of operands as input and return a result. However, you create them with the CREATE OPERATOR
statement, and they are identified by names (e.g., MERGE
). They reside in the same namespace as tables, views, types, and stand-alone functions.
Once you have defined a new operator, you can use it in SQL statements like any other built-in operator. For example, you can use user-defined operators in the select list of a SELECT
statement, the condition of a WHERE
clause, or in ORDER BY
clauses and GROUP BY
clauses. However, you must have EXECUTE
privilege on the operator to do so, because it is a user-defined object.
For example, if you define an operator CONTAINS
, which takes as input a text document and a keyword and returns 1 if the document contains the specified keyword, you can then write the following SQL query:
SELECT * FROM emp WHERE contains (resume, 'Oracle and UNIX') = 1;
See Also:
"CREATE OPERATOR" and Oracle8i Data Cartridge Developer's Guide for more information on user-defined operators. |
|
Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|