Type wise Dynamic Function

 create or replace function         GET_EXPENSE_DTL (in_type in varchar2,in_id in number)

return varchar2 is

v_name varchar2(256);

begin 


if in_type  = 'AMOUNT' then

SELECT SUM(AMOUNT) AMOUNT

INTO V_NAME 

  from EXPENSE_DTL

 where EXPENSE_MST_ID=in_id;

 

elsif in_type  = 'DUE' then

SELECT SUM(DUE) AMOUNT

INTO V_NAME 

  from EXPENSE_DTL

 where EXPENSE_MST_ID=in_id;


  else

  null;

  end if ;

  RETURN V_NAME;

  EXCEPTION  WHEN OTHERS THEN  RETURN  NULL;

END;

/

Post a Comment

Previous Post Next Post