Thursday, August 24, 2017

How to find out two date month number in oracle database



function AVG_SFTFormula return Number is
    V     NUMBER;
begin
    SELECT TRUNC(MONTHS_BETWEEN( :P_ENDDT, :P_stdt))
    INTO V
    FROM DUAL;
  
   IF V <1 br="" then="">       RETURN(0);
   ELSE
        RETURN(NVL(:TOT_SFT,0)/NVL(V,0));
   END IF;
  
  
end;


---------------
function AVG_SFTFormula return Number is
    V     NUMBER;
begin
    select 12+(to_char(MAX(TRUNC(to_date(MDATE),'RR')),'MM')-to_char(min(to_date(MDATE)),'MM'))
    INTO V
    from sales_master where slcode=:SLCODE AND MDATE BETWEEN :P_stdt AND :P_ENDDT;
  
   IF V <1 br="" then="">       RETURN(0);
   ELSE
        RETURN(NVL(:TOT_SFT,0)/NVL(V,0));
   END IF;
  
  
end;

No comments:

Post a Comment

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...