Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I control NULL values in merge?

RaakhDec 12 2009 — edited Dec 14 2009
	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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2010
Added on Dec 12 2009
4 comments
4,324 views