Syntax
char_data_type ::
{ CHARACTER | CHAR } [(length)]
| { CHARACTER VARYING | CHAR VARYING | VARCHAR } [(length)]
| LVARCHAR
Arguments
Type |
Syntax |
Description |
Default length |
Maximum length |
CHAR |
{ CHARACTER | CHAR } [(length)] [ CHARACTER SET charset-name ] |
A null-terminated character string with the maximum length specified. |
1 |
65,500 bytes (before V12, it was 8,192) |
LVARCHAR |
LVARCHAR |
An arbitrarily long character string. Recommended for CLOB support. The arbitrary size and unstructured nature of long data types (LVARCHAR/LVARBINARY) restrict where they can be used.
|
N/A |
2 GB |
VARCHAR |
{ CHARACTER VARYING | CHAR VARYING | VARCHAR } [(length)] |
A variable-length character string with the maximum length specified. |
1 |
65,500 bytes (before V12, it was 8,192) |
Character string literals
Literals are a type of expression that specify a constant value (they are also called constants). You can specify literals wherever FairCom DB SQL syntax allows expressions.
A character string literal is a string of characters enclosed in single quotation marks ( ' ).
To include a single quotation mark in a character-string literal, precede it with an additional single quotation mark. The following FairCom DB SQL examples demonstrate embedding quotation marks in character-string literals:
insert into quote values('unquoted literal');
insert into quote values('''single-quoted literal''');
insert into quote values('"double-quoted literal"');
insert into quote values('O''Hare');
select * from quote;
c1
unquoted literal
'single-quoted literal'
"double-quoted literal"
O'Hare
To insert a character-string literal that spans multiple lines, enclose each line in single quotation marks. The following FairCom DB SQL examples shows this syntax, as well as embedding quotation marks in one of the lines:
insert into quote2 values ('Here''s a very long character string '
'literal that will not fit on a single line.');
1 record inserted.
select * from quote2;
C1
--
Here's a very long character string literal that will not fit on a single line.