Skip to Main Content

Is it advisable to call Function directly in Case statement?

Jeevan AnandAug 27 2019 — edited Aug 27 2019

Pseudo code of my actual code:

create function CALCULATE_nu ( a number, B number )

return number as

c number;

begin

C := a+ B;

return c;

end;

/

set serveroutput on;

begin

  case when CALCULATE_NU (5,7) > 10 then

    DBMS_OUTPUT.PUT_LINE('Number is greater than 10');

  else

    DBMS_OUTPUT.PUT_LINE('Number is less than 10');

  end case;

end;

/

During Code review, my reviewer asked me to store the Function- return value in varaible and validate by if or case statement. Can anyone tell me the difference between calling directly in Case statement or proposed method different?

Is there any issue in calling Function in case statement like above code?

Comments
Post Details
Added on Aug 27 2019
6 comments
1,705 views