A.2 Constant Values

There are four basic types of constants: string, number, Boolean, and date.

String

A string value is a quoted character sequence. Both single quotes and double quotes are accepted.

city = 'New York'

  or

city = "New York"

If a single or double quote is part of the string value, it needs to be escaped if the value is quoted using the same character. To escape a quote character, repeat the character twice, e.g.,

'Seven O''Clock'

Number

A number can be either an integer or a double.

age > 55

A double number can be entered using either decimal notation, or scientific notation,

ratio < 2.5

Numeric comparison is always done in double values. Therefore, an integer 50 does not equal a double 50.1. All arithmetic computation is also done in doubles. All values are converted to a double before the computation is performed. A division of two integer numbers results in a double value. No rounding is done regardless of the type of the operands.

Boolean

A Boolean constant is specified using 'true' or 'false'. The case is insignificant.

instock = true

Date

There is no date constant in an expression. Instead, converting a text representation of a date to a date object can create a date value. The conversion is done using the to_date() function.

birthday > to_date("1960-12-31")

The default date format is the same as for SQL, yyyy-MM-dd. An alternative date format can be supplied in the second argument of the function call:

birthday > to_date("12/31/60 12:00:00","MM/dd/yy HH:mm:ss")

The format should conform to the format defined in the java.text.SimpleDateFormat class:

Symbol

Meaning

Presentation

Example

G

era designator

Text

AD

y

year

Number

1996

M

month in year

Text & Number

July & 07

d

day in month

Number

10

h

hour in am/pm (1~12)

Number

12

H

hour in day (0~23)

Number

0

m

minute in hour

Number

30

s

seond in minute

Number

55

S

millisecond

Number

978

E

day in week

Text

Tuesday

D

day in year

Number

189

F

day of week in month

Number

2 (2nd Web in July)

w

week in year

Number

27

W

week in month

Number

2

a

am/pm marker

Text

PM

k

hour in day (1~24)

Number

24

K

hour in am/pm (0~11)

Number

0

z

time zone

Text

Pacific Standard Time

'

escape for text

Delimiter

 

''

single quote

Literal

'

<< A.1.3 Variables © 1996-2013 InetSoft Technology Corporation (v11.5) A.3 Simple Expressions >>