Hi,
Thanks, please find my query below. if i pass pass the prompt at the end the result is coming only Not Available.
( Note: I have to show the LOV in the prompt)
select * from (select
CASE
when count(distinct mo_id ) over(partition by 1) >1 then 5
WHEN MO_ID=to_char(sysdate,'yyyymm') then 1
When MO_ID<to_char(sysdate,'yyyymm') then 3
else null end as RES_IND ,
ind,mo_id, live_dt, case when mo_beg_dt<live_dt then 0 else MONTHS_BETWEEN(mo_beg_dt, live_dt)
end as diff_mo, mtd_pm from (
select *
from (
select 1 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, SubStr(MO_NAM,1,3)|| ’ - ’ || SubStr(YR_NUM,3,2) mtd_pm from mo_dim where yr_num>=2017
union
select 1 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, ‘PREVIOUS’ mtd_pm from mo_dim where yr_num>=2017
union
select 1 ind, MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, ‘PREVIOUS WEEK’ mtd_pm from mo_dim where yr_num>=2017
union
select 1 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, ‘PREVIOUS 4 WEEKS’ mtd_pm from mo_dim where yr_num>=2017
union
select 1 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, SubStr(MO_NAM,1,3)|| ’ - ’ || SubStr(YR_NUM,3,2) mtd_pm from mo_dim where yr_num>=2017
union
select 3 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, ‘PREVIOUS’ mtd_pm from mo_dim where yr_num>=2017
union
select 3 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, SubStr(MO_NAM,1,3)|| ’ - ’ || SubStr(YR_NUM,3,2) mtd_pm from mo_dim where yr_num>=2017
union
select 5 ind,MO_DIM.mo_id,mo_dim.mo_beg_dt, (select mo_beg_dt from mo_dim where mo_id=201806) LIVE_DT, ‘NOT AVAILABLE’ mtd_pm from mo_dim where yr_num>=2017
)
)where mo_id in @Prompt(‘Enter value’,‘A’,Multi,Free,Not_Persistent)
) where RES_IND=IND
Once aging thanks for your help
vsenni (BOB member since 2015-11-10)