Variable-length character string. A datatype in SQL and pro*C. Similar to C++'s string type, but varchar differs in that it has a maximum length specified by the programmer.

The primary advantage to a SQL varchar type (as opposed to char) is that it only uses the amount of bytes equal to current length of the string, rather than adding spaces for padding. The pro*C varchar is actually a "pseudotype" which gets converted into a struct (containing a string arr and its length len) during compilation.

Declaration examples (with arbitrary maximum length of 100):

/* PL/SQL */

foo VARCHAR(100); /* external datatype, seldom used */
bar VARCHAR2(100); /* internal datatype */

/* pro*C */
varchar foo[100];

Log in or register to write something here or to contact authors.