The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT t1.segment_name, ffvs.validation_type, t1.flex_value_Set_id
INTO l_segment_name, l_flex_value_type, l_tab_val_vs
FROM fnd_id_flex_segments t1,
fnd_segment_attribute_values t2,
fnd_flex_value_sets ffvs
WHERE t1.application_id = t2.application_id
AND t1.id_flex_code = t2.id_flex_code
AND t1.id_flex_num = t2.id_flex_num
AND t1.application_column_name = t2.application_column_name
AND t1.application_id = 101
AND t1.id_flex_code = 'GL#'
AND t1.id_flex_num = coa_id
AND t1.enabled_flag = 'Y'
AND t2.segment_attribute_type = NVL(segment_type, 'GL_BALANCING')
AND t2.attribute_value = 'Y'
AND ffvs.flex_value_set_id = t1.flex_value_set_id;
SELECT fvt.value_column_name
INTO l_flex_value_col_name
FROM FND_FLEX_VALIDATION_TABLES fvt
WHERE fvt.flex_value_set_id = l_tab_val_vs;
SELECT DECODE(NVL(gll.bal_seg_value_option_code, 'X'),
'I',
DECODE(glsv.segment_value, NULL, 'N',p_flex_value,'Y', 'N'),
'Y')
INTO l_valid_value
FROM gl_ledger_segment_values glsv, gl_ledgers gll
WHERE gll.ledger_id = l_lgr_id
AND gll.ledger_id = glsv.ledger_id (+)
AND glsv.segment_type_code (+) = 'B'
AND NVL(glsv.status_code (+), 'X') <> 'I'
AND NVL(glsv.start_date (+),TO_DATE('1950/01/01','YYYY/MM/DD'))
<= NVL(l_valid_date,TO_DATE('9999/12/31','YYYY/MM/DD'))
AND NVL(glsv.end_date (+),TO_DATE('9999/12/31','YYYY/MM/DD'))
>= NVL(l_valid_date, TO_DATE('1950/01/01','YYYY/MM/DD'))
AND glsv.segment_value (+) = p_flex_value;
PROCEDURE gl_bs_delete_awc (coa_id IN NUMBER,
segment_type IN VARCHAR2)
IS
l_flexfield fnd_flex_key_api.flexfield_type;
SELECT t1.segment_name
INTO l_segment_name
FROM fnd_id_flex_segments t1,
fnd_segment_attribute_values t2,
fnd_flex_value_sets ffvs
WHERE t1.application_id = t2.application_id
AND t1.id_flex_code = t2.id_flex_code
AND t1.id_flex_num = t2.id_flex_num
AND t1.application_column_name = t2.application_column_name
AND t1.application_id = 101
AND t1.id_flex_code = 'GL#'
AND t1.id_flex_num = coa_id
AND t1.enabled_flag = 'Y'
AND t2.segment_attribute_type = NVL(segment_type, 'GL_BALANCING')
AND t2.attribute_value = 'Y'
AND ffvs.flex_value_set_id = t1.flex_value_set_id;
fnd_flex_key_api.delete_awc(l_flexfield, l_structure, l_segment,
'GL_COA_BS_TAG');
END gl_bs_delete_awc;