Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

help me to create a simple calculator by pl sql

936860May 11 2012 — edited May 11 2012
hey

please I wanna helop to to create a simple calculator by pl sql

i used this code but it doesn't work!

declare
n1 number;
n2 number;
cal varchar2(20);
cc number;
begin
n1:=&n1;
n2:=&n2;
cal:=&cal;
if cal = '+' then
cc:=n1+n2;
elsif cal = '-' then
cc:=n1-n2;
elsif cal = '*' then
cc:=n1*n2;
elsif cal = '/' then
cc:=n1/n2;
else
dbms_output.put_line('error');
end if;
dbms_output.put_line(cc);
end;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2012
Added on May 11 2012
4 comments
7,067 views