Char Vs Varchar datatypes in oracle sql plsql

 Difference:



char

Varchar

It stands for character.

 

It stands for variable character.

 

 It is the static datatype which is used for fixed length.

 

It is the dynamic datatype which is used for variable length.

 

 It is faster than varchar or varchar2.

 

 It is slower than char.

 

Maximum size is 2000 bytes.

 

Maximum size is 4000 bytes.

 

It is not required to mention the size of the datatype while declaration. By default, it will take 1 byte.

 

 It is required to mention the size of the datatype while declaration.

 

 Right padding will exit if the variable datatype size is not properly allocated as per assigned value.

 

 Right padding will not exit if the variable datatype size is not properly allocated as per assigned value.

 


QUERIES:

create table sample1(Roll_No char(4));

select roll_no,length(roll_no) from sample1;

insert into sample1(roll_no) values('1234567890');

insert into sample1(roll_no) values('1');


create table sample2(name char)

select * from sample2

desc sample2

create table sample3(name varchar)






















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