首页 > 代码库 > 段值相关
段值相关
1,父值和子值常用表
fnd_flex_value_norm_hierarchy-------父值,其中有子值的范围,
fnd_flex_value_children_v--------------可以查询 父值下包含的所有子值。
以上两张表都通过flex_value_set_id做定位
应用:在报表中存在一类参数情况,要求参数输入父值的时候,返回全部子值的相应信息,此要求的实现关键语法如下:
-------先验证是否是父值(fnd_flex_value_norm_hierarchy)
select count(1)
into l_count
from fnd_flex_value_norm_hierarchy ffh,
fnd_id_flex_segments ffs,
gl_sets_of_books gb
where ffh.flex_value_set_id = ffs.flex_value_set_id
and gb.short_name = ‘PROPERTY_SOB‘----------------账簿简称
and ffs.application_id = 101
and ffs.id_flex_code = ‘GL#‘
and ffs.id_flex_num = gb.chart_of_accounts_id
and ffs.application_column_name = ‘SEGMENT1‘--------公司段可以换为其他段
and ffh.parent_flex_value = http://www.mamicode.com/g_company;-------------参数
if l_count > 0-----------------------------------------说明是父值
then
SELECT gb.name,ffh.flex_value_set_id,
ffh.parent_flex_value,ffh.child_flex_value_low,
ffh.child_flex_value_high,ffc.flex_value
-----------可以找出相应的子值范围或者父值中包含的所有子值(ffc.flex_value)
from fnd_flex_value_norm_hierarchy ffh,
fnd_id_flex_segments ffs,
gl_sets_of_books gb,
fnd_flex_value_children_v ffc
where ffh.flex_value_set_id = ffs.flex_value_set_id
AND ffc.flex_value_set_id=ffh.flex_value_set_id
AND ffc.parent_flex_value=http://www.mamicode.com/ffh.parent_flex_value
/* and gb.short_name = ‘PROPERTY_SOB‘*/
and ffs.application_id = 101
and ffs.id_flex_code = ‘GL#‘
and ffs.id_flex_num = gb.chart_of_accounts_id
and ffs.application_column_name = ‘SEGMENT1‘
/*and ffh.parent_flex_value = http://www.mamicode.com/g_company*/;
else
直接按子值,最简单的情况处理即可
end if;
2,,常用查询段值 FLEX_VALUE_SET_ID或者FLEX_VALUE如下:
select ffv.DESCRIPTION ,ffv.FLEX_VALUE_SET_ID from fnd_flex_values_vl ffv ,fnd_id_flex_segments ffs,gl_sets_of_books gb
where ffv.FLEX_VALUE_SET_ID=ffs.FLEX_VALUE_SET_ID
and gb.SHORT_NAME=‘PROPERTY_SOB‘---------------------------账簿简称
and ffv.FLEX_VALUE=http://www.mamicode.com/‘04‘----------------------------------------具体值
and ffs.APPLICATION_ID=101
and ffs.ID_FLEX_CODE=‘GL#‘
and ffs.ID_FLEX_NUM= gb.CHART_OF_ACCOUNTS_ID
and ffs.APPLICATION_COLUMN_NAME=‘SEGMENT1‘; --------段
段值相关