Operation Details
Description: A count to check if the user holds a position in the organization unit.
Sterotype: ns
SQL
SELECT
  COUNT (*)
INTO
  :numberOfRecords 
FROM
  Users 
WHERE Users.userName = :userName 
  AND Users.userName IN 
  ( 
  SELECT
    DISTINCT Users.userName 
  FROM
    OrgUnitPositionLink,
    PositionHolderLink,
    OrganisationUnit,
    OrganisationStructure,
    Users 
  WHERE OrgUnitPositionLink.organisationStructureID = :organisationStructureID 
    AND OrgUnitPositionLink.organisationUnitID = :orgUnitID 
    AND PositionHolderLink.positionID = OrgUnitPositionLink.positionID 
    AND PositionHolderLink.organisationStructureID = OrgUnitPositionLink.organisationStructureID 
    AND Users.userName = PositionHolderLink.userName 
    AND Users.statusCode = :recordStatus 
    AND PositionHolderLink.recordStatus = :recordStatus 
  )