Ad Code

Responsive Advertisement

Pl/Sql queries

1. Create a stored procedure named Raise_pay that will increase an employee’s id no. and the percent increase to his salary.

Create or Replace procedure raise_pay
(
pEmpno. Emp.Empno%type
pPercent Number
)
As
incAmount Emp.Sal%Type;
Sal Emp.Sal%type;
Begin
Select SAL into sal from Emp
Where Empno. = pEmpno. ;
incAmount := pPercent * sal/100 ;
update Emp set sal = sal + incAmount
where Empno. = pEmpno. ;
End;




Write procedure that adds Item name and Supplier name (both passed as parametre) in Item table along with a unique item code. The code should be calculated as existing last code (generally maximum code)+1


Create or Replace procedure New_item
(It_name VARCHAR 2, Sup_name VARCHAR 2)
As
Code Item.Code%type;
Begin
Select Max(code)+1
INTO It_code
From Item ;
Insert into Item(code, Item name, Supplier name)
Values(108, pencil, Camlin);
End;

Post a Comment

0 Comments

Close Menu