Hi,
I am using a Stored Procedure to do an insert or update based on a customer Id which I fetch from the table, I am also using a DB link to read the records another DB in the procedure like below:-
select custId into cust_id from customer@CUST_LINK where sapContact= 'xxx'
if custid is null then
// insert
else
//update
But I am getting the below error when I execute the procedure :-
Error occured at -1ORA-00001: unique constraint (CUSTOMER_P) violated
ORA-02063: preceding line from CUST_LINK
What is the issue where, the DB link is working fine when i invoke it separately (outside SP). Why unique constraint error is thrown as we have check for both insert and update (like we use the merge statement)? also whether we can catch the unique constraint exception in Exception block of SP? Please clarify.
Thanks