You are on page 1of 4

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment -2.3
Student Name: Abhishek UID: 21BCS3967
Branch: CSE Section/Group: ON21BCS620A
Semester: 3rd Date of Performance: 30/09/2022
Subject Name: Database Management System
Subject Code: 21CSH-214

1. Aim: Introduction and implementation of programs using Cursors.

2. Objective: To learn about cursor,its uses and implement %Found


implicit cursor in this experiment.

3. DBMS script and output:


create table information(name varchar(10),ID varchar(10));
insert into information(name,ID)values('Abhishek','21BCS3967');
select * from information;
drop table employees;
drop table emp_temp;
create table employees(employee_id number, first_name varchar(20),
last_name varchar(20), salary number);
insert into employees values(1, 'Aditya', 'Kumar', 90000);
insert into employees values(175, 'Jatin', 'Parihar', 60000);
insert into employees values(3, 'Afroj', 'Molani',70000);
insert into employees values(444, 'shreyansh', 'Srivastava', 400000);
insert into employees values(5, 'Aayushi', 'Pandey', 50000);
CREATE TABLE emp_temp AS

SELECT employee_id, first_name, last_name


FROM employees;
CREATE OR REPLACE PROCEDURE test_proc ( z_emp_id NUMBER
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

) AUTHID DEFINER AS
BEGIN DELETE FROM emp_temp
WHERE employee_id = z_emp_id;
IF SQL%FOUND THEN
DBMS_OUTPUT.PUT_LINE ( 'Delete succeeded for employee_id: ' ||
z_emp_id );
ELSE
DBMS_OUTPUT.PUT_LINE ('No employee of ID '|| z_emp_id||'is
found.');
END IF;
END;
/
BEGIN
test_proc(175);
test_proc(444);
END;
/

Output:-
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Evaluation Grid:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Sr. Parameters Maximum Marks Obtained


No. Marks
1. Worksheet completion including 8
writing learning
objectives/Outcomes.(To be
submitted at the end of the day).
2. Viva Voce/Quiz 10
3. Student Engagement in 12
Simulation/Demonstration/Performance
and Controls
Signature of Faculty (with Date): Total Marks
Obtained out of
30:

You might also like