Tuesday, January 10, 2017

SQL Queries To Run A List of Bugs + Pre-Reqs Included in PUM Image

Below are queries that I wrote so I can get a list of bugs contained in PUM image and find out if there are any pre-req bugs associated with one particular bug.

Note: these queries are written in Oracle database, so they may need to be modified to make it work with others.

/* How to get all the bugs and if any pre-req exists included in certain PI */
Select H.ptiasprptno as Bug_ID, H.ptiaspspvers as PI_Release, H.ptiasprptsubject as Subject, P.ptiaspprdname as Product_Name, P.ptiaspprdgrpcd as Product_Group,
       Case NVL(PR.ptiasprptnopost, 0) when 0 then 'N' else 'Y' End as PreReq_Exists
From PS_PTIASPRPTHEAD H
   , PS_PTIASPPRD P
   , (Select distinct ptiasprptnopost
      From PS_PTIASPRPTRQPOVW
      ) PR
Where H.ptiaspspvers = '{Enter PI number e.g. 18}'
  --And H.ptiasprptno = '{Enter Bug Number}'
  And P.ptiaspprdid = H.ptiaspprdid
  And PR.ptiasprptnopost (+) = H.ptiasprptno;


Note: I included PreReq_Exists column on the first query, if 'Y' then plug the Bug_ID into the next query to get the pre-req(s) and what PI image


 /* How to get the pre-req(s) for certain bug */
Select PR.ptiasprptno as Bug_ID, H.ptiasprptsubject as Subject, P.ptiaspprdname as Product_Name, P.ptiaspprdgrpcd as Product_Group, H.ptiaspspvers as PI_Release
From PS_PTIASPRPTRQPOVW PR
   , PS_PTIASPPRD P
   , PS_PTIASPRPTHEAD H
Where PR.ptiasprptnopost = '{Enter Bug Number}'
  And H.ptiasprptno = PR.ptiasprptno
  And P.ptiaspprdid = H.ptiaspprdid;

No comments:

Post a Comment