What is the difference between Varchar and Varchar2?

3

I have a question regarding data types in oracle:

In Oracle, what is the difference between varchar and varchar2?

    
asked by anonymous 02.09.2017 / 01:31

1 answer

3

VARCHAR
Currently (up to version 11G of Oracle Database), VARCHAR is nothing more than a synonym for VARCHAR2 (since Oracle8), so Oracle recommends not using this type of data.

VARCHAR can be used in future versions to have a semantics or feature other than VARCHAR2 , but even if everything is currently the same, use VARCHAR2 instead of VARCHAR to avoid possible problems futures.

VARCHAR2 VARCHAR2 stores alphanumeric characters of variable size, between 1 and 4000 bytes or characters. The default size of this column is specified in bytes .

Now comes the question, What is the difference between storing bytes or characters ?
When using multibyte characters, such as UTF-8 (to represent specific characters in multiple languages), 1 single character can be stored up to 3 bytes . In these cases, a word containing special characters, such as FABIO, may have more% w than% of characters (the letter bytes , internally will be stored in Á or 2 ), so it is recommended , in these cases, specify column storage in characters, instead of 3 bytes .

Source: What kind of data should I use : CHAR, VARCHAR or VARCHAR2?

    
02.09.2017 / 01:38