0% found this document useful (0 votes)
146 views

PL/SQL Lab Assignment 7 Sub Programs: Functions and Procedures

This document outlines several PL/SQL lab assignments involving functions and procedures: 1. Write local procedures to perform math operations on input numbers and return multiple values, as well as a procedure to update an employee's salary in a database. 2. Write stored procedures to perform math operations on input numbers and delete an employee from a database. 3. Write local functions to return a customer's balance or the total number of employees, and stored functions to add numbers or calculate total salary by department. 4. Create stored subprograms to insert/delete database records and update/return values, as well as functions to calculate rates, quantities, and total student marks using cursors.

Uploaded by

Rishabh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

PL/SQL Lab Assignment 7 Sub Programs: Functions and Procedures

This document outlines several PL/SQL lab assignments involving functions and procedures: 1. Write local procedures to perform math operations on input numbers and return multiple values, as well as a procedure to update an employee's salary in a database. 2. Write stored procedures to perform math operations on input numbers and delete an employee from a database. 3. Write local functions to return a customer's balance or the total number of employees, and stored functions to add numbers or calculate total salary by department. 4. Create stored subprograms to insert/delete database records and update/return values, as well as functions to calculate rates, quantities, and total student marks using cursors.

Uploaded by

Rishabh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PL/SQL Lab Assignment 7

Sub Programs: Functions and Procedures

1. Write a PL/SQL code of a local procedure that accepts two numbers and return
its addition, subtraction, multiplication and division or in other words write a
procedure to return multiple values through parameters.
2. Write a PL/SQL code of a local procedure raise_salary, which accepts two
parameters empid and bonus. It increases the salary of the employee by passed
value of bonus and update it to the database.
3. Write a PL/SQL code of a Stored procedure that accepts two numbers and
return addition, subtraction, multiplication and division of two numbers.
4. Write a PL/SQL code to create a stored procedure fire_employee to delete
employee on the basis of passed employee number. Also call this stored
procedure.
5. Write a PL/SQL code for local function to return balance of the customer on the
basis of account number which is passed to this local function as its parameter.
CUST(acc_no, name, balance)
6. A PL/SQL code to write local function to return total number of employees in
EMP table.
7. A PL/SQL code to create a stored function to add two numbers. Call this stored
function.
8. Write a PL/SQL code to create a stored function to find total salary paid to
employees of a particular department number. The department number is
passed as parameter to the stored function. EMP (eno, ename, job, salary,
deptno)
PL/SQL Lab Assignment 8
Sub Programs: Functions and Procedures

1. Create a stored sub program to insert a record in emp table. We have to just
pass the values of columns to this stored sub program and it should insert a
record with passed parameter values.
2. Create a stored sub program to delete employees on the basis of passed
department number. It should return the value to provide the information of
number records deleted to the calling environment.
3. Write stored function to return he number of records updated by Update
statemen and call this function from a block. Also Write a local function for the
same.
4. Write a function which accepts an item code and find the rate of the item for
the item code supplied by fetching its value from item table. It should also find
quantity from sale table for the given item code. This function should return the
value of the product of rate*quantity.
Write a PL/SQL block calls this function by passing codes from 1 to 5 and adds
up the total values returned by the function and displays it.
Item (item_code, name, rate)
Sale(Item_code, Cno, qty)
5. Write a Stored function to return the total marks for a particular student. Call
this function from cursor to process all the records of student. Initially Total
column is NULL. Its value will be updated by a PL/SQL block that call a stored
Table STU (Rno, Name, MST, Quiz, EST, Total)
Q 6 and Q 7

You might also like