반응형

/********************************************************************************************
-- Title : [10g] UTF8에서의 char, nchar, varchar2, nvarchar3 비교
-- Key word : utf8 length
********************************************************************************************/

-- 오라클에서 데이터 사이즈를 나타내는 함수는 없나?
-- length는 아닌거 같당..ㅡ.ㅡ''

drop table ttt purge;
drop table ttt2 purge;

create table ttt  (a numeric, b numeric(3), c char(3),  d  varchar2(7), e clob);
create table ttt2 (a numeric, b numeric(3), c nchar(3), d nvarchar2(7), e nclob);

insert into ttt select 1  , 1  , 'a'     , 'b', 'cccccccccc' from dual;
insert into ttt select 2  , 2  , 'aa'    , 'bb', 'cccccccccc' from dual;
insert into ttt select 33 , 33 , 'aaa'   , 'bbb', 'cccccccccc' from dual;
insert into ttt select 44 , 44 , '가'    , '가', 'cccccccccc' from dual;
insert into ttt select 55 , 55 , '가'  , '가A', 'cccccccccc' from dual;
insert into ttt select 666, 666, '뷁', '가AB', 'cccccccccc' from dual;
insert into ttt select 666, 666, '숖', '뷁나1', 'cccccccccc' from dual;

insert into ttt2 select 1  , 1  , 'a'     , 'b', 'cccccccccc' from dual;
insert into ttt2 select 2  , 2  , 'aa'    , 'bb', 'cccccccccc' from dual;
insert into ttt2 select 33 , 33 , 'aaa'   , 'bbb', 'cccccccccc' from dual;
insert into ttt2 select 44 , 44 , '가'    , '가', 'cccccccccc' from dual;
insert into ttt2 select 55 , 55 , '가'  , '가A', 'cccccccccc' from dual;
insert into ttt2 select 666, 666, '뷁', '가AB', 'cccccccccc' from dual;
insert into ttt2 select 666, 666, '숖', '뷁나1', 'cccccccccc' from dual;

commit;

select a, length(a) "numeric",     b, length(b) "numeric(3)", c, length(c) "char(3)"
     , d, length(d) "varchar2(7)", e, length(e) "clob"
from ttt;

select a, length(a) "numeric",     b, length(b) "numeric(3)", c, length(c) "nchar(3)"
     , d, length(d) "nvarchar2(7)", e, length(e) "nclob"
from ttt2;

 

 

반응형

+ Recent posts