Help Center > > Developer Guide> SQL Reference> Data Types> Binary Data Types

Binary Data Types

Updated at: Jul 15, 2020 GMT+08:00

Table 1 lists the binary data types that can be used in DWS.

Table 1 Binary data types

Name

Description

Storage Space

BLOB

Binary large object.

Currently, BLOB only supports the following external access interfaces:

  • DBMS_LOB.GETLENGTH
  • DBMS_LOB.READ
  • DBMS_LOB.WRITE
  • DBMS_LOB.WRITEAPPEND
  • DBMS_LOB.COPY
  • DBMS_LOB.ERASE

For details about the interfaces, see DBMS_LOB.

NOTE:

Column storage cannot be used for the BLOB type.

The maximum size is 8203 bytes less than 1 GB.

RAW

Variable-length hexadecimal string

NOTE:

Column storage cannot be used for the raw type.

4 bytes plus the actual hexadecimal string. The maximum size is 8203 bytes less than 1 GB.

BYTEA

Variable-length binary string

4 bytes plus the actual binary string. The maximum size is 8203 bytes less than 1 GB.

In addition to the size limitation on each column, the total size of each tuple is 8203 bytes less than 1 GB.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Create a table:
CREATE TABLE blob_type_t1 
(
    BT_COL1 INTEGER,
    BT_COL2 BLOB,
    BT_COL3 RAW,
    BT_COL4 BYTEA
) DISTRIBUTE BY REPLICATION;

-- Insert data:
INSERT INTO blob_type_t1 VALUES(10,empty_blob(),
HEXTORAW('DEADBEEF'),E'\\xDEADBEEF');

-- Query data in the table:
SELECT * FROM blob_type_t1;
 bt_col1 | bt_col2 | bt_col3  |  bt_col4   
---------+---------+----------+------------
      10 |         | DEADBEEF | \xdeadbeef
(1 row)

-- Delete the tables:
DROP TABLE blob_type_t1;

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel