Operation Details
Description: Check thats a sanction override record exists already, with the same sanction reason, program and within the same sanction date range, for the household member.
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :numberOfRecords 
FROM
  SanctionOverride 
WHERE 
  (
    SanctionOverride.sanctionOverrideID <> :sanctionOverrideID 
    OR :sanctionOverrideIDIsNull <> '0' 
  ) 
  AND SanctionOverride.concernRoleID = :concernRoleID 
  AND SanctionOverride.statusCode = :statusCode 
  AND SanctionOverride.sanctionReason = :sanctionReason 
  AND 
	(((:program <> 'SPR1') AND
	(
	SanctionOverride.program = :program 
	OR SanctionOverride.program = 'SPR1'
	)) OR 
        ((:program = 'SPR1') AND
	(
	SanctionOverride.program IS NOT NULL
	)))  
  AND 
  (
    
    (
      :endDate >= SanctionOverride.startDate 
      OR :endDate IS NULL 
    ) 
    AND 
    (
      :startDate <= SanctionOverride.endDate 
      OR SanctionOverride.endDate IS NULL 
    ) 
  )