subanki
subanki

Reputation: 1429

Difference between varchar and varchar2 in SQL

What is the Difference between varchar and varchar2 in SQL. Please explain in detail with some good example.

Upvotes: 10

Views: 20320

Answers (3)

Cale Sweeney
Cale Sweeney

Reputation: 1084

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

Upvotes: 0

Bill Karwin
Bill Karwin

Reputation: 562348

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.

Upvotes: 14

GSto
GSto

Reputation: 42350

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.

Source

Upvotes: 2

Related Questions