Using Cloudscape’s Java Extensions,
Page 8 of 12


[top]
[prev]
[next]
Documentation Top
Global Index
Reference Manual
TOC Index
Grammar index
Developer's Guide
TOC Index
Tuning Cloudscape
TOC Index

Other Java-Smart Syntax in SQL-J

SQL-J syntax includes other elements borrowed from Java syntax to facilitate working with Java objects and classes. It includes the keyword INSTANCEOF, which allows you to test whether an object belongs to a particular class. This is useful if you are storing objects that are members of a subclass in a column associated with a superclass data type.

SQL-J also includes the NEW keyword, which allows you to construct new objects within an SQL-J statement:

VALUES NEW java.lang.String('hello, world!')
SELECT NEW JBMSTours.Hotel(
    hotel_id, hotel_name, city_id, tour_level,
    normal_rate, high_season_rate,
    number_rooms_in_block,
    high_season_begin, high_season_end)
FROM Hotels

The conditional expression (?:) provides simple if-then control:

SELECT city.getName() IS NULL ? 'no name'
    : city.getName()
FROM Cities

For more information on these commands, see their manual pages in the Cloudscape Reference Manual.

[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.