Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11
VARBINARY (byte[])
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The VARBINARY
data type represents a variable length binary type, or byte[]
in Java, or Types.VARBINARY
in JDBC.
Given the variable size characteristic, the VARBINARY
type may or may not be accompanied by an explicit length flag. If absent, the default in most dialects is to set the maximum length available.
DDL support
Dialect support
This example using jOOQ:
createTable("t").column("c", VARBINARY(16))
Translates to the following dialect specific expressions:
Access
CREATE TABLE t ( c binary(16) )
ASE, Sybase
CREATE TABLE t ( c varbinary(16) NULL )
Aurora MySQL, DuckDB, Exasol, H2, HSQLDB, Hana, MariaDB, MemSQL, MySQL, SQLDataWarehouse, SQLServer, Snowflake, Vertica
CREATE TABLE t ( c varbinary(16) )
Aurora Postgres, Postgres, YugabyteDB
CREATE TABLE t ( c bytea )
BigQuery, CockroachDB
CREATE TABLE t ( c bytes )
ClickHouse
CREATE TABLE t ( c Nullable(varbinary(16)) ) ENGINE Log()
Databricks
CREATE TABLE t ( c binary ) TBLPROPERTIES( 'delta.columnMapping.mode' = 'name', 'delta.feature.allowColumnDefaults' = 'supported' )
DB2, Derby, Firebird, SQLite
CREATE TABLE t ( c blob(16) )
Informix
CREATE TABLE t ( c byte )
Oracle
CREATE TABLE t ( c blob )
Redshift
CREATE TABLE t ( c varbyte )
Teradata
CREATE TABLE t ( c varbyte(16) )
Trino
CREATE TABLE t ( c varbinary )
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
cast(field("c"), VARBINARY(16))
Translates to the following dialect specific expressions:
Access
cstr(c)
ASE, DuckDB, Exasol, H2, HSQLDB, Hana, SQLDataWarehouse, SQLServer, Snowflake, Sybase, Vertica
CAST(c AS varbinary(16))
Aurora MySQL, MariaDB, MemSQL, MySQL
CAST(c AS binary(16))
Aurora Postgres, Postgres, YugabyteDB
CAST(c AS bytea)
BigQuery, CockroachDB
CAST(c AS bytes)
ClickHouse
CAST(c AS Nullable(varbinary(16)))
Databricks
CAST(c AS binary)
DB2, Derby, Firebird, SQLite
CAST(c AS blob(16))
Informix
CAST(c AS byte)
Oracle
to_blob(c)
Redshift
CAST(c AS varbyte)
Teradata
CAST(c AS varbyte(16))
Trino
CAST(c AS varbinary)
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!