Operation Details
Description: Returns the last appeal stage for a product appeal process definition. The last stage can be identified because its appealStageID will not be used by any other stage in the process as its parentAppealStageID. There can only be one last appeal stage for a product appeal process.
Sterotype: ns
SQL
SELECT
  appealStageID
INTO
  :appealStageID 
FROM
  AppealStage 
WHERE productAppealProcessID = :productAppealProcessID 
  AND appealStageID NOT IN 
  ( 
  SELECT
    parentAppealStageID 
  FROM
    AppealStage 
  WHERE productAppealProcessID = :productAppealProcessID 
    AND parentAppealStageID IS NOT NULL 
  )