EJB query contains scalar built-in functions, as listed below, for doing type conversions, string manipulation, and for manipulating date-time values.
Numeric functions
ABS ( < any numeric datatype > ) -> < any numeric datatype >
MOD ( <int>, <int> ) -> int
SQRT ( < any numeric datatype > ) -> Double
Type conversion functions
CHAR ( < any numeric datatype > ) -> string CHAR ( < string > ) -> string CHAR ( < any datetime datatype > [, Keyword k ]) -> string
Datetime datatype is converted to its string representation in a format specified by the keyword k. The valid keywords values are ISO, USA, EUR or JIS. If k is not specified the default is ISO.
BIGINT ( < any numeric datatype > ) -> Long BIGINT ( < string > ) -> Long
DATE ( < date string > ) -> Date DATE ( < any numeric datatype>) -> Date
DATE( timestamp ) -> Date DATE ( < timestamp-string > ) -> Date
DECIMAL ( < any numeric datatype > [, p [ ,s ] ] ) -> Decimal
DECIMAL ( < string > [ , p [ , s ] ] ) -> Decimal
DOUBLE ( < any numeric datatype > ) -> Double DOUBLE ( < string > ) -> Double
FLOAT ( < any numeric datatype > ) -> Double FLOAT ( < string > ) -> DoubleFloat is a synonym for DOUBLE.
INTEGER ( < any numeric datatype > ) -> Integer INTEGER ( < string > ) -> Integer
REAL ( < any numeric datatype > ) -> Float
SMALLINT ( < any numeric datatype ) -> Short SMALLINT ( < string > ) -> Short
TIME ( < time > ) -> Time TIME ( < time-string > ) -> Time TIME ( < timestamp > ) -> Time TIME ( < timestamp-string > ) -> Time
TIMESTAMP ( < timestamp > ) -> Timestamp TIMESTAMP ( < timestamp-string > ) -> Timestamp
String functions
CONCAT ( <string>, <string> ) -> String
DIGITS ( Decimal d ) -> String
LENGTH ( < string > ) -> Integer
LCASE ( < string > ) -> String
LOCATE ( String s1 , String s2 [, Integer start ] ) -> Integer
SUBSTRING ( String s , Integer m [ , Integer n ] ) -> String
UCASE ( < string > ) -> String
Date - time functions
DAY ( Date ) -> Integer DAY ( < date-string > ) -> Integer DAY ( < date-duration > ) -> Integer DAY ( Timestamp ) -> Integer DAY ( < timestamp-string > ) -> Integer DAY ( < timestamp-duration > ) -> Integer
DAYS ( Date ) -> Integer DAYS ( < Date-string > ) -> Integer DAYS ( Timestamp ) -> Integer DAYS ( < timestamp-string > ) -> Integer
HOUR ( Time ) -> Integer HOUR ( < time-string > ) -> Integer HOUR ( < time-duration > ) -> Integer HOUR ( Timestamp ) -> Integer HOUR ( < timestamp-string > ) -> Integer HOUR ( < timestamp-duration > ) -> Integer
MICROSECOND ( Timestamp ) -> Integer MICROSECOND ( < timestamp-string > ) -> Integer MICROSECOND ( < timestamp-duration > ) -> Integer
MINUTE ( Time ) -> Integer MINUTE ( < time-string > ) -> Integer MINUTE ( < time-duration > ) -> Integer MINUTE ( Timestamp ) -> Integer MINUTE ( < timestamp-string > ) -> Integer MINUTE ( < timestamp-duration > ) -> Integer
MONTH ( Date ) -> Integer MONTH ( < date-string > ) -> Integer MONTH ( < date-duration > ) -> Integer MONTH ( Timestamp ) -> Integer MONTH ( < timestamp-string > ) -> Integer MONTH ( < timestamp-duration > ) -> Integer
SECOND ( Time ) -> Integer SECOND ( < time-string > ) -> Integer SECOND ( < time-duration > ) -> Integer SECOND ( Timestamp ) -> Integer SECOND ( < timestamp-string > ) -> Integer SECOND ( < timestamp-duration > ) -> Integer
YEAR ( Date ) -> Integer YEAR ( < date-string > ) -> Integer YEAR ( < date-duration > ) -> Integer YEAR ( Timestamp ) -> Integer YEAR ( < timestamp-string > ) -> Integer YEAR ( < timestamp-duration > ) -> Integer
Related concepts
Scalar functions
EJB query language