select * from nls_database_parameters;
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.4.0
select '안녕하세요', length('안녕하세요'), lengthb('안녕하세요') from dual;
'안녕하세요' LENGTH('안녕하세요') LENGTHB('안녕하세요')
------- ---------------------- ----------------------
안녕하세요 5 15
create table test
( name1 varchar2(15)
, name2 varchar2(15 byte)
, name3 varchar2(15 char)
, name4 nvarchar2(10)
);
insert into test values('안녕하세요', '안녕하세요', '안녕하세요안녕하세요안녕하세요', '안녕하세요안녕하세요');
insert into test values('abcdefghijklmno', '123456789012345', 'abcdefghijklmno', 'abcdefghij');
select name1, length(name1), lengthb(name1)
, name2, length(name2), lengthb(name2)
, name3, length(name3), lengthb(name3)
, name4, length(name4), lengthb(name4)
from test;
NAME1 LENGTH(NAME1) LENGTHB(NAME1)
--------------- ---------------------- ----------------------
안녕하세요 5 15
abcdefghijklmno 15 15
NAME2 LENGTH(NAME2) LENGTHB(NAME2)
--------------- ---------------------- ----------------------
안녕하세요 5 15
123456789012345 15 15
NAME3 LENGTH(NAME3) LENGTHB(NAME3)
--------------- ---------------------- ----------------------
안녕하세요안녕하세요안녕하세요 15 45
abcdefghijklmno 15 15
NAME4 LENGTH(NAME4) LENGTHB(NAME4)
---------- ---------------------- ----------------------
안녕하세요안녕하세요 10 20
abcdefghij 10 20
UTF8 Max Btye 영문 한글
------------------------------------------------------------------------------------------------------------
varchar2(15) 15 Byte 15 Byte = 15 * 1 Byte 15 Byte = 5 * 3 Byte
varchar2(15 byte) 15 Byte 15 Byte = 15 * 1 Byte 15 Byte = 5 * 3 Byte
varchar2(15 char) 45 Byte 15 Byte = 15 * 1 Byte 45 Byte = 15 * 3 Byte
nvarchar2(10) 20 Byte 20 Byte = 10 * 2 Byte 20 Byte = 10 * 2 Byte