What is the difference between CHAR and VARCHAR2? If
VARCHAR2 serves the uses of CHAR why CHAR is still used and
not been discarded yet?

Answer Posted / satish asnani

Technically CHAR has better performance than VARCHAR2.
For CHAR(10) database already knows the length of value in
each record and therefore displays the entire string up till
10 characters. In case of VARCHAR2 the end of string has to
be reached('\0'-NULL) before the database stops displaying
the characters ahead. Each character is compared to NULL
character before it can be determined that end of string has
arrived. Comparing each string character with NULL character
consumes some CPU cycles and hence VARCHAR2 is slower in
performance as compared to CHAR.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is 'mysqlshow'? : Sql dba

570


what is the different between now() and current_date()? : Sql dba

516


What is the use of partition by in sql?

508


What is the use of nvl function?

609


how to run 'mysql' commands from a batch file? : Sql dba

603






Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?

574


How do you bind variables in pl sql?

572


What is bind reference and how can it be created?

570


Does mysql support pl sql?

615


First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.

1134


How do I truncate a sql log file?

525


What are the two characteristics of a primary key?

483


What is scope and visibility in PL/SQL?

590


What is query syntax?

515


What do you think about pl/sql?

522