LarrySteele
Programmer
This is a very generic question about column data type selection.
Normally I define text fields as VARCHAR2(xx). One exception is for those fields that have fixed data lengths. A simplistic example would be US Social Security numbers, which are always 9 digits. I would define this as CHAR(9) rather than VARCHAR2(9). Any string less than 9 characters (other than 0) is invalid. Therefore, the only valid data entries would be 0 or 9.
In the example I gave, which is better:
VARCHAR(9)
or
CHAR(9)
Is one better than the other? If so, which and why?
TIA,
Larry
Normally I define text fields as VARCHAR2(xx). One exception is for those fields that have fixed data lengths. A simplistic example would be US Social Security numbers, which are always 9 digits. I would define this as CHAR(9) rather than VARCHAR2(9). Any string less than 9 characters (other than 0) is invalid. Therefore, the only valid data entries would be 0 or 9.
In the example I gave, which is better:
VARCHAR(9)
or
CHAR(9)
Is one better than the other? If so, which and why?
TIA,
Larry