Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books
SQL Server Books
Oracle Software
image
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
  Phone
  252-431-0050
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

    Privacy Policy

 

   
  Oracle Tips by Burleson

Oracle10g Example use of the EVALUATE Operator

The following example query uses the VARCHAR form of data item generated by the getVarchar( ) function:

SQL> SELECT * FROM Boaters WHERE

   2 EVALUATE (Boaters.Interest,

   3 Boat4Sale(’Sea ray’, 2002, 9000, 0).getVarchar ()) = 1;

 

 BID ZIPCODE PHONE        INTEREST

---- ------- ------------ ----------------------------------------------------

   1   32611 917 768 4633 Model=>'Sea ray' and Price<10000 and EngineHours<250

For the previous query, the data item can be passed in the AnyData form with the following syntax:

SQL> SELECT * FROM Boaters WHERE

EVALUATE (Boaters.Interest,

AnyData.convertObject (

Boat4Sale (’Sea ray’,2002,9000,0))) = 1;

BID ZIPCODE PHONE        INTEREST

---- ------- ------------ ----------------------------------------------------

   1   32611 917 768 4633 Model=>'Sea ray' and Price<10000 and EngineHours<250

When a large set of Expressions are stored in a table, the table storing the Expressions can be joined with the table storing data items to be evaluated. For example, let's say we have a used boats table that looks like so:

SQL> DESC USED_BOATS

 

Name         Datatype

---------    ----------

SELLER_ID    NUMBER

MODEL        VARCHAR2(20)

YEAR         NUMBER

PRICE        NUMBER

ENGINEHOURS  NUMBER

LENGTH       NUMBER

We could compare our list of Boaters and their expressed desires to our list of used boats using the following syntax:

SELECT u.seller_id, b.bid, b.Phone

FROM Boaters c, Used_boats u

WHERE

EVALUATE (b.Interest,

Boat4Sale(u.Model, u.Year, u.Price, u.EngineHours).getVarchar()) = 1

ORDER BY u.seller_id;

Of course, if we have a bunch of data and a bunch of Expressions, the comparisons can get pretty complicated and performance can suffer. To help with this, the Expressions can be indexed. Lets look at the concept of the Expression Index next.


Get the complete Oracle10g story:

The above text is an excerpt from "Oracle Database 10g New Features: Oracle10g Reference for Advanced Tuning and Administration", by Rampant TechPress.  Written by top Oracle experts, this book has a complete online code deport with ready to use scripts. 

To get the code instantly, click here:

http://www.rampant-books.com/book_2003_2_oracle10g.htm

http://rampant-books.com/book_2003_2_audit.htm

 

Download your Oracle scripts now:

www.oracle-script.com

The definitive Oracle Script collection for every Oracle professional DBA

 

Linux Oracle commands syntax poster

wise Oracle tuning software

Oracle data dictionary reference poster

Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation.
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks