Operation Details
Description:  
Sterotype: nsmulti
SQL
SELECT
  dpv1.determinationPackageVersionID,
  dpv1.determinationPackageID,
  dpv1.determinationConfigID,
  dpv1.comments,
  dpv1.minAge,
  dpv1.maxAge,
  dpv1.gender,
  dpv1.productID,
  dpv1.fromDate,
  dpv1.toDate,
  dpv1.determinationPkgVersionNumber,
  dpv1.versionStatus,
  dpv1.name,
  dpv1.createdBy,
  dpv1.dateCreated
INTO
  :determinationPackageVersionID,
  :determinationPackageID,
  :determinationConfigID,
  :comments,
  :minAge,
  :maxAge,
  :gender,
  :productID,
  :fromDate,
  :toDate,
  :determinationPkgVersionNumber,
  :versionStatus,
  :name,
  :createdBy,
  :dateCreated 
FROM
  DeterminationPackageVersion dpv1 
WHERE dpv1.determinationConfigID = :determinationConfigID 
  AND dpv1.determinationPkgVersionNumber = 
  ( 
  SELECT
    MAX(determinationPkgVersionNumber) 
  FROM
    DeterminationPackageVersion dpv2 
  WHERE dpv2.determinationPackageID = dpv1.determinationPackageID 
  ) 
  AND 
  (
    dpv1.toDate IS NULL 
    OR dpv1.toDate > CURRENT_TIMESTAMP 
  ) 
ORDER BY dpv1.name