Searching

DB2 Net Search Extender provides the following methods for searching text:

SQL scalar search functions
These enable you to include text search subqueries in SQL queries. Net Search Extender provides these functions in addition to those normally available in SQL.
A stored procedure search function
This enables you to return predefined cached result tables.
An SQL Table-Valued Function
You can use this search in a similar way to the stored procedure.

For SQL scalar search functions, the chapter describes the following areas:

For the stored procedure search function, the chapter describes the following areas:

For the SQL Table-Valued Function, the chapter describes the following areas:

There is also information on search performance considerations that you may need to take into account.

Before searching, ensure that all the appropriate indexing steps, described in Creating and maintaining a text index, involving the different data types are considered.

Note

The system shell interprets special characters such as ?, (, ), *, !, and ". Therefore, if the command contains these characters, you must use quotation marks or an escape character.

Here is an example of a UNIX command that uses special characters:

db2 "SELECT * from sample WHERE CONTAINS (DESCRIPTION, '\"enable\"') = 1"