What is the Difference between varchar and varchar2 in SQL. Please explain in detail with some good example.
3 Answers
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.
2 Comments
Field = '' can be true.they behave the same, though varchar2 is recommended:
Currently VARCHAR behaves exactly the same as VARCHAR2. However, this type should not be used as it is reserved for future usage.
Comments
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