Varchar2 Vs Char datatype
Char is a fixed length data type and varchar2 is a variable length data type.
Lets test:
set serveroutput on
declare
variable_ch char(32767) := ' ';
variable_vch varchar2(32767) := ' ';
begin
dbms_output.put_line('variable_ch is ['||LENGTH(variable_ch)||']');
dbms_output.put_line('variable_vch is ['||LENGTH(variable_vch)||']');
variable_ch :='Hello';
dbms_output.put_line('variable_ch is ['||LENGTH(variable_ch)||']');
variable_vch :='Hello';
dbms_output.put_line('variable_vch is ['||LENGTH(variable_vch)||']');
end;
/
Output:
variable_ch is [32767]
variable_vch is [1]
variable_ch is [32767]
variable_vch is [5]