-- Created on 2011-9-29 by WANG JUAN
declare
l_rowid VARCHAR2(100);
p_flex_value_set_id NUMBER;
p_iv_flex_value VARCHAR2(100) := '73293980103';
p_iv_flex_value_meaning VARCHAR2(100) := 'TEST';
p_on_flex_value_id NUMBER;
l_count NUMBER;
BEGIN
BEGIN
SELECT b.flex_value_set_id
INTO p_flex_value_set_id
FROM fnd_flex_value_sets b
WHERE b.flex_value_set_name = 'PC_CUSVEN';
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('没有找到对应的弹性域ID');
WHEN OTHERS THEN
dbms_output.put_line('获取弹性域ID时出错!');
END;
--判断编号是否存在于SEGMENT5字段中
SELECT COUNT(*)
INTO l_count
FROM fnd_flex_values_vl fvl
WHERE fvl.flex_value = p_iv_flex_value;
IF l_count = 0 THEN
SELECT fnd_flex_values_s.nextval
INTO p_on_flex_value_id
FROM dual;
fnd_flex_values_pkg.insert_row(x_rowid => l_rowid,
x_flex_value_id => p_on_flex_value_id,
x_attribute_sort_order => NULL,
x_flex_value_set_id => p_flex_value_set_id,
x_flex_value => p_iv_flex_value,
x_enabled_flag => 'Y',
x_summary_flag => 'N',
x_start_date_active => NULL,
x_end_date_active => NULL,
x_parent_flex_value_low => NULL,
x_parent_flex_value_high => NULL,
x_structured_hierarchy_level => NULL,
x_compiled_value_attributes => NULL,
x_hierarchy_level => NULL,
x_value_category => NULL,
x_attribute1 => NULL,
x_attribute2 => NULL,
x_attribute3 => NULL,
x_attribute4 => NULL,
x_attribute5 => NULL,
x_attribute6 => NULL,
x_attribute7 => NULL,
x_attribute8 => NULL,
x_attribute9 => NULL,
x_attribute10 => NULL,
x_attribute11 => NULL,
x_attribute12 => NULL,
x_attribute13 => NULL,
x_attribute14 => NULL,
x_attribute15 => NULL,
x_attribute16 => NULL,
x_attribute17 => NULL,
x_attribute18 => NULL,
x_attribute19 => NULL,
x_attribute20 => NULL,
x_attribute21 => NULL,
x_attribute22 => NULL,
x_attribute23 => NULL,
x_attribute24 => NULL,
x_attribute25 => NULL,
x_attribute26 => NULL,
x_attribute27 => NULL,
x_attribute28 => NULL,
x_attribute29 => NULL,
x_attribute30 => NULL,
x_attribute31 => NULL,
x_attribute32 => NULL,
x_attribute33 => NULL,
x_attribute34 => NULL,
x_attribute35 => NULL,
x_attribute36 => NULL,
x_attribute37 => NULL,
x_attribute38 => NULL,
x_attribute39 => NULL,
x_attribute40 => NULL,
x_attribute41 => NULL,
x_attribute42 => NULL,
x_attribute43 => NULL,
x_attribute44 => NULL,
x_attribute45 => NULL,
x_attribute46 => NULL,
x_attribute47 => NULL,
x_attribute48 => NULL,
x_attribute49 => NULL,
x_attribute50 => NULL,
x_flex_value_meaning => p_iv_flex_value,
x_description => p_iv_flex_value_meaning,
x_creation_date => SYSDATE,
x_created_by => -1,
x_last_update_date => SYSDATE,
x_last_updated_by => -1,
x_last_update_login => -1);
ELSE
dbms_output.put_line('该编号已存在于SEGMENT5中,无需再次导入!');
END IF;
end;
declare
l_rowid VARCHAR2(100);
p_flex_value_set_id NUMBER;
p_iv_flex_value VARCHAR2(100) := '73293980103';
p_iv_flex_value_meaning VARCHAR2(100) := 'TEST';
p_on_flex_value_id NUMBER;
l_count NUMBER;
BEGIN
BEGIN
SELECT b.flex_value_set_id
INTO p_flex_value_set_id
FROM fnd_flex_value_sets b
WHERE b.flex_value_set_name = 'PC_CUSVEN';
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('没有找到对应的弹性域ID');
WHEN OTHERS THEN
dbms_output.put_line('获取弹性域ID时出错!');
END;
--判断编号是否存在于SEGMENT5字段中
SELECT COUNT(*)
INTO l_count
FROM fnd_flex_values_vl fvl
WHERE fvl.flex_value = p_iv_flex_value;
IF l_count = 0 THEN
SELECT fnd_flex_values_s.nextval
INTO p_on_flex_value_id
FROM dual;
fnd_flex_values_pkg.insert_row(x_rowid => l_rowid,
x_flex_value_id => p_on_flex_value_id,
x_attribute_sort_order => NULL,
x_flex_value_set_id => p_flex_value_set_id,
x_flex_value => p_iv_flex_value,
x_enabled_flag => 'Y',
x_summary_flag => 'N',
x_start_date_active => NULL,
x_end_date_active => NULL,
x_parent_flex_value_low => NULL,
x_parent_flex_value_high => NULL,
x_structured_hierarchy_level => NULL,
x_compiled_value_attributes => NULL,
x_hierarchy_level => NULL,
x_value_category => NULL,
x_attribute1 => NULL,
x_attribute2 => NULL,
x_attribute3 => NULL,
x_attribute4 => NULL,
x_attribute5 => NULL,
x_attribute6 => NULL,
x_attribute7 => NULL,
x_attribute8 => NULL,
x_attribute9 => NULL,
x_attribute10 => NULL,
x_attribute11 => NULL,
x_attribute12 => NULL,
x_attribute13 => NULL,
x_attribute14 => NULL,
x_attribute15 => NULL,
x_attribute16 => NULL,
x_attribute17 => NULL,
x_attribute18 => NULL,
x_attribute19 => NULL,
x_attribute20 => NULL,
x_attribute21 => NULL,
x_attribute22 => NULL,
x_attribute23 => NULL,
x_attribute24 => NULL,
x_attribute25 => NULL,
x_attribute26 => NULL,
x_attribute27 => NULL,
x_attribute28 => NULL,
x_attribute29 => NULL,
x_attribute30 => NULL,
x_attribute31 => NULL,
x_attribute32 => NULL,
x_attribute33 => NULL,
x_attribute34 => NULL,
x_attribute35 => NULL,
x_attribute36 => NULL,
x_attribute37 => NULL,
x_attribute38 => NULL,
x_attribute39 => NULL,
x_attribute40 => NULL,
x_attribute41 => NULL,
x_attribute42 => NULL,
x_attribute43 => NULL,
x_attribute44 => NULL,
x_attribute45 => NULL,
x_attribute46 => NULL,
x_attribute47 => NULL,
x_attribute48 => NULL,
x_attribute49 => NULL,
x_attribute50 => NULL,
x_flex_value_meaning => p_iv_flex_value,
x_description => p_iv_flex_value_meaning,
x_creation_date => SYSDATE,
x_created_by => -1,
x_last_update_date => SYSDATE,
x_last_updated_by => -1,
x_last_update_login => -1);
ELSE
dbms_output.put_line('该编号已存在于SEGMENT5中,无需再次导入!');
END IF;
end;