You are on page 1of 2

PLSQL PROGRAM

1.Write a programe to find out the greatest of any 4 number?


SET SERVEROUTPUT ON;
DECLARE
num1 NUMBER := &num1; -- Replace &num1, &num2, &num3, and &num4 with actual
values
num2 NUMBER := &num2;
num3 NUMBER := &num3;
num4 NUMBER := &num4;
max_num NUMBER;
BEGIN
IF num1 > num2 AND num1 > num3 AND num1 > num4 THEN
max_num := num1;
ELSIF num2 > num3 AND num2 > num4 THEN
max_num := num2;
ELSIF num3 > num4 THEN
max_num := num3;
ELSE
max_num := num4;
END IF;
DBMS_OUTPUT.PUT_LINE('The greatest number is: ' || max_num);
END;
2.write a programe to enter any number and find out weather it is positive or
negative or 0.
3.wap to accept any number and check weather that is a multiple of only three
or only five or three and five both or none of them.

4.wap to increase the salary for the employees of a particular depertment and
enter the number of records updated, date, time, dept-number, and name of
the person who increased the salary into another table called cursor _ret.

5.Wap to find out the factorial of any number.


declare
n number;
i number;
fact number;
begin
n:=:n;
i :=1;
fact :=1;
while i <=n loop
fact:=fact*i;
i:=i+1;
end loop;
dbms_output.put_line(' factorial of number is ' ||fact);
end;
6.write a plsql block to take the salary of an employee into a variable. And check
if his or her salary is less then 3k.if it is less then 3k then update the emp table
with 3k.accept the emp number from the user.
7.wap to input any number and check weather it is even or odd.
DECLARE
num NUMBER := :num; -- Replace &num with the actual number you want to
check
BEGIN
IF num MOD 2 = 0 THEN
DBMS_OUTPUT.PUT_LINE(num || ' is even.');
ELSE
DBMS_OUTPUT.PUT_LINE(num || ' is odd.');
END IF;
END;
/
8.wap to enter any alphabet and check weather it is consonent Or vowel.
9.wap to delete the data for the employee after getting a job.

10.write a plsql programe to check a number is armstrong Or not.

You might also like