![]() |
SQL-J Language Reference
|
Reference Manual |
Conditional (?:)You can place a conditional expression anywhere an expression is allowed. It chooses an expression to evaluate based on a boolean test. SyntaxBooleanExpression ? ThenExpression : ElseExpression ThenExpression and ElseExpression are both expressions that must be type-compatible. For built-in types, this means that the types must be the same or a built-in broadening conversion must exist between the types. For Java data types, this means that the types must be the same or one of the types must be assignable to the other one due to a super/subclass or interface/implementor relationship. You do not need to use the conditional expression for avoiding NullPointerExceptions when a nullable column becomes a method receiver. If the value of the instance specified in an instance method invocation is null, the result of the invocation is null (SQL-J NULL). However, you still may need to use the conditional expression for when a nullable column is a primitive method parameter; the conditional expression is a good way of doing that. Conditional (?:) Example
--if there's no matching city_id (null), display a 0
-- If business_seats_taken has any nulls, you'll get an exception
-- using the conditional expression, you can "convert" any |
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |