0% found this document useful (0 votes)
2 views2 pages

PLSQL Journal Programs

The document contains a series of PL/SQL programs demonstrating basic operations and logic. It includes examples for printing a message, performing arithmetic operations, finding the maximum and minimum of numbers, and checking if a year is a leap year. Each program utilizes the DBMS_OUTPUT.PUT_LINE function to display results.

Uploaded by

pandaffbhumre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

PLSQL Journal Programs

The document contains a series of PL/SQL programs demonstrating basic operations and logic. It includes examples for printing a message, performing arithmetic operations, finding the maximum and minimum of numbers, and checking if a year is a leap year. Each program utilizes the DBMS_OUTPUT.PUT_LINE function to display results.

Uploaded by

pandaffbhumre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PL/SQL Journal Programs

1. PRINT 'HELLO FYBCA..!!'

BEGIN
DBMS_OUTPUT.PUT_LINE('HELLO FYBCA..!!');
END;
/

2. ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION

DECLARE
a NUMBER := 10;
b NUMBER := 5;
sum_res NUMBER;
sub_res NUMBER;
mul_res NUMBER;
div_res NUMBER;
BEGIN
sum_res := a + b;
sub_res := a - b;
mul_res := a * b;
div_res := a / b;

DBMS_OUTPUT.PUT_LINE('Addition: ' || sum_res);


DBMS_OUTPUT.PUT_LINE('Subtraction: ' || sub_res);
DBMS_OUTPUT.PUT_LINE('Multiplication: ' || mul_res);
DBMS_OUTPUT.PUT_LINE('Division: ' || div_res);
END;
/

3. FIND MAXIMUM OF TWO NUMBERS

DECLARE
a NUMBER := 10;
b NUMBER := 20;
max_num NUMBER;
BEGIN
IF a > b THEN
max_num := a;
ELSE
max_num := b;
END IF;
DBMS_OUTPUT.PUT_LINE('Maximum: ' || max_num);
END;
/

4. FIND MINIMUM OF THREE NUMBERS

DECLARE
a NUMBER := 10;
b NUMBER := 20;
c NUMBER := 5;
min_num NUMBER;
BEGIN
min_num := LEAST(a, b, c);
DBMS_OUTPUT.PUT_LINE('Minimum: ' || min_num);
END;
/

5. CHECK IF A YEAR IS A LEAP YEAR

DECLARE
year NUMBER := 2024;
BEGIN
IF MOD(year, 4) = 0 AND (MOD(year, 100) <> 0 OR MOD(year, 400) = 0) THEN
DBMS_OUTPUT.PUT_LINE(year || ' is a Leap Year.');
ELSE
DBMS_OUTPUT.PUT_LINE(year || ' is NOT a Leap Year.');
END IF;
END;
/

You might also like