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 dpv2.versionStatus = :versionStatus
)
ORDER BY dpv1.name
|