Difference between varchar and varchar2 in oracle sql plsql interview question and answer for fresher,intermediate and experienced candidates.

 DIFFERENCE:


Oracle recommended that the new data type varchar2 is going to replace varchar in terms of use.


Varchar

 

Varchar2

 

 It is an external datatype.

 It is an internal datatype.

 

 It’s definition may be change in the future.

 

It’s definition will not be changing in the future due to standard in the nature.

 

Extra spaces are padded to the right side.

 

Extra spaces will be truncated.

 

It can identify null and empty string separately.

 

It cannot identify null and empty string separately.

 

 It can store minimum 1 and maximum 2000 bytes of character data.

 

It can store minimum 1 and maximum 4000 bytes of character data.

 

 It can allocate the fixed size of the data irrespective of the input. For example: varchar (20) is defined by me and entered only 15 characters but it allocates space for 20 characters.

 

 It can allocate the variable size of the data input. For example: varchar2(20) is defined by me and entered only 15 characters but it will allocate space for 15 characters.

 

 It is supported by many or different type or various type of the relational database system.

 

It is specific to the oracle database system.

 

 It occupies space for the null values.

 

 It doesn’t occupy space for the null values.

 

QUERY:

create table sample (Name varchar (10),Mob_No Varchar2(20));


insert into sample(name,mob_no) values('Ram','9073791247');

select * from sample;

select name,dump(name),mob_no,dump(mob_no) from sample;

select length(name),length(mob_no) from sample;












Comments

Popular posts from this blog

Difference between union and union all in oracle sql plsql

Explain oracle pl sql datatypes interview question and answer for fresher and experienced.

Difference between full join and cross join-oracle sql plsql