Database SQL Operation: OrganisationUnit.countLeadPositionForOrgUnitByUser
Description: | Returns the count of position for an organization unit for which user holds position. |
Sterotype: | ns |
SELECT
count(*)
INTO
:numberOfRecords
FROM
position p,
OrgUnitPositionLink oup,
PositionHolderLink phl
WHERE oup.organisationUnitID = :organisationUnitID
AND p.positionID = oup.positionID
AND oup.positionID = phl.positionID
AND p.leadPositionInd ='1'
AND phl.userName = :userName
AND phl.recordStatus = :recordStatus
AND :currentDate >= phl.fromDate
AND
(
:currentDate <= phl.toDate
OR phl.toDate IS NULL
)
|