新增會計科目值集內容

 -- 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;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章