Tuesday, June 19, 2018

Create a function of calculator - DBMS (Function)


create or replace function calculator(no1 in number,no2 in
number,symbol in varchar2)
return number is ans number(10);
begin
if symbol='+'
then
ans:=no1+no2;
elsif symbol='-'
then
ans:=no1-no2;
elsif symbol='*'
then
ans:=no1*no2;
elsif symbol='/'
then
ans:=no1/no2;
end if;
return ans;
end;

No comments:

Post a Comment