SQLite zeroblob() Function

The SQLite zeroblob() function returns a blob containing the given number of bytes of 0x00.

Syntax

Here is the syntax of the SQLite zeroblob() function:

zeroblob(n)

Parameters

n

Required. number of bytes.

Return value

The SQLite zeroblob() function returns a blob containing n bytes of 0x00.

Examples

To generate a blob containing a byte of 0x00, use the following statement:

SELECT hex(zeroblob(1));
hex(zeroblob(1))
----------------
00

Here, we use the hex() function to convert the result of zeroblob(1) to its hexadecimal representation.

To generate a blob containing 10 random bytes, use the following statement:

SELECT hex(zeroblob(10));
hex(zeroblob(10))
--------------------
00000000000000000000