SQL-J Language Reference
Page 118 of 121

INSTANCEOF Expression

An INSTANCEOF expression evaluates to a BOOLEAN. It returns TRUE if the type of the expression is an implementation or subtype of the JavaClassName type. If the expression evaluates to NULL, the INSTANCEOF expression returns FALSE.

Syntax

Expression INSTANCEOF [ JavaClassName | ClassAlias ]

In the situation in which a class alias and a Java class name shared the same name, Cloudscape finds the Java class name first.

INSTANCEOF Expression Examples

SELECT * FROM People
WHERE person INSTANCEOF JBMSTours.serializabletypes.Adult

-- Adult is a class alias
SELECT * FROM People
WHERE person INSTANCEOF Adult

-- Verifying the type of a class's field
SELECT customized_tour->begin INSTANCEOF java.sql.Date
FROM CustomizedTours