I am trying to insert some values in the table through the application and get the issue "ORA-00001: unique constraint (constraint_name) violated". I have the below table:
CREATE TABLE EMPLOYEE
(
EMP_ID VARCHAR2(32) NOT NULL,
NAME VARCHAR2(30) NOT NULL,
TIME TIMESTAMP(3),
PRIMARY KEY(EMP_ID)
);
I have below statement in procedure and it is failing at this INSERT statement even though I have NOT EXISTS check before inserting:
INSERT INTO EMPLOYEE
(EMP_ID, NAME, TIME)
( SELECT v_empid ,
sys_context('USERENV','SID'),
SYSTIMESTAMP+INTERVAL '10' SECOND
FROM DUAL
WHERE NOT EXISTS ( SELECT 1
FROM EMPLOYEE
WHERE EMP_ID = v_empid) );
The above procedure is getting invoked from multiple services almost at the same time, Is there something issue with the parallel transactions like multiple sessions are trying to insert into the same table? Any help is appreciated in this, thanks in advance.