10.2. PLVtkn: Managing PL/SQL Tokens
The PLVtkn (PL/Vision ToKeN) package determines whether an identifier is a PL/SQL keyword. It does this by using a token table containing these keywords.
Every PL/SQL program is filled with identifiers. Identifiers are named PL/SQL language elements and include variable names, program names, and reserved words. Reserved words play a very different role in our programs than do the application-specific identifiers. I recommend strongly in Oracle PL/SQL Programming that you reflect these different roles in your program by using the UPPER-lower method: all reserved words are typed in UPPER case and all application-specific identifiers are typed in lower case. I even go so far, in PL/Vision, as to provide you with a package (PLVcase) which will automatically convert your programs to the UPPER-lower method.
10.2.1. Keeping Track of PL/SQL Keywords
Well, if PLVcase is going to uppercase only keywords, it has to know which identifiers in a PL/SQL program are the reserved words. This information is maintained in the PLV_token table, which has the following structure:
Name Null? Type ------------------------------- -------- ---- TOKEN NOT NULL VARCHAR2(100) TOKEN_TYPE VARCHAR2(10)
where the token column is the identifier and token_type indicates the type.
The different token types in the PLV_token table are stored in the PLV_token_type table, which has this structure:
Name Null? Type ------------------------------- -------- ---- TOKEN_TYPE VARCHAR2(10) ...
Get Advanced Oracle PL/SQL Programming with Packages now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.