COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Maharashtra State Board of Technical Education,
Mumbai
Vidyavardhini Charitable Trust’s
Abhaysinhraje Bhonsle Institute of Technology
Shahunagar - Shendre, Satara.
2020-2021
A PROJECT REPORT ON
Project Name: “Execute PL/SQL Program using different conditional statement
(if else, for /while)”
SUBMITED BY:
1) PATIL SHUBHAM NANASO (16)
2) PAWAR TEJAS GOPAL (17)
3) SAWALE KARAN YUVRAJ (18)
UNDER THE GUIDANCE OF: Mr. Kazi. A.D
Sub Teacher Name: Mr. Kazi. A.D
(Computer Dept.)
CERTIFICATE:
Page 1 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
This is to certify that:
▪ Roll No: 16
▪ Roll No: 17
▪ Roll No: 18
Diploma in Computer Engineering, has satisfactorily completed the project work under
mini project report on, Project Name: “Execute PL/SQL Program using different
conditional statement (if else, for /while)” under my guidance and supervision, this is
part of partial fulfilment of the requirement for submission of Maharashtra State Board
of Technical Education, Mumbai during Semester third of Academic year 2020-2021.
GUIDE H.O.D PRINCIPAL
Mr. Kazi A. D Ms.Nikam.R. A Mr. Dhumal S. U.
Computer.Dept Computer.Dept. A.B.I.T (Poly), Satara
A.B.I.T (Poly), Satara A.B.I.T (Poly), Satara
Page 2 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
TABLE OF CONTENTS
SR .NO INDEX PAGE NO
1 Brief Introduction 04
2 Aim of the Microproject 05
3 Action Plan 06
4 Resources Required 07
5 Brief Description 08
6 Aim of Microproject 12
7 Actual Producar followed 13
8 Acknowledgement 17
9 Reference 18
Page 3 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Brief Introduction
They’re come situation in real life when we need to make some
decision and based ob these decisions we decide that should we do
next. Similar situation arises in programming also where we need to
make some decision, we will execute the next book of code.
1.if then else statement
2.if then statement
3.Nested if then statement
4.if then-else-then-else ladder
The project skill will help the student will understand the pl/sql
statement to retrive the needed information about the table as per their
specified condition og that the desion making statement….
Page 4 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
AIM OF MICROPROJECT
Student should have able to execute pl/sql statement using
if then else statement
if then statement
Nested if then statement
if then-else-then-else ladder
this project skill will help the student execute queries to retrive the
needed information for the table as per the specific condition
Page 5 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
ACTION PLAN
Action Details of activity Start Date Finish Date Responsible
Plan: Team
Sr. No member
1 Selected the topic for 10-01-21 15-01-21 TEJAS
Micro-project
2 We organised things 15-01-21 20-01-21 KARAN/
required for our project SHUBHAM
3 We browsed the internet 20-01-21 25-01-21 SHUBHAM
for information and raw
data
4 We attended extra 25-01-21 30-01-21 ALL
lectures for our project
topic
5 We made points/notes 01-02-21 06-02-21 TEJAS
on the information we
collected
6 We created a word 08-02-21 13-02-21 KARAN
document with help of
our teacher
7 We made corrections by 15-02-21 20-02-21 ALL
discussing with our
teacher
8 We also created a PDF 22-02-21 26-02-21 SHUBHAM
document to make a
hard copy of the report
Page 6 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Resource Required
Software requirements
Sr.No. Name of Specification Qty. Remark
Resource
1. Operation Window XP/7 or Linux 1 Yes
System
2. User Oracle database log 1 Yes
Interface express addition
3. Software MS access software 1 Yes
Page 7 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
BRIEF DESCRPTION
TYPE OF OPREATOR
• OVERVIEW OF PL/SQL CONTROL
• Testing Conditions: IF and CASE Statements
• Controlling loop iteration; loop and EXIT statement
• Sequential control: GOTO and NULL statement
Page 8 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Overview of PL/SQL Control Structures
Procedural computer programs use the basic control structures shown
in Figure .
Figure Control Structures
Description of "Figure Control Structures"
The selection structure tests a condition, then executes one sequence
of statements instead of another, depending on whether the condition
is true or false. A condition is any variable or expression that returns
a BOOLEAN value. The iteration structure executes a sequence of
statements repeatedly as long as a condition holds true. The sequence
structure simply executes a sequence of statements in the order in
which they occur.
Page 9 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Testing Conditions (IF and CASE Statements)
The IF statement executes a sequence of statements depending on
the value of a condition. There are three forms of IF statements: IF-
THEN, IF-THEN-ELSE, and IF-THEN-ELSIF. For a description of the
syntax of the IF statement, see IF Statement.
The CASE statement is a compact way to evaluate a single condition
and choose between many alternative actions. It makes sense to
use CASE when there are three or more alternatives to choose from.
For a description of the syntax of the CASE statement, see CASE
Statement.
Page 10 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Relational Operator
The following table shows all the relational operators supported by C
language. Assume variable A holds 10 and variable B holds 20 then –
Operator Description Example
== Checks if the values of two operands are (A == B) is
equal or not. If yes, then the condition not true.
becomes true.
!= Checks if the values of two operands are (A != B) is
equal or not. If the values are not equal, true.
then the condition becomes true.
> Checks if the value of left operand is greater (A > B) is
than the value of right operand. If yes, then not true.
the condition becomes true.
< Checks if the value of left operand is less (A < B) is
than the value of right operand. If yes, then true.
the condition becomes true.
>= Checks if the value of left operand is greater (A >= B) is
than or equal to the value of right operand. not true.
If yes, then the condition becomes true.
<= Checks if the value of left operand is less (A <= B) is
than or equal to the value of right operand. true.
If yes, then the condition becomes true.
Page 11 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Aim of Microproject
PL/SQL has three categories of control statements:
• Conditional selection statements, which run different
statements for different data values.
The conditional selection statements are IF and and CASE.
• Loop statements, which run the same statements with a series
of different data values.
The loop statements are the basic LOOP, FOR LOOP,
and WHILE LOOP.
The EXIT statement transfers control to the end of a loop.
The CONTINUE statement exits the current iteration of a loop and
transfers control to the next iteration.
Both EXIT and CONTINUE have an optional WHEN clause,
where you can specify a condition.
• Sequential control statements, which are not crucial to PL/SQL
programming.
The sequential control statements are GOTO, which goes to a
specified statement, and NULL, which does nothing.
Page 12 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
ACTUAL OF MICROPROJECT
IF-THEN-ELSE Statement
• The IF-THEN-ELSE statement is mainly used to select between
two alternatives based on the condition.
• Below is the syntax representation of IF-THEN-ELSE statement.
Syntax for IF-THEN-ELSE Statements:
IF <condition: returns Boolean>
THEN
-executed only if the condition returns TRUE
<action_blockl>
ELSE
-execute if the condition failed (returns FALSE)
<action_block2>
END if;
• In the above syntax, keyword 'IF' will be followed by a condition
which evaluates to 'TRUE'/'FALSE'.
• The control will execute the <action_block1> only if the condition
returns <TRUE>.
• In case of condition evaluates to <FALSE> then, SQL will execute
<action_block2>.
• In any case, one of the two action blocks will be executed.
Note: Whenever condition evaluates to 'NULL', then SQL will treat
'NULL' as 'FALSE'.In this example, we are going to print message
whether the given number is odd or even.
Page 13 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
DECLARE
a NUMBER:=11;
BEGIN
dbms_output.put_line (‘Program started');
IF( mod(a,2)=0) THEN
dbms_output.put_line('a is even number' );
ELSE
dbms_output.put_line('a is odd number1);
END IF;
dbms_output.put_line (‘Program completed.’);
END;
/
Code Explanation:
• Code line 2: Declaring the variable 'a' as 'NUMBER' data type and
initializing it with value '11'.
• Code line 4: Printing the statement "Program started".
• Code line 5: Checking the condition, whether modulus of variable
'a' by '2' is 0.
• Code line 6: If '0', then "a is even number" will be printed.
• Code line 7: If the modulus value is not equal to '0', then the
condition returns <FALSE>, so the message "a is odd number"
will be printed.
• Code line10: Printing the statement "Program completed"
Code Output:
Program started.
a is odd number
Program completed.
Page 14 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
While loop Statement
WHILE loop statement works similar to the Basic loop statement
except the EXIT condition is at the very beginning of the loop.
It works like an entry-check loop in which execution block will not even
be executed once if the condition is not satisfied, as the exit condition
is checking before execution part. It does not require keyword 'EXIT'
explicitly to exit from the loop since it is validating the condition
implicitly each time of the loop.
WHILE <EXIT condition>
LOOP
<execution block starts>
.
.
.
<execution_block_ends>
END LOOP;
Syntax Explanation:
• In the above syntax, keyword 'WHILE' marks beginning of the
loop and 'END LOOP' marks the end of the loop.
• EXIT condition is evaluated each time before the execution part is
starting executing.
• The execution block contains all the code that needs to be
executed.
• The execution part can contain any execution statement.
Page 15 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
While loop program:
DECLARE
a NUMBER :=1;
BEGIN
dbms_output.put_line('Program started');
WHILE (a <= 5)
LOOP
dbms_output.put_line(a);
a:=a+1;
END LOOP;
dbms_output.put_line(‘Program completed' );
END:
/
Code Explanation:
• Code line 2: Declaring the variable 'a' as 'NUMBER' data type
and initializing it with value '1'.
• Code line 4: Printing the statement "Program started".
• Code line 5: Keyword 'WHILE' marks the beginning of the loop,
and it also checks whether the value of 'a' is less than or equal to
5
• Code line 7: Prints the value of 'a'.
• Code line 8: Increments the value of 'a' by +1.
• Code line 9: Keyword 'END LOOP' marks the end of execution
block.
• The code from line 7 and line 8 will continue to execute till 'a'
reaches the value 6, as the condition will return TRUE, and the
control will EXIT from the loop.
• Code line 10: Printing the statement "Program completed"
Output:
Program started
1
2
3
4
5
Program completed
Page 16 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Acknowledgement:
We take this opportunity to express sincere thanks to our project
guide. Mr. Kazi. A.D Under whose guidance our project is done.
We also thanks to all the Computer department teachers for their
valuable guidance, and timely suggestions without which we
could not complete this project work.
Only because of our staff inspiration and instructions we
could achieve satisfactory completion of project work.
Last but not least, we wish to thanks all of those who have helped us
directly or indirectly in this project work.
Page 17 of 18
COMPUTER ENGINEERING DATABASE MANAGEMENT SYSTEM
Reference
PL/SQL Control Statements (oracle.com)
Oracle PL/SQL WHILE LOOP with Example (guru99.com)
Page 18 of 18