Oracle8i SQLJ Developer's Guide and Reference
Release 3 (8.1.7)

Part Number A83723-01





Go to previous page Go to beginning of chapter Go to next page

Naming Requirements and Restrictions

There are four areas to consider in discussing naming requirements, naming restrictions, and reserved words:

Java Namespace--Local Variable and Class Naming Restrictions

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".  

Local Variable Naming Restrictions

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:

#sql { SQL operation };  

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:

int __sJT_index;
Object __sJT_key;
java.sql.PreparedStatement __sJT_stmt;

The string __sJT_ is a reserved prefix for SQLJ-generated variable names. SQLJ programmers must not use this string as a prefix for the following:

Class Naming Restrictions

Be aware of the following minor restrictions in naming classes in SQLJ applications:

SQLJ Namespace

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 with or 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 context.

Note, however, that it is permissible to have a stored function return variable whose name is any of these words.

SQL Namespace

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.

File Name Requirements and Restrictions

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:



These file naming requirements follow the Java Language Specification and are not SQLJ-specific. These requirements do not directly apply in the Oracle8i server, but it is still advisable to adhere to them.  

Go to previous page
Go to beginning of chapter
Go to next page
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.