Experiment-09
Object: To perform mathematical
operation of two numbers using PL/SQL.
Requirement: Windows XP, Oracle 9i.
Program Code:
SQL> declare
2 a
number(2);
3 b
number(2);
4 c
number(4);
5 d
number(4);
6 e
number(4);
7 f
number(4);
8
begin
9
a:=&a;
10
b:=&b;
11
c:=a+b;
12
d:=a-b;
13 e:=a*b;
14
f:=a/b;
15
dbms_output.put_line(c);
16
dbms_output.put_line(d);
17
dbms_output.put_line(e);
18
dbms_output.put_line(f);
19 end;
20 .
SQL>
/
Output:
Enter
value for a: 3
old 9: a:=&a;
new 9: a:=3;
Enter
value for b: 2
old 10: b:=&b;
new 10: b:=2;
5
1
6
2
PL/SQL
procedure successfully completed.
Result: The above command to perform the
mathematical operation on two number has
been successfully executed.
0 comments:
Post a Comment