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 we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?

599


what are different types of keys in sql?

608


How to prepare for oracle pl sql certification?

577


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1160


How do I count rows in sql?

564






define join and explain different type of joins? : Sql dba

548


What is the purpose of a secondary key?

513


Explain character-manipulation functions?

636


How do you get column names only for a table (sql server)?

673


How do you update f as m and m as f from the below table testtable?

1097


What is auto increment feature in sql?

627


what are the advantages of mysql in comparison to oracle? : Sql dba

533


What is clause in sql?

588


what are the differences between require and include, include_once and require_once? : Sql dba

534


What are the types of records?

539