BLOB data type


Use the BLOB data type to represent arbitrary binary data of variable length.


type_specification ::= BLOB

blob_literal ::= "0x" [ hex_digit hex_digit ...]


  • hex_digit is a hexadecimal digit ([0-9a-fA-F]).


  • Columns of type BLOB can be part of the PRIMARY KEY.
  • Implicitly, BLOB data type is neither convertible nor comparable with other data types.
  • Two series of builtin-functions BlobAs<Type> and <Type>AsBlob are provided for conversion between BLOB and other data types.
  • BLOB size is virtually unlimited.


ycqlsh:example> CREATE TABLE messages(id INT PRIMARY KEY, content BLOB);
ycqlsh:example> INSERT INTO messages (id, content) VALUES (1, 0xab00ff);
ycqlsh:example> INSERT INTO messages (id, content) VALUES (2, 0x);
ycqlsh:example> UPDATE messages SET content = 0x0f0f WHERE id = 2;
ycqlsh:example> SELECT * FROM messages;
 id | content
  2 |   0x0f0f
  1 | 0xab00ff

See also