What is the Difference between varchar and varchar2 in SQL. Please explain in detail with some good example.
Asked
Active
Viewed 1.9k times
3 Answers
13
Varchar2 is specific to Oracle.
The most significant nonstandard behavior of varchar2 is that an empty string ('') is the same as null.
In standard SQL, null is not the same as any string literal, not even the empty string.
Bill Karwin
- 538,548
- 86
- 673
- 828
-
1+1 Probably worth mentioning that in Oracle, a condition testing whether `Field = ''` always evaluates as NULL (ie. never true), even if `Field` is '' (ie. NULL). – Oct 15 '10 at 11:40
-
@Mark: Thanks, that's a good point. Whereas in standard SQL, `Field = ''` can be true. – Bill Karwin Oct 15 '10 at 17:09
0
Leigh Riffel on the DBA StackExchange gives the most detailed and precise overview I have read on the difference between VARCHAR and VARCHAR2: https://dba.stackexchange.com/a/1303
Community
- 1
- 1
Cale Sweeney
- 1,014
- 1
- 15
- 37