1.

State the difference between varchar and varchar2 datatypes.

Answer»

Varchar is a variable-length character string. Both Varchar2 and Varchar are data types for STORING character strings.

VarCharVarChar2
Varchar is able to store up to 2000 bytes of character data.Varchar2 is able to store up to 4000 bytes of character data.
This occupies space for null values as well.This doesn’t occupy the space for null values.
The Varchar data type ADHERES to ANSI (American National Standards Institute ) standards.The Varchar2 data type adheres to Oracle standards.
It allocates a fixed size of data IRRESPECTIVE of the input. For INSTANCE, if we define varchar (10) and enter just 5 characters, then varchar allocates space for the full 10 characters, not for 5 characters.It allocates variable sizes of data based on input. For instance, if we define varchar2 (10), and enter just 5 characters, then varchar2 only allocates space for only 5 characters, not for the full 10 characters.
The extra spaces in varchar data are padded to the right.Varchar2 will truncate extra spaces.
In accordance with the ANSI standard, it distinguishes between NULL and empty strings.It does not distinguish between a NULL and an empty string. Both are treated as the same.


Discussion

No Comment Found