Oracle Text Reference
Release 9.0.1

Part Number A90121-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 and Operators, 8 of 8


SCORE

Use the SCORE operator in a SELECT statement to return the score values produced by a CONTAINS query.

Syntax

SCORE(label NUMBER)
label

Specify a number to identify the score produced by the query. You use this number to identify the score in the CONTAINS clause.

Notes

The SCORE operator can be used in a SELECT, ORDER BY, or GROUP BY clause.

Example

Single CONTAINS

When the SCORE operator is called (e.g. in a SELECT clause), the CONTAINS clause must reference the score label value as in the following example:

SELECT SCORE(1), title from newsindex 
           WHERE CONTAINS(text, 'oracle', 1) > 0 ORDER BY SCORE(1) DESC;

Multiple CONTAINS

Assume that a news database stores and indexes the title and body of news articles separately. The following query returns all the documents that include the words Oracle in their title and java in their body. The articles are sorted by the scores for the first CONTAINS (Oracle) and then by the scores for the second CONTAINS (java).

SELECT title, body, SCORE(10), SCORE(20)

FROM news
WHERE CONTAINS (news.title, 'Oracle', 10) > 0 OR
CONTAINS (news.body, 'java', 20) > 0 
ORDER BY NVL(SCORE(10),0), NVL(SCORE(20),0);

Related Topics

CONTAINS

Appendix F, "Scoring Algorithm"


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