-- #New:18.03.2019/J.Fes+S.Gueth
-- #Doc: returns used NXRelease when Dataset is saved
-- #Exa: 54;NX 12.0.2.9;MP4;27Nov18

-- get UGMASTER NXRelease
select
 pw.pfnd0release AS NXRelease
from
 infodba.PREF_LIST rl
 inner Join infodba.PFORM pf On (pf.puid = rl.pvalu_0)
 inner Join infodba.PUGPARTATTRIBUTES pw On (pf.rdata_fileu = pw.puid)
where
 rl.puid = :DS_Puid and
 pw.pfnd0release is not null

-- Union both
UNION ALL

-- get NON-MASTER NXRelease
select
 pw.pnx0release AS NXRelease
from
 infodba.PREF_LIST rl
 inner Join infodba.PFORM pf On (pf.puid = rl.pvalu_0)
 inner Join infodba.PNX0APPLICATIONINFOSTORAGE pw On (pf.rdata_fileu = pw.puid)
where
 -- #Doc: rl.puid = pd.puid
 rl.puid = :DS_Puid and
 pw.pnx0release is not null

