-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimple PL SQL
More file actions
52 lines (34 loc) · 712 Bytes
/
Simple PL SQL
File metadata and controls
52 lines (34 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#//Add to static input numbers
SQL> declare
2 a integer :=10;
3 b integer :=20;
4 c integer;
5 Begin
6 c:=a+b;
7 dbms_output.put_line('The Sum is :'||c);
8 end;
9 /
The Sum is :30
PL/SQL procedure successfully completed.
#//Sum and Average of two dynamic input numbers
SQL> declare
2 a integer :=&a;
3 b integer :=&b;
4 c integer;
5 d integer;
6 Begin
7 c:=a+b;
8 d:=c/2;
9 dbms_output.put_line(c);
10 dbms_output.put_line(d);
11 end;
12 /
Enter value for a: 10
old 2: a integer :=&a;
new 2: a integer :=10;
Enter value for b: 20
old 3: b integer :=&b;
new 3: b integer :=20;
30
15
PL/SQL procedure successfully completed.