SELECT pkg.pkg_name, pv.pkg_version, proj.proj_name, vt.vtree_name, rt.rtag_name, rt.rtag_id, pv.pv_id
  FROM package_versions pv,
       packages pkg,
       projects proj,
       vtrees vt,
       release_tags rt,
       release_content rc
 WHERE rt.vtree_id = vt.vtree_id
   AND vt.proj_id = proj.proj_id
   AND pv.pkg_id = pkg.pkg_id
   AND rc.rtag_id = rt.rtag_id
   AND rc.pv_id = pv.pv_id
   AND vt.hide = 'N'
   AND LOWER(pkg.pkg_name) LIKE LOWER('/*PKG_NAME*/')
   AND NVL(LOWER(pv.v_ext),'LINK_A_NULL') LIKE NVL(LOWER('/*V_EXT*/'),'LINK_A_NULL')
ORDER BY UPPER(pkg.pkg_name), pv.pv_id, proj.proj_name, vt.vtree_id, rt.rtag_id
   
