You can specify functions in JDBC escape syntax by using the fn keyword.
{ fn functionCall }
where functionCall is the name of one of the scalar functions listed below. The functions are of the following types:
abs ( numericExpression )
The JDBC escape syntax {fn abs(numericExpression)} is equivalent to the built-in syntax ABS(numericExpression). For more information, see ABS or ABSVAL function.
acos ( number )
The JDBC escape syntax {fn acos(number)} is equivalent to the built-in syntax ACOS(number). For more information, see ACOS function.
asin ( number )
The JDBC escape syntax {fn asin(number)} is equivalent to the built-in syntax ASIN(number). For more information, see ASIN function.
atan ( number )
The JDBC escape syntax {fn atan(number)} is equivalent to the built-in syntax ATAN(number). For more information, see ATAN function.
atan2 ( y, x )
The JDBC escape syntax {fn atan2(y, x)} is equivalent to the built-in syntax ATAN2(y, x). For more information, see ATAN2 function.
ceiling ( number )
The JDBC escape syntax {fn ceiling(number)} is equivalent to the built-in syntax CEILING(number). For more information, see CEIL or CEILING function.
cos ( number )
The JDBC escape syntax {fn cos(number)} is equivalent to the built-in syntax COS(number). For more information, see COS function.
cot ( number )
The JDBC escape syntax {fn cot(number)} is equivalent to the built-in syntax COT(number). For more information, see COT function.
degrees ( number )
The JDBC escape syntax {fn degrees(number)} is equivalent to the built-in syntax DEGREES(number). For more information, see DEGREES function.
exp ( number )
The JDBC escape syntax {fn exp(number)} is equivalent to the built-in syntax EXP(number). For more information, see EXP function.
floor ( number )
The JDBC escape syntax {fn floor(number)} is equivalent to the built-in syntax FLOOR(number). For more information, see FLOOR function.
log ( number )
The JDBC escape syntax {fn log(number)} is equivalent to the built-in syntax LOG(number). For more information, see LN or LOG function.
log10 ( number )
The JDBC escape syntax {fn log10(number)} is equivalent to the built-in syntax LOG10(number). For more information, see LOG10 function.
mod ( integerExpression, integerExpression )
The JDBC escape syntax {fn mod(integerExpression, integerExpression)} is equivalent to the built-in syntax MOD(integerExpression, integerExpression). For more information, see MOD function.
pi ( )
The JDBC escape syntax {fn pi()} is equivalent to the built-in syntax PI(). For more information, see PI function.
radians ( number )
The JDBC escape syntax {fn radians(number)} is equivalent to the built-in syntax RADIANS(number). For more information, see RADIANS function.
rand ( seed )
The JDBC escape syntax {fn rand(seed)} is equivalent to the built-in syntax RAND(seed). For more information, see RAND function.
sign ( number )
The JDBC escape syntax {fn sign(number)} is equivalent to the built-in syntax SIGN(number). For more information, see SIGN function.
sin ( number )
The JDBC escape syntax {fn sin(number)} is equivalent to the built-in syntax SIN(number). For more information, see SIN function.
sqrt ( number )
The JDBC escape syntax {fn sqrt(number)} is equivalent to the built-in syntax SQRT(number). For more information, see SQRT function.
tan ( number )
The JDBC escape syntax {fn tan(number)} is equivalent to the built-in syntax TAN(number). For more information, see TAN function.
concat ( characterExpression, characterExpression )
The JDBC escape syntax {fn concat(characterExpression, characterExpression)} is equivalent to the built-in syntax characterExpression || characterExpression. For more information, see Concatenation operator.
lcase ( characterExpression )
The JDBC escape syntax {fn lcase(characterExpression)} is equivalent to the built-in syntax LCASE(characterExpression). For more information, see LCASE or LOWER function.
length ( characterExpression )
The JDBC escape syntax {fn length(characterExpression)} is equivalent to the built-in syntax LENGTH(characterExpression). For more information, see LENGTH function.
locate ( characterExpression, characterExpression [ , startIndex ] )
The JDBC escape syntax {fn locate(characterExpression, characterExpression [, startIndex] )} is equivalent to the built-in syntax LOCATE(characterExpression, characterExpression [, startPosition] ). For more information, see LOCATE function.
ltrim ( characterExpression )
The JDBC escape syntax {fn ltrim(characterExpression)} is equivalent to the built-in syntax LTRIM(characterExpression). For more information, see LTRIM function.
rtrim ( characterExpression )
The JDBC escape syntax {fn rtrim(characterExpression)} is equivalent to the built-in syntax RTRIM(characterExpression). For more information, see RTRIM function.
substring ( characterExpression, startIndex, length )
The JDBC escape syntax {fn substring(characterExpression, startIndex, length)} is equivalent to the built-in syntax SUBSTR(characterExpression, startIndex, length). For more information, see SUBSTR function.
ucase ( characterExpression )
The JDBC escape syntax {fn ucase(characterExpression)} is equivalent to the built-in syntax UCASE(characterExpression). For more information, see UCASE or UPPER function.
curdate ( )
The JDBC escape syntax {fn curdate()} is equivalent to the built-in syntax CURRENT_DATE. For more information, see CURRENT_DATE function.
curtime ( )
The JDBC escape syntax {fn curtime()} is equivalent to the built-in syntax CURRENT_TIME. For more information, see CURRENT_TIME function.
hour ( expression )
The JDBC escape syntax {fn hour(expression)} is equivalent to the built-in syntax HOUR(expression). For more information, see HOUR function.
minute ( expression )
The JDBC escape syntax {fn minute(expression)} is equivalent to the built-in syntax MINUTE(expression). For more information, see MINUTE function.
month ( expression )
The JDBC escape syntax {fn month(expression)} is equivalent to the built-in syntax MONTH(expression). For more information, see MONTH function.
second ( expression )
The JDBC escape syntax {fn second(expression)} is equivalent to the built-in syntax SECOND(expression). For more information, see SECOND function.
TIMESTAMPADD is a JDBC escaped function and is accessible only by using the JDBC escape function syntax.
TIMESTAMPADD ( interval, integerExpression, timestampExpression )
To perform TIMESTAMPADD on dates and times, it is necessary to convert the dates and times to timestamps. Dates are converted to timestamps by putting 00:00:00.0 in the time-of-day fields. Times are converted to timestamps by putting the current date in the date fields.
Do not put a datetime column inside a timestamp arithmetic function in WHERE clauses, because the optimizer will not use any index on the column.
The TIMESTAMPDIFF is a JDBC escaped function and is accessible only by using the JDBC escape function syntax.
TIMESTAMPDIFF ( interval, timestampExpression1, timestampExpression2 )
To perform TIMESTAMPDIFF on dates and times, it is necessary to convert the dates and times to timestamps. Dates are converted to timestamps by putting 00:00:00.0 in the time-of-day fields. Times are converted to timestamps by putting the current date in the date fields.
Do not put a datetime column inside a timestamp arithmetic function in WHERE clauses, because the optimizer will not use any index on the column.
year ( expression )
The JDBC escape syntax {fn year(expression)} is equivalent to the built-in syntax YEAR(expression). For more information, see YEAR function.
To return a timestamp value one month later than the current timestamp, use the following syntax:
{fn TIMESTAMPADD( SQL_TSI_MONTH, 1, CURRENT_TIMESTAMP)}
To return the number of weeks between now and the specified time on January 1, 2008, use the following syntax:
{fn TIMESTAMPDIFF(SQL_TSI_WEEK, CURRENT_TIMESTAMP, timestamp('2008-01-01-12.00.00.000000'))}
user ( )
The JDBC escape syntax {fn user()} is equivalent to the built-in syntax USER. For more information, see USER function.