Dbms Lab Name: Rollno: Section
Dbms Lab Name: Rollno: Section
OUTPUT :
Enter value for name: dinesh
old 4: name := '&name';
new 4: name := 'dinesh';
Your name is dinesh
Q.2. Write a PL/SQL program to input 2 numbers and display addition, subtraction, multiplication, division and
modulus of these 2 numbers.
OUTPUT :
Enter value for a: 5
old 2: a number := &a;
new 2: a number := 5;
Enter value for b: 2
old 3: b number := &b;
new 3: b number := 2;
Addition = 7
Subtraction = 3
Multiplication = 10
Division = 2.5
Modulus = 1
Q.3. Write a PL/SQL program to input a 5 digit number and display the reverse of that number.
OUTPUT :
Enter value for n: 12345
old 2: n number := &n;
new 2: n number := 12345;
Reverse = 54321
Q.4. Write a PL/SQL program to read the radius from the keyboard and insert it into table CIRCLE the radius along
with area, the CIRCLE table has two columns defined as radius and area.
OUTPUT :
Enter value for r: 5
old 2: r number := &r;
new 2: r number := 5;
Radius and area inserted in circle table
RADIUS AREA
---------- ----------
5 78.5
Q.5. Write a PL/SQL program to input the employee number and display its total salary (i.e. sal + comm, and if comm
is null assume it to be 0).
OUTPUT :
Enter value for eno: 7369
old 2: eno emp.empno%type := &eno;
new 2: eno emp.empno%type := 7369;
Totalsal = 800
Q.6. Write a PL/SQL program to input a number and find whether it is even or odd, if it is even insert it into the table
EVEN or insert it into table ODD, both tables have only one column i.e. NUM.
OUTPUT :
Enter value for n: 5
old 2: n number := &n;
new 2: n number := 5;
no rows selected
NUM
----------
5
Q.7. Write a PL/SQL program to input a number and find the factorial of that number using
(i) For loop (ii) Simple loop (iii) While loop
OUTPUT :
Enter value for n: 5
old 2: n number := &n;
new 2: n number := 5;
Factorial of 5 is = 120
OUTPUT :
1
2 3
4 5 6
PL/ SQL Program :
OUTPUT :
1
2 3
4 5 6
Department of CSE, BIT DURG Sign of student Page 83
DBMS LAB NAME : Rollno : Section :
OUTPUT :
1
1 2 1
1 2 3 2 1
OUTPUT :
A
A B
A B C
Teacher I/ C
Prof. Dinesh Kumar Bhawnani