Home | Previous Page | Next Page   The Embedded SQLJ Language > Handling Result Sets >

Using Column Aliases

When an expression returned by a SELECT statement has an SQL name that is not a valid Java identifier, use SQL column aliases to rename them. For example, the name Not valid for Java is acceptable as a column name in SQL, but not as a Java identifier. You can use a column alias that has a name acceptable as a Java identifier by using the AS clause:

SELECT "Not valid for Java" AS "Col1" FROM tablename

When you create a named iterator class for this query, you specify the column alias name for the Java variable, as in:

#sql iterator Iterator_name (String Col1);
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]