41: begin
42:
43: select min(allowable_amount)
44: into p_min_allowed_amount
45: from ap_pol_violations_all
46: where report_header_id = p_report_header_id
47: and distribution_line_number = p_distribution_line_number;
48:
49: exception
116: into l_count
117: from ap_expense_report_lines_all aerp
118: where report_header_id = p_report_header_id
119: and (itemization_parent_id is null or itemization_parent_id <> -1)
120: and exists (select 1 from ap_pol_violations_all apv
121: where apv.report_header_id = p_report_header_id
122: and apv.distribution_line_number = aerp.distribution_line_number);
123:
124: return l_count;
147: * This can be done since ecen though report_header_id is not
148: * a unique key, there can be only one report header id across orgs. */
149: select count(*)
150: into l_count
151: from ap_pol_violations_all apv
152: where apv.report_header_id = p_report_header_id
153: and apv.distribution_line_number<> -1;
154:
155: return l_count;