/* All Package Versions */
SELECT pv.pkg_version, 
	   pv.dlocked,
	   pv.pv_id,
       DECODE ( pv.pv_id, :COMPARE_PV_ID, 'selected', NULL ) AS selected
  FROM PACKAGES pkg, package_versions pv
 WHERE pkg.pkg_id = pv.pkg_id  
   AND pkg.pkg_id = :PKG_ID
   AND NVL( pv.v_ext, '|LINK_A_NULL|' ) = NVL( :V_EXT, '|LINK_A_NULL|')
 ORDER BY pv.v_ext ASC, pv.pkg_version ASC