|Oracle8i SQLJ Developer's Guide and Reference
There are four areas to consider in discussing naming requirements, naming restrictions, and reserved words:
The Java namespace applies to all of 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 executable SQL statement with a statement block, where the executable SQL 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 which 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 that.
oracle(case-sensitive). As another example, if your SQLJ statements use host variables whose type is the user-defined type
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 that is outside the curly braces.
Restrictions that are 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 that is 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, or 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 one of the defined classes.
For example, if you define the public class
MySource in your source file, then your file name must be
These file naming requirements are according to the Java Language Specification and are not SQLJ-specific. They do not apply in the Oracle8i server, but are still recommended.