start page | rating of books | rating of authors | reviews | copyrights

Advanced Oracle PL/SQL Programming with Packages

Advanced Oracle PL/SQL Programming with PackagesSearch this book
Previous: 5.25 PLVtab: Table Interface Chapter 5
PL/Vision Package Specifications
Next: 5.27 PLVtmr: Program Performance Analyzer
 

5.26 PLVtkn: Token Table Interface

The PLVtkn (PL/Vision ToKeN) package provides an interface to the PLV_token table; the package examines this table to determine whether an identifier is a keyword. See Chapter 10 for details.

5.26.1 Package constants

c_any CONSTANT CHAR(1) := '%';
c_syntax CONSTANT CHAR(1) := 'X';
c_builtin CONSTANT CHAR(1) := 'B';
c_symbol CONSTANT CHAR(1) := 'S';
c_exception CONSTANT CHAR(1) := 'E';
c_datatype CONSTANT CHAR(1) := 'D';
c_datadict CONSTANT CHAR(2) := 'DD';
c_sql CONSTANT CHAR(3) := 'SQL';

Each of these constants specify a different type of token or reserved word in the PL/SQL language (except for c_any , of course). They match the values found in the PLV_ token_type table. They are used by various programs in the PLVtkn package.

c_plsql CONSTANT CHAR(1) := '%'; /* = c_builtin */
c_od2k CONSTANT CHAR(4) := 'OD2K';
c_of CONSTANT CHAR(2) := 'OF';
c_or CONSTANT CHAR(2) := 'OR';
c_og CONSTANT CHAR(2) := 'OG';

These constants identify different categories or sets of reserved words for the PL/SQL language. The identifier SHOW_ALERT is, for example, a builtin in Oracle Forms, but has no significance in the stored PL/SQL code. Currently PL/Vision is aware of stored PL/SQL and Oracle Forms reserved words only.

5.26.2 The keyword record TYPE

TYPE kw_rectype IS RECORD
(token PLV_token%token,
token_type PLV_token%token_type,
is_keyword BOOLEAN);

A PL/SQL record TYPE defining a record holding information about a token.

5.26.3 Determining type of token

FUNCTION is_keyword
(token_in IN VARCHAR2, type_in IN VARCHAR2 := c_any)
RETURN BOOLEAN;

General function that returns TRUE if the specified token is a keyword or a reserved word in the PL/SQL language. You can, with the type_in argument, ask if the token is a particular type of token. You can also call any of the following more narrowly defined functions:

FUNCTION is_syntax (token_in IN VARCHAR2) RETURN BOOLEAN;
FUNCTION is_builtin (token_in IN VARCHAR2) RETURN BOOLEAN;
FUNCTION is_symbol (token_in IN VARCHAR2) RETURN BOOLEAN;
FUNCTION is_datatype (token_in IN VARCHAR2) RETURN BOOLEAN;
FUNCTION is_exception (token_in IN VARCHAR2) RETURN BOOLEAN;

Each of these functions returns TRUE if the specified token is an identifier of the type indicated by the name of the function.

5.26.4 Retrieving keyword information

PROCEDURE get_keyword (token_in IN VARCHAR2, kw OUT kw_rectype);

Retrieves all the information about the token provided in the parameter list.


Previous: 5.25 PLVtab: Table Interface Advanced Oracle PL/SQL Programming with Packages Next: 5.27 PLVtmr: Program Performance Analyzer
5.25 PLVtab: Table Interface Book Index 5.27 PLVtmr: Program Performance Analyzer

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference