We review briefly a few of the more important domains supported by ORACLE:
• In ORACLE, char[(n)] represents variable strings of characters of length
n, where 1 ≤ n ≤ 32767; the default value of n is 1. The domain charac-
ter is the same as char. The characters and their order are determined
by the system during the installation of the DBMS.
The domain varchar(n) requires n to be specified and also represents
variable-length strings of characters. It is the intention of ORACLE to
separate char(n) from varchar(n) in future releases: char(n) will repre-
sent fixed-length strings while varchar(n) will represent variable-length
strings.
The varchar2 data type stores variable-length character strings and is
currently synonymous with the varchar data type. However, in a future
version of Oracle, varchar might store variable-length character strings
compared with different comparison semantics. Currently there are two
types of comparison semantics for strings in Oracle: blank-padded com-
parison semantics and non-padded comparison semantics.
When blank-padded comparison semantics is used, if the two values have
different lengths, Oracle first adds blanks to the end of the shorter one
so their lengths are equal. Oracle then compares the values character
by character up to the first character that differs. The value with the
greater character in the first differing position is considered greater. If
two values have no differing characters, then they are considered equal.
This rule means that two values are equal if they differ only in the number
of trailing blanks. Oracle uses blank-padded comparison semantics only
when both values in the comparison are either expressions of data type
char, text literals, or values returned by the user-defined function.
In the case of non-padded comparison semantics two values are compared
character by character up to the first character that differs. The value with
the greater character in that position is considered greater. If two values
of different length are identical up to the end of the shorter one, the longer
value is considered greater. If two values of equal length have no differing
characters, then the values are considered equal. Oracle uses non-padded
comparison semantics when one or both values in the comparison have the
data type varchar or varchar2.
In either of the two comparison semantics we have ’ab’ > ’aa’ and
’ab’ > ’a ’. However, in the blank-padded comparison semantics we
have ’a ’ = ’a’, while in the non-padded semantics we have ’a ’ > ’a’.
• The domain date represents dates in the format dd-mmm-yy.