-- AMERICAN_AMERICA.ZHS16GBK
select (
substr(k.val, -- AMERICAN
-- NLS_LANGUAGE#A
instr(k.val, 'NLS_LANGUAGE', 1) + length('NLS_LANGUAGE') + 1, -- 14
(nvl(nullif(
-- NLS_LANGUAGE#AMERICAN,
instr(k.val, ',', instr(k.val, 'NLS_LANGUAGE', 1)) -- 22
,0),length(k.val) + 1) ) - (
instr(k.val, 'NLS_LANGUAGE', 1) + length('NLS_LANGUAGE') + 1
)
) || '_' ||
substr(k.val, -- AMERICA
-- NLS_LANGUAGE#AMERICAN,NLS_TERRITORY#A
instr(k.val, 'NLS_TERRITORY', 1) + length('NLS_TERRITORY') + 1,
nvl(nullif(
-- NLS_LANGUAGE#AMERICAN,NLS_TERRITORY#AMERICA,
instr(k.val, ',', instr(k.val, 'NLS_TERRITORY', 1))
,0),length(k.val) + 1) - (
instr(k.val, 'NLS_TERRITORY', 1) + length('NLS_TERRITORY') + 1
)
) || '.' ||
substr(k.val, -- ZHS16GBK
-- NLS_LANGUAGE#AMERICAN,NLS_TERRITORY#AMERICA,NLS_CHARACTERSET#Z
instr(k.val, 'NLS_CHARACTERSET', 1) + length('NLS_CHARACTERSET') + 1,
-- NLS_LANGUAGE#AMERICAN,NLS_TERRITORY#AMERICA,NLS_CHARACTERSET#ZHS16GBK
nvl(nullif(
instr(k.val,',',instr(k.val, 'NLS_CHARACTERSET', 1)),
0), length(k.val) + 1
) - (
instr(k.val, 'NLS_CHARACTERSET', 1) + length('NLS_CHARACTERSET') + 1
)
)
) as val
from (
-- NLS_LANGUAGE#AMERICAN,NLS_TERRITORY#AMERICA,NLS_CHARACTERSET#ZHS16GBK
select WMSYS.WM_CONCAT(t.val) as val
from (
select concat(concat(parameter, '#'), value) as val
from v$nls_parameters
where parameter in(
'NLS_LANGUAGE', 'NLS_CHARACTERSET', 'NLS_TERRITORY'
)
) t
) k;