Hoping some one can help, when I run the following code in PL/SQL developer it runs without an issue - however when I put the same code into an IAL no records are created. Why would that be please ?
With Rowsnum As (
Select to_char(dt,'dd/mm/yyyy') dt, row_number() Over( Order by dt) rn
From (
SELECT ifsapp.cd_user_util_api.get_previous_period_end_date(sysdate) -366
+ level dt
from dual
connect by level <= ifsapp.cd_user_util_api.get_previous_period_end_date(sysdate)
- (ifsapp.cd_user_util_api.get_previous_period_end_date(sysdate)-366)
) rws
where to_char ( dt, 'fmday', 'nls_date_language = English' ) = 'monday'
),
RqdParts As (
select part_no, ifsapp.Inventory_Part_API.Get_Description(CONTRACT,PART_NO) part_description, Contract
FROM ifsapp.Inventory_Part
where contract Not In ('CPH','CTM','VMS','CGP')
--and part_no In ('WMPI10067','500086536','WSBB10501','WMVA10007')
and Nvl(Substr(ifsapp.Inventory_Part_API.Get_Accounting_Group(contract,part_no),1,2),'Y') Not In ('IS','PH')
)select ip.part_no, ip.Part_description
, Sum( Nvl(quantity,0) ) quantity
, rn
, Substr(location_no,1,4) Warehouse, ip.contract Site, 'HIST' Row_Type
--, to_char(TRUNC(date_applied, 'DAY')+1,'dd/mm/yyyy')from RqdParts ip Left Outer Join ifsapp.INVENTORY_TRANSACTION_HIST iph On ip.part_no=iph.part_no and ip.contract = iph.contract
LEFT OUTER Join Rowsnum On to_char(TRUNC(date_applied, 'DAY')+1,'dd/mm/yyyy') = dtwhere Substr(location_no,1,4) In ('M100','M200','M300','M400','M500') and direction='-' and
date_applied BETWEEN ifsapp.cd_user_util_api.Get_previous_period_end_date(sysdate) -366 and ifsapp.cd_user_util_api.Get_previous_period_end_date(sysdate)
Group by ip.part_no, ip.part_description
, rn
, Substr(location_no,1,4), ip.contract