|Oracle8i SQLJ Developer's Guide and Reference
Release 3 (8.1.7)
Part Number A83723-01
There are four areas to consider in discussing naming requirements, naming restrictions, and reserved words:
The Java namespace applies to all your standard Java statements and declarations, including the naming of Java classes and local variables. All standard Java naming restrictions apply, and you should avoid use of Java reserved words.
In addition, SQLJ places minor restrictions on the naming of local variables and classes.
Naming restrictions particular to host variables are discussed in "Restrictions on Host Expressions".
Some of the functionality of the SQLJ translator results in minor restrictions in naming local variables.
The SQLJ translator replaces each SQLJ executable statement with a statement block, where the SQLJ executable statement is of the standard syntax:
SQLJ may use temporary variable declarations within a generated statement block. The name of any such temporary variables will include the following prefix:
(There are two underscores at the beginning and one at the end.)
The following declarations are examples of those that might occur in a SQLJ-generated statement block:
__sJT_ is a reserved prefix for SQLJ-generated variable names. SQLJ programmers must not use this string as a prefix for the following:
Be aware of the following minor restrictions in naming classes in SQLJ applications:
ais the name of an existing class in the SQLJ application:
b are legal Java identifiers)
For example, if your application class is
Foo in file
Foo.sqlj, SQLJ generates a profile-keys class called
Foo_SJProfileKeys. Do not declare a class name that conflicts with this.
oracle(case-sensitive). As another example, if your SQLJ statements use host variables whose type is
abc.def.MyClass, then you cannot use
abcas the name of the class that uses these host variables.
To avoid this restriction, follow Java naming conventions recommending that package names start in lowercase and class names start in uppercase.
The SQLJ namespace refers to
#sql class declarations and the portion of
#sql executable statements outside the curly braces.
Restrictions particular to the naming of iterator columns are discussed in "Using Named Iterators".
Avoid using the following SQLJ reserved words as class names for declared connection context classes or iterator classes, in
implements clauses, or in iterator column type declaration lists:
For example, do not have an iterator class or instance called
iterator or a connection context class or instance called
Note, however, that it is permissible to have a stored function return variable whose name is any of these words.
The SQL namespace refers to the portion of a SQLJ executable statement inside the curly braces. Normal SQL naming restrictions apply here.
Note, however, that host expressions follow rules of the Java namespace, not the SQL namespace. This applies to the name of a host variable and to everything between the outer parentheses of a host expression.
SQLJ source files have the
.sqlj file name extension. If the source file declares a public class (maximum of one), then the base name of the file must match the name of this class (case-sensitive). If the source file does not declare a public class, then the file name must still be a legal Java identifier, and it is recommended that the file name match the name of the first defined class.
For example, if you define the public class
MySource in your source file, then your file name must be: