[Home] [Help]
1939: AND tag=p_lookup_tag;
1940: --CURSOR c_risk_type IS
1941: -- SELECT lookup_code
1942: -- FROM AMW_LOOKUPS
1943: -- WHERE lookup_type='AMW_RISK_TYPE'
1944: -- AND enabled_flag='Y'
1945: -- AND tag=p_lookup_tag;
1946:
1947: CURSOR c_risk_type_id IS
1944: -- AND enabled_flag='Y'
1945: -- AND tag=p_lookup_tag;
1946:
1947: CURSOR c_risk_type_id IS
1948: SELECT AMW_RISK_TYPE_S.NEXTVAL
1949: FROM dual;
1950:
1951: l_risk_type_code VARCHAR2(30);
1952: l_risk_type_code_del VARCHAR2(30);
2002:
2003: if(l_risk_type_flag = 'N') then
2004:
2005: select count(*) into l_risk_type_exists
2006: from amw_risk_type
2007: where risk_rev_id = lx_risk_rev_id
2008: and risk_type_code = l_risk_type_code;
2009:
2010: if(l_risk_type_exists > 0) then
2007: where risk_rev_id = lx_risk_rev_id
2008: and risk_type_code = l_risk_type_code;
2009:
2010: if(l_risk_type_exists > 0) then
2011: delete from amw_risk_type
2012: where risk_rev_id=lx_risk_rev_id
2013: and risk_type_code=l_risk_type_code;
2014: end if;
2015: end if;
2019:
2020: if(l_risk_type_flag = 'Y') then
2021:
2022: --this risk_type has been selected for this risk ....
2023: --need to check if this row already exists in amw_risk_type
2024: --for this risk_rev_id
2025:
2026: select count(*) into l_risk_type_exists
2027: from amw_risk_type
2023: --need to check if this row already exists in amw_risk_type
2024: --for this risk_rev_id
2025:
2026: select count(*) into l_risk_type_exists
2027: from amw_risk_type
2028: where risk_rev_id = lx_risk_rev_id
2029: and risk_type_code = l_risk_type_code;
2030:
2031: --IF SQL%NOTFOUND THEN
2037: OPEN c_risk_type_id;
2038: FETCH c_risk_type_id INTO l_RISK_type_id;
2039: CLOSE c_risk_type_id;
2040:
2041: INSERT INTO amw_risk_type
2042: (risk_type_id,
2043: last_update_date,
2044: last_updated_by,
2045: creation_date,
2065: WHEN e_invalid_risk_type_flag THEN
2066: v_err_msg :=
2067: 'Error working in procedure risk types: '
2068: || 'Atleast one Risk_Type flag must be Y/N';
2069: v_table_name := 'AMW_RISK_TYPE';
2070: update_interface_with_error (v_err_msg
2071: ,v_table_name
2072: ,v_interface_id
2073: );
2079: || p_lookup_tag
2080: || 'using interface id of: '
2081: || v_interface_id
2082: || ' flag must be Y/N';
2083: v_table_name := 'AMW_RISK_TYPE';
2084: update_interface_with_error (v_err_msg
2085: ,v_table_name
2086: ,v_interface_id
2087: );
2092: || p_lookup_tag
2093: || 'using interface id of: '
2094: || v_interface_id
2095: || ' code does not exist';
2096: v_table_name := 'AMW_RISK_TYPE';
2097: update_interface_with_error (v_err_msg
2098: ,v_table_name
2099: ,v_interface_id
2100: );
2107: || v_interface_id
2108: || ' '
2109: || SUBSTR (SQLERRM, 1, 100)
2110: || ' ';
2111: v_table_name := 'AMW_RISK_TYPE';
2112: update_interface_with_error (v_err_msg
2113: ,v_table_name
2114: ,v_interface_id
2115: );