Professional Documents
Culture Documents
Char Varchar Viswam
Char Varchar Viswam
Char Varchar Viswam
============================
defintion:
------------
data type sprcfies type of data within table column
oracle having following datatypes they are
1)number
2)number(p,s)
3)char
4)varchar
5)varchar2
6)blob
7)raw
8)long raw
9)timestamp
10)date
char:
==========
-->it is used to store fixed length alphanumberic data in bytes
name
123
batch1
kappp@33
eg-
state
ap
dl
country
ind
usa
-->in oracle whenever we are using char datatype and also when use are try to store
less no the bytes then maximum size is char datatype then oracle sever internally
automatically add blanks spaces in place of remaning bytes at the end of he string
this is called blank padded mechanisum.
states codes
=========================
ap
tn
dl
country code
=====================
india-ind
america-usa
rissa-rsa
syntax:
================
columnname char(size)
maximum size is of the char datatype is upto 2000 bytes
note:
===========
in oracle by default char datatype having one byte
varchar2:
-------------------
-->it is used to store varable length alphanumberic data in bytes
if you try to store less no of the bytes remaining bytes oracle does'nt add blank
spaces that why
whatever data we are inserting that data only memory are reseverd
syntax:
--------------
columnname varchar2(size)
maximum size of the varcahr2 datatype is upto 4000 bytes
alphanumberic ---Aa@%&&*1234
%&*----special charcter
A
a
123
varchar2:
======================
---> oracle 7.0 if we want to store variable length alpha-numberic data then we are
using varchar datatype
syntax:
=========
column name varchar(size)
test
========
create table test(name varchar(10));
desc test;
type
======
varchar2(10)
Note:
==========
in oracle 7.0 onwards whenever we are using creating varchar datatype also then
oracle server internally automatically converts varchar datatype into varchar2
datatype.
================