Script 1:(Works in Both 11i & R12)

SELECT gcc.segment1
||’.’
||gcc.segment2
||’.’
||gcc.segment3 ACCOUNT,
A1.DESCRIPTION
||’-‘
||A2.DESCRIPTION
||’-‘
|| A3.DESCRIPTION DECS
FROM fnd_flex_values_vl A1,
fnd_flex_values_vl A2,
fnd_flex_values_vl A3,
gl_code_combinations gcc
WHERE a1.flex_value       =gcc.segment1
AND a1.FLEX_VALUE_SET_ID IN
(SELECT FLEX_VALUE_SET_ID
FROM fnd_id_flex_segments
WHERE application_id       = 101
AND id_flex_code           = ‘GL#’
AND enabled_flag           = ‘Y’
AND application_column_name=’SEGMENT1′
)
AND a2.flex_value         =gcc.segment2
AND a2.FLEX_VALUE_SET_ID IN
(SELECT FLEX_VALUE_SET_ID
FROM fnd_id_flex_segments
WHERE application_id       = 101
AND id_flex_code           = ‘GL#’
AND enabled_flag           = ‘Y’
AND application_column_name=’SEGMENT2′
)
AND a3.flex_value         =gcc.segment3
AND a3.FLEX_VALUE_SET_ID IN
(SELECT FLEX_VALUE_SET_ID
FROM fnd_id_flex_segments
WHERE application_id       = 101
AND id_flex_code           = ‘GL#’
AND enabled_flag           = ‘Y’
AND application_column_name=’SEGMENT3′

);

Script 2: ( Applicable in R12)

SELECT gcc.CONCATENATED_SEGMENTS,
gl_flexfields_pkg.get_concat_description( gcc.chart_of_accounts_id, gcc.code_combination_id) acc_description

FROM gl_code_combinations_kfv gcc;