INSERT failure handling PL/SQL
Hi guys
I have one procedure which inserts "some" records into a Oracle interface table (material transaction interface), and the coding is
Declare
l_record_count NUMBER := 0;
l_insert_exception EXCEPTION;
Begin
select COUNT(*) into l_record_count
from mtl_transactions_interface_xxx
where organization_id = p_org_id
and subinventory_code = p_subinventory_code
and to_number(attribute10) = p_stock_take_id;
savepoint prior_interface_insert;
insert into mtl_transactions_interface
select * from mtl_transactions_interface_xxx
where organization_id = p_org_id
and subinventory_code = p_subinventory_code
and to_number(attribute10) = p_stock_take_id;
if NOT(sql%rowcount = l_record_count)
0