Operation Details
Description: Check whether there is a duplicate employment record found
Sterotype: nsmulti
SQL
SELECT
  employmentID
INTO
  :employmentID 
FROM
  Employment 
WHERE employmentID <> :employmentID 
  AND concernRoleID = :concernRoleID 
  AND employerConcernRoleID = :employerConcernRoleID 
  AND occupationType = :occupationType 
  AND status = :statusCode 
  AND 
  (
    
    (
      toDate >= :fromDate 
      OR toDate IS NULL 
    ) 
    AND 
    (
      
      (
        fromDate <= :toDate 
        OR :toDate IS NULL 
      ) 
      OR 
      (
        toDate IS NULL 
        AND fromDate IS NULL 
      ) 
    ) 
  )