IanWaterman
Programmer
I have a function which works 99.99% of the time, however, we have discovered another exception but I can not work out how to add it in.
This is current function
I need to add another exception so that if Null results in the above the following code kicks in and is my catch all
But when I add in i get a compilation error
Error(47,15): PLS-00483: exception 'NO_DATA_FOUND' may appear in at most one exception handler in this block
Thank you
Ian
This is current function
Code:
create or replace
Function FCIM_Start_Of_Risk_Period_RH (Polno Genpolicy.Policy_Key%Type, Eff_Date riskhistory.Rkh_Effective_Date%type)
Return Date Is
Ret_Date Date;
Start_Date Date;
Begin
Begin
Select Trunc(Start_date) Into Ret_Date
from
(Select Add_Months(itm_end_date+1 ,-12) Start_date
From Riskhistory
inner join Policy_items on Rkh_Policy_Cde = itm_Policy_Cde
and rkh_version = itm_version
and itm_item_type = 0
and itm_status_cde <> 3
Where Rkh_Policy_Cde = PolNo
And Rkh_Live in ('N', 'Y')
And Trunc(Rkh_Effective_Date) <= Eff_Date
And (Lower(Rkh_Description) Like '%inception%'
or Lower(Rkh_Description) Like '%renew%'
or Lower(rkh_description)Like '%policy migrated%')
Order By Rkh_Version Desc)
where rownum=1;
return Ret_Date;
exception
When no_data_found Then
Select Trunc(Start_date) Into Ret_Date
from
(select distinct ad.aon_link_policy, ad.aon_main_policy, Add_Months(itm_end_date ,-12) Start_date, Rkh_Version
from addons ad
inner join riskhistory on ad.aon_main_policy = rkh_policy_cde
--and AD.AON_VERSION = RISKHISTORY.RKH_VERSION
And Rkh_Live in ('N', 'Y')
And Trunc(Rkh_Effective_Date) <= Eff_Date
And (Lower(Rkh_Description) Like '%inception%'
or Lower(Rkh_Description) Like '%renew%'
or Lower(rkh_description)Like '%policy migrated%')
inner join Policy_items on Rkh_Policy_Cde = itm_Policy_Cde
and rkh_version = itm_version
and itm_item_type = 0
and itm_status_cde <> 3
Where ad.aon_link_policy = PolNo
Order By Rkh_Version Desc)
where rownum=1;
return ret_date;
When others then raise;
End;
END;
I need to add another exception so that if Null results in the above the following code kicks in and is my catch all
Code:
When no_data_found Then
select Trunc(Pol_Start_Date), Trunc(Pol_Ren_Date)
Into start_Date, ren_Date
from genpolicy where policy_key = polno;
Ret_Date := To_Date(To_Char(start_Date,'DD-MM-')||To_Char(Add_Months(ren_Date,-12),'YYYY'),'DD-MM-YYYY');
return ret_date;
But when I add in i get a compilation error
Error(47,15): PLS-00483: exception 'NO_DATA_FOUND' may appear in at most one exception handler in this block
Thank you
Ian