All Products
Document Center

Text literals

Last Updated: Jun 18, 2021

Text literals are strings that are enclosed in single quotation marks (') and are used to specify the values of strings in expressions, conditions, SQL functions, and SQL statements.

Text literals have the attributes of the CHAR and VARCHAR2 data types.

  • In expressions and conditions, ApsaraDB for OceanBase uses blank-padded comparison semantics for comparison and considers text literals as the CHAR data type.

  • When you specify text literals, a value of the CHAR data type can be up to 2,000 bytes in length. A value of the VARCHAR2 data type can be up to 32,767 bytes in length.

The following examples show some valid text literals. To show a single quotation mark (') in a string, you must insert a single quotation mark (') before the single quotation mark (') in the string.

'Jackie''s raincoat'
'It's a nice day today'