Oracle Text Reference Release 9.0.1 Part Number A90121-01 |
|
CTX_DOC Package , 10 of 10
Use this procedure to identify all text tokens in a document. The tokens returned are those tokens which are inserted into the index. This feature is useful for implementing document classification, routing, or clustering.
Stopwords are not returned. Section tags are not returned because they are not text tokens.
CTX_DOC.TOKENS(index_name IN VARCHAR2, textkey IN VARCHAR2, restab IN OUT NOCOPY TOKEN_TAB);
CTX_DOC.TOKENS(index_name IN VARCHAR2, textkey IN VARCHAR2, restab IN VARCHAR2, query_id IN NUMBER DEFAULT 0);
Specify the name of the index for the text column.
Specify the unique identifier (usually the primary key) for the document.
The textkey parameter can be one of the following:
You toggle between primary key and rowid identification using CTX_DOC.SET_KEY_TYPE.
You can specify that this procedure store results to either a table or to an in-memory PL/SQL table.
The tokens returned are those tokens which are inserted into the index for the document (or row) named with textkey
. Stop words are not returned. Section tags are not returned because they are not text tokens.
To store results to a table, specify the name of the table. Token tables can be named anything, but must include the following columns, with names and data types as specified.
To store results to an in-memory table, specify the name of the in-memory table of type TOKEN_TAB. The TOKEN_TAB datatype is defined as follows:
type token_rec is record (token varchar2(64); offset number; length number;); type token_tab is table of token_rec index by binary_integer;
CTX_DOC.TOKENS clears the TOKEN_TAB you specify before the operation.
Specify the identifier used to identify the row(s) inserted into restab
.
The following example generates the tokens for document 1 and stores them in an in-memory table, declared as the_tokens
. The example then loops through the table to display the document tokens.
declare the_tokens ctx_doc.token_tab; begin ctx_doc.tokens('myindex','1',the_tokens); for i in 1..the_tokens.count loop dbms_output.put_line(the_tokens(i).token); end loop; end;
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|