to find only records where na_frm is less than sysdate and less than to ACT_STRT_DT_TWO_DEC_OF or greater than I_FL_DT_UN
i have used below mentioned decode function in while loop to get rid of records where na_ord in (2,3) as in result i want only 1 row where na_ord =‘1’ because other two rows dates are after sysdate.
Thanks for your reply… i need to use while loop as one single id can have multiple na_frm and na_to and from that i need to find only those dates which lies in between condition which i specified earlier…
source -> query in which i used lookupfunction to get the na_frm and na_to from tab where na_id = wl_id and $G_loop = tab.order-> tab joined to ->query_1 and query with wl_id = tab.na_id and in transformation mapped na_frm to decode(
tab.NA_FRM < sysdate() and
(tab.NA_FRM <= Query. ACT_SRT_DT_TWO_DEC_OF or
tab.NA_FRM > Query.I_FL_DT_UN), tab.NA_FRM,
NULL
)
mapped na_to to decode(
tab.NA_TO < Query.ACT_SRT_DT_TWO_DEC_OF, tab.NA_TO,
tab.NA_TO > sysdate(), NULL,
nvl(tab.NA_TO, sysdate())
)
-> query_2 checked if na_frm and na_to is not null then add days difference to I_FL_DT_UN
it is working fine… the problem is coming that it is inserting multiple rows in target table… where only one row should insert into target table.