I hope I am correct on this
VARCHAR2 is Oracle specfic
VARCHAR is part of the ANSI SQL-92 specification (not Oracle-specific)
VARCHAR2 is optimized for performance in an Oracle database, VARCHAR doesn't perform as well
Click the Documentation link at the top of this page.
Select your version, I chose 9.2 but it doesn't make much difference in this case.
Select View Library link.
In Search I entered - datatype varchar
I chose SQL Reference from the results.
Then the Character Datatypes topic.
Read a bit, and the answer is currently -
- They are the same (except for the 2).
- Use varchar2.
- Varchar might change one day.
As I understand it:#
CHAR(5) is fixed length, right padded with spaces.
VARCHAR(5) is fixed length, right padded with null
VARCHAR2(5) is variable length.
Thus the difference between VARCHAR and VARCHAR2 is that VARCHAR is ANSI standard but takes up space whereas VARCHAR2 is Oracle-only but makes more efficient use of space.
But as someone has already pointed out, Oracle have resolved this (in 9.2, maybe earlier) by casting VARCHAR to VARCHAR2.