This section describes functions and operators for examining and manipulating BLOB values.
| Name | Description |
|---|---|
blob || blob |
BLOB concatenation. |
base64(blob) |
Converts a blob to a base64 encoded string. |
decode(blob) |
Converts blob to VARCHAR. Fails if blob is not valid UTF-8. |
encode(string) |
Converts the string to BLOB. Converts UTF-8 characters into literal encoding. |
from_base64(string) |
Converts a base64 encoded string to a character string (BLOB). |
from_binary(value) |
Converts a value from binary representation to a blob. |
from_hex(value) |
Converts a value from hexadecimal representation to a blob. |
hex(blob) |
Converts blob to VARCHAR using hexadecimal encoding. |
octet_length(blob) |
Number of bytes in blob. |
read_blob(source) |
Returns the content from source (a filename, a list of filenames, or a glob pattern) as a BLOB. See the read_blob guide for more details. |
to_base64(blob) |
Converts a blob to a base64 encoded string. |
to_hex(blob) |
Converts blob to VARCHAR using hexadecimal encoding. |
unbin(value) |
Converts a value from binary representation to a blob. |
unhex(value) |
Converts a value from hexadecimal representation to a blob. |
blob || blob
| Description | BLOB concatenation. |
| Example | '\xAA'::BLOB || '\xBB'::BLOB |
| Result | \xAA\xBB |
base64(blob)
| Description | Converts a blob to a base64 encoded string. |
| Example | base64('A'::BLOB) |
| Result | QQ== |
decode(blob)
| Description | Convert blob to VARCHAR. Fails if blob is not valid UTF-8. |
| Example | decode('\xC3\xBC'::BLOB) |
| Result | ü |
encode(string)
| Description | Converts the string to BLOB. Converts UTF-8 characters into literal encoding. |
| Example | encode('my_string_with_ü') |
| Result | my_string_with_\xC3\xBC |
from_base64(string)
| Description | Converts a base64 encoded string to a character string (BLOB). |
| Example | from_base64('QQ==') |
| Result | A |
from_binary(value)
| Description | Converts a value from binary representation to a blob. |
| Example | unbin('0110') |
| Result | \x06 |
from_hex(value)
| Description | Converts a value from hexadecimal representation to a blob. |
| Example | unhex('2A') |
| Result | * |
hex(blob)
| Description | Converts blob to VARCHAR using hexadecimal encoding. |
| Example | hex('\xAA\xBB'::BLOB) |
| Result | AABB |
octet_length(blob)
| Description | Number of bytes in blob. |
| Example | octet_length('\xAA\xBB'::BLOB) |
| Result | 2 |
read_blob(source)
| Description | Returns the content from source (a filename, a list of filenames, or a glob pattern) as a BLOB. See the read_blob guide for more details. |
| Example | read_blob('hello.bin') |
| Result | hello\x0A |
to_base64(blob)
| Description | Converts a blob to a base64 encoded string. |
| Example | base64('A'::BLOB) |
| Result | QQ== |
to_hex(blob)
| Description | Converts blob to VARCHAR using hexadecimal encoding. |
| Example | hex('\xAA\xBB'::BLOB) |
| Result | AABB |
unbin(value)
| Description | Converts a value from binary representation to a blob. |
| Example | unbin('0110') |
| Result | \x06 |
unhex(value)
| Description | Converts a value from hexadecimal representation to a blob. |
| Example | unhex('2A') |
| Result | * |
© 2026 DuckDB Foundation, Amsterdam NL