Difference between CHAR and VARCHAR

Difference between CHAR and VARCHAR


CHAR and VARCHAR2
--====================================================

VARCHAR takes up 1 byte per character, + 2 bytes to hold length information.
CHAR takes up 1 byte per character after that added paddded space

VARCHAR is variable length,
while CHAR is fixed length.

--====================================================

drop table XX_EXAPMLE_TL


create table XX_EXAPMLE_TL
( PAYMENT_MODE CHAR(100),
BANK_NAME VARCHAR(100)
)


select * from XX_EXAPMLE_TL

insert into XX_EXAPMLE_TL values ('RTGS','HDFC')

commit

PAYMENT_MODE
BANK_NAME
RTGS                                                                                               
HDFC


select length(PAYMENT_MODE) ,
length(BANK_NAME)
from XX_EXAPMLE_TL


LENGTH(PAYMENT_MODE)
LENGTH(BANK_NAME)
100
4

--====================================================



Comments

Popular posts from this blog

E-Text Report In Fusion | Types of E-Text reports

Supplier API's

How to pass default Parameter in cursor