merge
into AppliedJobs t1
using (select 21 job_id,NULL employer_id, 1 emp_id from dual) t2
on (t1.job_id = t2.job_id and t1.employer_id = t2.employer_id and t1.emp_id = t2.emp_id )
when not matched then insert(job_id,employer_id,emp_id) value(t2.job_id,t2.employer_id,t2.emp_id)
SQL> /
1 row merged.
SQL> /
1 row merged.
SQL> /
1 row merged.
SQL> select job_id,emp_id,employer_id from appliedjobs;
JOB_ID EMP_ID EMPLOYER_ID
---------- ---------- -----------
21 1 1
41 1 1
21 1
Two users are inserting values in appliedjobs table
employee inserts 2 values job_id,emp_id /**emp_id is cv_id**/
employer inserts 3 values job_id,emp_id,employer_id
I am trying to not insert duplicate cv_ids (emp_id) for one specific job_id.
When the value of employer_id is null then merge not works. How can I handle this?
Thanks in anticipation