Character
Name |
Description |
---|---|
VARCHAR(n) |
Variable-length character string. n indicates the byte length. |
CHAR(n) |
Fixed-length character string. If the length is insufficient, spaces are added. n indicates the byte length. If the precision n is not specified, the default value 1 is used. |
VARBINARY |
Variable-length binary data. The value must be prefixed with X, for example, X'65683F'. Currently, a binary character string of a specified length is not supported. |
JSON |
The value can be a JSON object, a JSON array, a JSON number, a JSON string, true, false or null. |
STRING |
String compatible with impala. The bottom layer is varchar. |
BINARY |
Compatible with Hive BINARY. The underlying implementation is VARBINARY. |
- In SQL expressions, simple character expressions and unicodes are supported. A unicode character string uses U& as the fixed prefix. An escape character must be added before Unicode that is represented by a 4-digit value.
- VARBINARY and BINARY
-- Creating a VARBINARY or BINARY Table create table binary_tb(col1 BINARY); --Insert data. INSERT INTO binary_tb values (X'63683F'); --Query data. select * from binary_tb ; -- 63 68 3f
- When two CHARs with different numbers of spaces at the end are compared, the two CHARs are considered equal.
SELECT CAST('FO' AS CHAR(4)) = CAST('FO ' AS CHAR(5)); _col0 ------- true (1 row)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.