Oracle Function -- I am passing a Date in an Oracle Function . Before I use that date in Sql queries under Begin block i want to change the date : In A Function I want to Pass A Date ... beDate is what i am passing .

Now I want to Update beDate as last day of beDate month  if beDate is Last_business_day otherwise last_day of previous month .

Can Someone Please provide the syntactitally correct answer for the IF Part in the below code .



    CREATE OR REPLACE Function AnyFunction ( beDate IN varchar2 )
       RETURN date
      IS
        
    
    IF beDate = [ Last_Business_Day ] then beDate = last_day(beDate) ;
    
    ELSIF beDate >  [ Last_Business_Day ] then beDate = last_day(beDate) ;
    
    ELSE
    beDate = last_day(add_months(last_day(beDate),-1) ) ;

    END IF ;

    BEGIN
    
      
       
    END;