Experiment-17
Object:
Write a PL/SQL code to create and use
process.
Requirement: Windows XP, Oracle 9i.
Program Code:
SQL> create or replace procedure PROCESS(A in number,B in
number,C out number,D out number,E out number,F out number) is
2 begin
3 C:=A+B;
4 D:=A-B;
5 E:=A*B;
6 F:=A/B;
7 end;
8 .
OUTPUT :
SQL> /
Procedure created.
PROGRAM CODE :
SQL> declare
2 A number;
3 B number;
4 C number;
5 D number;
6 E number;
7 F number;
8 begin
9 A:=&firstnumber;
10 B:=&secondnumber;
11 PROCESS(A,B,C,D,E,F);
12 dbms_output.put_line('Addition is '||C);
13 dbms_output.put_line('Subtraction is '||D);
14 dbms_output.put_line('Multiplication is
'||E);
15 dbms_output.put_line('Division is'||F);
16 end;
17 .
OUTPUT :
SQL> /
Enter value for firstnumber: 4
old 9: A:=&firstnumber;
new 9: A:=4;
Enter value for secondnumber: 2
old 10: B:=&secondnumber;
new 10: B:=2;
Addition is 6
Subtraction is 2
Multiplication is 8
Division is2
PL/SQL procedure successfully completed.
RESULT: The
above program to create and use the process has been successfully executed.
0 comments:
Post a Comment