skip to main content
SQL escape sequences for JDBC : Scalar functions
  

Try DataDirect Drivers Now

Scalar functions

This section describes the scalar functions that are supported by the JDBC drivers. Note that your database system may not support all these functions. The following table documents the functions supported by individual drivers. Refer to the documentation for your database system to find out which functions are supported by your database.
In addition, you can also determine the supported scalar functions by using DatabaseMetaData methods.
You can use scalar functions in SQL statements with the following syntax:
{fn scalar-function}
where:
scalar-function
is a scalar function supported by the drivers, as listed in the following table.
Example:
SELECT id, name FROM emp WHERE name LIKE {fn UCASE('Smith')}
Table 4. Supported Scalar Functions
Data Store
String Functions
Numeric Functions
Timedate Functions
System Functions
Apache Cassandra
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURTIME
DATEDIFF
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
SECONDS_SINCE_MIDNIGHT
TIMESTAMPADD
TIMESTAMPDIFF
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
Apache Hive
ASCII
CONCAT
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE2
LTRIM
REPEAT
REPLACE
RIGHT
RTRIM
SPACE
SUBSTRING
UCASE
ABS
ACOS
ASIN
ATAN
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MODP
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
TAN
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DAYOFMONTH
EXTRACT
HOUR
MINUTE
MONTH
NOW
QUARTER
SECOND
TIMESTAMPADD 1
TIMESTAMPDIFF
WEEK
YEAR
DBNAME
IFNULL
Apache Spark SQL
ASCII
CONCAT
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE2
LTRIM
REPEAT
REPLACE
RIGHT
RTRIM
SPACE
SUBSTRING
UCASE
ABS
ACOS
ASIN
ATAN
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MODP
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
TAN
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DAYOFMONTH
EXTRACT
HOUR
MINUTE
MONTH
NOW
QUARTER
SECOND
TIMESTAMPADD 2
TIMESTAMPDIFF
WEEK
YEAR
DBNAME
IFNULL
Autonomous REST Connector
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATEDIFF
DATE_ADD
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
SECONDS_SINCE_MIDNIGHT
TIMESTAMPADD
TIMESTAMPDIFF
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
Jira
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATEDIFF
DATE_ADD
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
SECONDS_SINCE_MIDNIGHT
TIMESTAMPADD
TIMESTAMPDIFF
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
MongoDB
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURTIME
DATEDIFF
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
SECONDS_SINCE_MIDNIGHT
TIMESTAMPADD
TIMESTAMPDIFF
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
Oracle
ASCII
BIT_LENGTH
CHAR
CONCAT
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE2
LTRIM
OCTET_LENGTH
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTRING
UCASE
ABS
ACOS
ASIN
ATAN
ATAN2
CEILING
COS
COT
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
ROUND
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
WEEK
YEAR
IFNULL
USER
Oracle Eloqua
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURTIME
DATEDIFF
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
SECOND
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
IFNULL
Oracle Sales Cloud
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURTIME
DATEDIFF
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
SECOND
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
IFNULL
Salesforce
ASCII
BIT_LENGTH
CHAR
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
DIFFERENCE
HEXTORAW
INSERT
LCASE
LEFT
LENGTH
LOCATE
LOCATE_2
LOWER
LTRIM
OCTET_LENGTH
RAWTOHEX
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTR
SUBSTRING
UCASE
UPPER
ABS
ACOS
ASIN
ATAN
ATAN2
BITAND
BITOR
BITXOR
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
ROUNDMAGIC
SIGN
SIN
SQRT
TAN
TRUNCATE
CURDATE
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURTIME
DATEDIFF
DATE_ADD
DATE_SUB
DAY
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
SECONDS_SINCE_MIDNIGHT
TIMESTAMPADD
TIMESTAMPDIFF
TO_CHAR
WEEK
YEAR
CURSESSIONID
DATABASE
IDENTITY
USER
SQL Server
ASCII
CHAR
CONCAT
DIFFERENCE
INSERT
LCASE
LEFT
LENGTH
LOCATE
LTRIM
REPEAT
REPLACE
RIGHT
RTRIM
SOUNDEX
SPACE
SUBSTRING
UCASE
ABS
ACOS
ASIN
ATAN
ATAN2
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
MOD
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQRT
TAN
TRUNCATE
DAYNAME
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
EXTRACT
HOUR
MINUTE
MONTH
MONTHNAME
NOW
QUARTER
SECOND
TIMESTAMPADD
TIMESTAMPDIFF
WEEK
YEAR
DATABASE
IFNULL
USER

1 Apache Hive is limited to adding only days to a timestamp.

2 Apache Spark SQL is limited to adding only days to a timestamp.

* String functions
* Numeric functions
* Date and time Functions
* System functions