What is difference between CHAR and VARCHAR2?What is the
maximum SIZE allowed for each type?

Answer Posted / roopesh kumar

Varchar2: The max. allowed length is 4000 byte default 0
i.e. nothing. This is variable length datatype. it will
take only same space as value stored.

Char: Max. permitable length 2000 byte. Default length 0.
It will store value blank padded to right side till
full length as declared.

Ex. SQL> create table fg (d varchar2);
create table fg (d varchar2)
*
ERROR at line 1:
ORA-00906: missing left parenthesis


SQL> create table fg (d char);

Table created.

SQL> desc fg
Name Null? Type
------------------------------- -------- ----
D CHAR(1)
SQL> create table cher_chk (col1 char(12));

Table created.

SQL> insert into cher_chk values ('raj');

1 row created.
SQL> select length(col1) from cher_chk
2 /

LENGTH(COL1)
------------
12

Is This Answer Correct ?    17 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I count duplicates in sql?

756


what are the security recommendations while using mysql? : Sql dba

769


How to get help at the sql prompt?

831


What is oracle sql called?

675


Can I call a procedure inside a function?

738






What is foreign key and example?

706


what is difference between delete and truncate commands? : Sql dba

808


How can triggers be used for the table auditing?

755


How many sql databases can you have on one server?

758


What is sql not null constraint?

777


Why trigger is used in sql?

695


What is prepared statement in sql?

750


What is forward declaration in pl sql?

758


What are the possible values for the boolean data field?

693


Why is stored procedure faster than query?

701