23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Data</strong> types<br />

196<br />

CHARACTER [ ( length ) ]<br />

CHARACTER (alias CHAR) corresponds to a null-terminated character string with the length<br />

specified. Values are padded with blanks to the specified length. The default length is 1.<br />

The maximum length is 2,000 characters.<br />

The OpenEdge <strong>SQL</strong> representation is a variable-length string. The host language<br />

representation is equivalent to a C language character string.<br />

{ CHARACTER VARYING | CHAR VARYING | VARCHAR | LVARCHAR } [ ( length ) ]<br />

CHARACTER VARYING, CHAR VARYING, and VARCHAR corresponds to a variable-length<br />

character string with the maximum length specified. The default length is 1 character. The<br />

maximum length is 31,995 characters. LVARCHAR has a maximum length of 1,073,741,823.<br />

A CLOB is an object of data type LVARCHAR.<br />

Notes • For data types CHARACTER( length ) and VARCHAR( length ) the value of length<br />

specifies the number of characters.<br />

Example<br />

• The maximum length can be as large as 31,995. The sum of all the column lengths<br />

of a table row must not exceed 31,960.<br />

• Due to index size limitations, only the narrower VARCHAR columns can be indexed.<br />

Maximum length for VARCHAR<br />

The maximum length of the VARCHAR data type depends on:<br />

• The number of columns in a table — More columns in a table further limits the length<br />

of VARCHAR data.<br />

• When a table was created — Tables created earlier can support longer VARCHAR data than<br />

tables created later.<br />

National Language Support (NLS)<br />

The VARCHAR data type has NLS. The choice of character set affects the available character<br />

count or maximum length of the data column. The limits established above assume a<br />

single–byte character set. Using a multiple–byte character set lowers the maximum character<br />

count proportionally. For example, if all the characters in a character set take 3 bytes per<br />

character, the practical maximum is 10,660 (31,982 divided by 3). If, however, you are using a<br />

variable–width character set, you will be able to hold between 10,660 and 31,982 characters,<br />

depending on the actual mix of characters you use.<br />

Concatenation operator<br />

Use the concatenation operator (||) to join two text strings together.<br />

The following example provides an example of a concatenation operator used in a query:<br />

SELECT firstname || ' ' || lastname from Employee;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!