SlideShare a Scribd company logo
DATABASE MANAGEMENT SYSTEM
ORACLE SQL AND PL/SQL
PART II : Application Using Oracle PL/SQL
Teaching Aid Material
(www.phindia.com/gupta)

Authors invite your valuable feedback and suggestions on the book
pkdasgupta@gmail.com
RadhaKrishna_P@infosys.com
DATABASE MANAGEMENT SYSTEM
ORACLE SQL AND PL/SQL
PART II : Application Using Oracle PL/SQL

CHAPTER 5
Introduction to PL/SQL Programming
CHAPTER 5
Introduction to PL/SQL Programming
1 of 9

Why PL/SQL?


Better Performance



Higher Productivity



Full Portability



Tight Integration with SQL



Security

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
2 of 9

Character Set

Type

Characters

Uppercase, lowercase

A-Z , a-z

Digits

0-9

Mathematical and
punctuation symbols

~ ! @ # % & * ( )_ - + = | [ ] { }: ; ’’ ’ < > ?
/

White space

Space, tab, carriage return

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
3 of 9

PL/SQL Identifiers






Identifiers are used to name PL/SQL objects such as constants,
variables, exceptions, procedures, cursors and reserved words.
Identifiers can be up to 30 characters in length, must start with a
letter and can include dollar sign, an underscore, and a pound sign.
Identifiers are case sensitive and cannot include space, tab or
carriage return. An identifier can be enclosed within double quotes.

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
4 of 9

PL/SQL Literals


Literals are specific values and are not represented by identifiers



Can be character, number or Boolean value



To embed single quotes within a string literal, two single quotes next
to each other may be placed

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
5 of 9

PL/SQL Delimiters


Delimiters are symbols with special meaning to PL/SQL



Used to separate identifiers from each other

Delimiter

Characteristics

--

Single-line comment indicator

/*

*/

Multiline comment delimiter

||

Concatenation operator

..

Range operator

;

Statement terminator

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
6 of 9

PL/SQL Variable
Type
Scalar

Purpose
Numeric

NUMBER(p, s)
The maximum precision is 38 digits

Character

VARCHAR2, CHAR, LONG
CHAR and VARCHAR2 are up to 32767 bytes

Date

Range is between 01-Jan-4712BC and
31-Dec-9999AD

Boolean

Can hold TRUE, FLASE or NULL only

RAW

Similar to CHAR variables
LONG RAW is similar to LONG
LONG RAW can be up to 2 gigabytes

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
7 of 9

PL/SQL Variable
Type
LOB

Purpose
BFILE

File locaters pointing to read only large objects in
operating system files

BLOB

BLOB locaters that point to large binary objects inside
the database

CLOB

CLOB locaters point to large character objects inside
the database

NCLOB

NCLOB locaters point large national character set
objects inside the database

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
8 of 9

NULL




Represents unknown values as NULL values
NULL is never equal to anything
NVL, IS NULL or IS NOT NULL

CONSTANT



Requires an initial value
Value cannot be changed

Page reference in the book: 147-152
CHAPTER 5
Introduction to PL/SQL Programming
9 of 9

Default Value


A variable is assigned a default value of NULL while declaration



Can be initialized by assignment operator (: =)

Page reference in the book: 147-152
CHAPTER 5
PL/SQL Structure
1 of 3

PL/SQL Structure
Declare
Variables, Cursors, Constants
Begin
PL/SQL statements
Exception
Statements for error handling
End;

Page reference in the book: 152-159
CHAPTER 5
PL/SQL Structure
2 of 3

IF Statement


Allows actions based upon conditions



IF statement can also be nested



Three forms of IF statements:
IF … THEN …
IF … THEN … ELSE …
IF … THEN … ELSIF … ELSE ….

Page reference in the book: 152-159
CHAPTER 5
PL/SQL Structure
3 of 3

Loops in PL/SQL


Simple Loop

Loop
PL/SQL statements
Exit Condition
End Loop



For Loop

For variable IN Start..End
PL/SQL Statements
End Loop;



While Loop

While <Condition> Loop
PL/SQL Statements
End Loop

Page reference in the book: 152-159
CHAPTER 5
PL/SQL and Oracle
1 of 10

Scope of a Variable in Nested Block
PL/SQL statements can be nested

SQL Cursor




A cursor is a private SQL work area where all commands
defined in the cursor are executed
There are two types of cursors:


Implicit cursor



Explicit cursor

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
2 of 10

Implicit Cursor


It is automatically created and handled by Oracle Server



Support all types of DMLs [Insert/Update/Delete]



Supports SELECT statement that returns only

Explicit Cursor


Needs to be declared explicitly by the programmer



It is handled using cursor-related commands

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
3 of 10

INTO Clause





Into clause is mandatory in a PL/SQL program
It is placed between SELECT and FROM clauses
Acts as a container with the associated variable
Query must return only one row

%TYPE Attribute


Used to declare variables that refer to the column

% ROWTYPE Attribute


Represents a row in a table

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
4 of 10

Example EX5_1

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
5 of 10

EX5_2

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
6 of 10

EX5_3

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
EX5_5

Page reference in the book: 159-168

7 of 10
CHAPTER 5
PL/SQL and Oracle
8 of 10

EX5_10

Page reference in the book: 159-168
CHAPTER 5
PL/SQL and Oracle
EX5_11

Page reference in the book: 159-168

9 of 10
CHAPTER 5
PL/SQL and Oracle
10 of 10

EX5_12

Page reference in the book: 159-168
CHAPTER 5
Short/ Objective Type Question
Q1. Define identifiers, literals and delimiters in Oracle PL/SQL.
Q2. Explain %TYPE and %ROWTYPE attributes with the help of suitable examples.
Q3. What do you understand by SQL cursors?
Q4. Write a PL/SQL program which will accept three numbers and print the smallest among them.
SQL>@ C:/TTP/Q4
Enter value for a: 12
Enter value for b: 34
Enter value for c: 12
Smallest Number is 12
Q5. Write PL/SQL program using Loop … End Loop, For Loop and While Loop, which will accept integer from
1 to 10 and print factorial. For example, factorial of 5 is 5*4*3*2*1=120.
SQL>@ C:/TTP/Q5
Enter value for i_num: 6
FACTORIAL OF 6 IS 720
CHAPTER 5
Short/Objective Type Question
Q6. Write a PL/SQL program which will accept a number from 1 to 20 and display following the the figure.
SQL>@ C:/TTP/Q8
Enter value for i_num: 10
-- *
---- *
------ *
-------- *
---------- *
------------ *
-------------- *
---------------- *
------------------ *
-------------------- *

Q7.
(a)
(b)
(c)
(d)

The basic programming unit of a PL/SQL code is a
Procedure
Subprogram
Module
Block

Q8.
(a)
(b)
(c)
(d)

Which of the following sections of a PL/SQL program are optional?
Declarative Section
Exception Handler Section
Executable Section
All of these
CHAPTER 5
Home Assignment
WORKOUT
DATABASE MANAGEMENT SYSTEM
ORACLE SQL AND PL/SQL
PART II : Application using Oracle PL/SQL
Periods Proposed – 18
Chapter 5
Introduction to PL/SQL Programming

1 Period [Theory]
1 Period [Practical]

Chapter 6
Oracle Function, Procedure And Package

1 Period [Theory]
1 Period [Practical]

Chapter 7
Oracle Exception Handler and Database Triggers

1 Period [Theory]
1 Period [Practical]

Chapter 8
Implicit and Explicit Cursors

1 Period [Theory]
2 Periods [Practical]

Chapter 9
Advance Cursors

1 Period [Theory]
1 Period [Practical]

Chapter 10
PL/SQL Collection

1 Period [Theory]
1 Period [Practical]

Chapter 11
Oracle Objects and Dynamic SQL

1 Period [Theory]
1 Period [Practical]

Chapter 12
Performance Tuning

2 Period [Theory]
1 Period [Practical]
THE BOOK
The book is organized into three parts to introduce the
theoretical and programming concepts of DBMS. Part I
(Basic Concepts and Oracle SQL) deals with DBMS basic,
software analysis and design, data flow diagram, ER model,
relational algebra, normal forms, SQL queries, functions,
sub‐queries, different types of joins, DCL, DDL, DML, object
constraints and security in Oracle. Part II (Application Using
Oracle PL/SQL) explains PL/SQL basics, functions,
procedures, packages, exception handling, triggers, implicit,
explicit and advanced cursors using suitable examples. This
part also covers advanced concepts related to PL/SQL, such
as collection, records, objects, dynamic SQL and
performance tuning. Part III (Advanced Concepts and
Technologies) elaborates on advanced database concepts
such as query processing, file organization, distributed
architecture, backup, recovery, data warehousing, online
analytical processing and data mining concepts and their
techniques.

KEY FEATURES
 Includes about 300 examples to illustrate the concepts.
 Offers about 400 objective type questions.
 Provides about 100 challenging workouts.

TEACHING AID MATERIAL
Teaching Aid Material for all the chapters is provided on the
website of PHI Learning. Visit www.phindia.com/gupta to
explore the contents.
Visit PHI Learning Center www.phindia.com/gupta and Click on Instructor Resources to
access Teaching Aid Material for all the 18 chapters of the book.

More Related Content

PDF
Database management system chapter1
PDF
RDBMS Arch & Models
PPTX
Relational Database Design
PPT
Week 4 The Relational Data Model & The Entity Relationship Data Model
PDF
Introduction to DBMS and SQL Overview
PPT
Relational Database Fundamentals
PPTX
Relational database revised
PPT
Object Oriented Database Management System
Database management system chapter1
RDBMS Arch & Models
Relational Database Design
Week 4 The Relational Data Model & The Entity Relationship Data Model
Introduction to DBMS and SQL Overview
Relational Database Fundamentals
Relational database revised
Object Oriented Database Management System

What's hot (20)

PDF
Rdbms concepts
PPT
Mca ii-dbms- u-ii-the relational database model
PDF
Relational database- Fundamentals
PPTX
What is data model? And types.
PPT
Dbms models
PPT
Dbms relational model
PPT
PDF
Query Processing, Query Optimization and Transaction
PPT
D B M S Animate
PPTX
Chapter 7 relation database language
PDF
Unit 2 rdbms study_material
ODP
PDF
Unit1 rdbms study_materials
PPT
Week 3 Classification of Database Management Systems & Data Modeling
PDF
Comparison of Relational Database and Object Oriented Database
PPT
Database design
PPTX
Deductive Databases Presentation
Rdbms concepts
Mca ii-dbms- u-ii-the relational database model
Relational database- Fundamentals
What is data model? And types.
Dbms models
Dbms relational model
Query Processing, Query Optimization and Transaction
D B M S Animate
Chapter 7 relation database language
Unit 2 rdbms study_material
Unit1 rdbms study_materials
Week 3 Classification of Database Management Systems & Data Modeling
Comparison of Relational Database and Object Oriented Database
Database design
Deductive Databases Presentation
Ad

Viewers also liked (20)

PDF
Oracle Warehouse Management System(Oracle WMS)@ERP OCEAN
PPTX
Vault management system_for_central_banks
PPT
Ypip3 oracle erp
PDF
Using Maven to build Java & Android program
PDF
Presenter manual oracle dba (specially for summer interns)
PDF
Installing java, eclipse and maven
PDF
Java, Eclipse, Maven & JSF tutorial
PDF
Oracle - Introduction
PDF
Database management system chapter13
PDF
KeyLabsTraining - Courses
PPSX
Java9 and the impact on Maven Projects (JFall 2016)
PPT
Basic Concepts of Financial Accounting
PDF
Oracle General Ledger
PPT
Oracle Architecture
ODP
Maven university-course
DOCX
DBMS lab manual
PPT
Introduction to Basic Accounting Concept
PPTX
Oracle Basics and Architecture
PPS
Basic accounting principles
PPT
Oracle EPM BI Overview
Oracle Warehouse Management System(Oracle WMS)@ERP OCEAN
Vault management system_for_central_banks
Ypip3 oracle erp
Using Maven to build Java & Android program
Presenter manual oracle dba (specially for summer interns)
Installing java, eclipse and maven
Java, Eclipse, Maven & JSF tutorial
Oracle - Introduction
Database management system chapter13
KeyLabsTraining - Courses
Java9 and the impact on Maven Projects (JFall 2016)
Basic Concepts of Financial Accounting
Oracle General Ledger
Oracle Architecture
Maven university-course
DBMS lab manual
Introduction to Basic Accounting Concept
Oracle Basics and Architecture
Basic accounting principles
Oracle EPM BI Overview
Ad

Similar to Database management system chapter5 (20)

PDF
PL/SQL Complete Tutorial. All Topics Covered
PDF
PROCEDURAL LANGUAGE/ STRUCTURED QUERY LANGUAGE.pdf
PPTX
PL/SQL is a block structured language that enables developers to combine the ...
PDF
Pl sql-ch1
PDF
Procedural Language/Structured Query Language
PDF
Unit 4 rdbms study_material
PPTX
Ch as pbdasdadssadsadsadasdasdasdas fdt .pptx
PPT
pl_sql.ppt
PDF
rdbms.pdf plsql database system notes for students to study
PDF
RDBMS - UNIT 4.pdf,UNIT THREE AND UNIT FIVE
PDF
Dbms 2011
PDF
chapter 1.pdfbbbbbbbbbbbbbbbbbbbbbbbbbb
PPTX
Pl sql chapter 1
PPTX
Introduction to PL/SQL
PPT
1 - Introduction to PL/SQL
PDF
PDF
DOCX
Oracle Fundamental and PL-SQL.docx
PPT
Ppt on plssql study aboutnsmsmskskwkwkwkwk
PL/SQL Complete Tutorial. All Topics Covered
PROCEDURAL LANGUAGE/ STRUCTURED QUERY LANGUAGE.pdf
PL/SQL is a block structured language that enables developers to combine the ...
Pl sql-ch1
Procedural Language/Structured Query Language
Unit 4 rdbms study_material
Ch as pbdasdadssadsadsadasdasdasdas fdt .pptx
pl_sql.ppt
rdbms.pdf plsql database system notes for students to study
RDBMS - UNIT 4.pdf,UNIT THREE AND UNIT FIVE
Dbms 2011
chapter 1.pdfbbbbbbbbbbbbbbbbbbbbbbbbbb
Pl sql chapter 1
Introduction to PL/SQL
1 - Introduction to PL/SQL
Oracle Fundamental and PL-SQL.docx
Ppt on plssql study aboutnsmsmskskwkwkwkwk

Recently uploaded (20)

PPTX
master seminar digital applications in india
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Insiders guide to clinical Medicine.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Business Ethics Teaching Materials for college
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
master seminar digital applications in india
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Insiders guide to clinical Medicine.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
Microbial disease of the cardiovascular and lymphatic systems
human mycosis Human fungal infections are called human mycosis..pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Final Presentation General Medicine 03-08-2024.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Business Ethics Teaching Materials for college
Anesthesia in Laparoscopic Surgery in India
STATICS OF THE RIGID BODIES Hibbelers.pdf
Institutional Correction lecture only . . .
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Microbial diseases, their pathogenesis and prophylaxis

Database management system chapter5

  • 1. DATABASE MANAGEMENT SYSTEM ORACLE SQL AND PL/SQL PART II : Application Using Oracle PL/SQL Teaching Aid Material (www.phindia.com/gupta) Authors invite your valuable feedback and suggestions on the book pkdasgupta@gmail.com RadhaKrishna_P@infosys.com
  • 2. DATABASE MANAGEMENT SYSTEM ORACLE SQL AND PL/SQL PART II : Application Using Oracle PL/SQL CHAPTER 5 Introduction to PL/SQL Programming
  • 3. CHAPTER 5 Introduction to PL/SQL Programming 1 of 9 Why PL/SQL?  Better Performance  Higher Productivity  Full Portability  Tight Integration with SQL  Security Page reference in the book: 147-152
  • 4. CHAPTER 5 Introduction to PL/SQL Programming 2 of 9 Character Set Type Characters Uppercase, lowercase A-Z , a-z Digits 0-9 Mathematical and punctuation symbols ~ ! @ # % & * ( )_ - + = | [ ] { }: ; ’’ ’ < > ? / White space Space, tab, carriage return Page reference in the book: 147-152
  • 5. CHAPTER 5 Introduction to PL/SQL Programming 3 of 9 PL/SQL Identifiers    Identifiers are used to name PL/SQL objects such as constants, variables, exceptions, procedures, cursors and reserved words. Identifiers can be up to 30 characters in length, must start with a letter and can include dollar sign, an underscore, and a pound sign. Identifiers are case sensitive and cannot include space, tab or carriage return. An identifier can be enclosed within double quotes. Page reference in the book: 147-152
  • 6. CHAPTER 5 Introduction to PL/SQL Programming 4 of 9 PL/SQL Literals  Literals are specific values and are not represented by identifiers  Can be character, number or Boolean value  To embed single quotes within a string literal, two single quotes next to each other may be placed Page reference in the book: 147-152
  • 7. CHAPTER 5 Introduction to PL/SQL Programming 5 of 9 PL/SQL Delimiters  Delimiters are symbols with special meaning to PL/SQL  Used to separate identifiers from each other Delimiter Characteristics -- Single-line comment indicator /* */ Multiline comment delimiter || Concatenation operator .. Range operator ; Statement terminator Page reference in the book: 147-152
  • 8. CHAPTER 5 Introduction to PL/SQL Programming 6 of 9 PL/SQL Variable Type Scalar Purpose Numeric NUMBER(p, s) The maximum precision is 38 digits Character VARCHAR2, CHAR, LONG CHAR and VARCHAR2 are up to 32767 bytes Date Range is between 01-Jan-4712BC and 31-Dec-9999AD Boolean Can hold TRUE, FLASE or NULL only RAW Similar to CHAR variables LONG RAW is similar to LONG LONG RAW can be up to 2 gigabytes Page reference in the book: 147-152
  • 9. CHAPTER 5 Introduction to PL/SQL Programming 7 of 9 PL/SQL Variable Type LOB Purpose BFILE File locaters pointing to read only large objects in operating system files BLOB BLOB locaters that point to large binary objects inside the database CLOB CLOB locaters point to large character objects inside the database NCLOB NCLOB locaters point large national character set objects inside the database Page reference in the book: 147-152
  • 10. CHAPTER 5 Introduction to PL/SQL Programming 8 of 9 NULL    Represents unknown values as NULL values NULL is never equal to anything NVL, IS NULL or IS NOT NULL CONSTANT   Requires an initial value Value cannot be changed Page reference in the book: 147-152
  • 11. CHAPTER 5 Introduction to PL/SQL Programming 9 of 9 Default Value  A variable is assigned a default value of NULL while declaration  Can be initialized by assignment operator (: =) Page reference in the book: 147-152
  • 12. CHAPTER 5 PL/SQL Structure 1 of 3 PL/SQL Structure Declare Variables, Cursors, Constants Begin PL/SQL statements Exception Statements for error handling End; Page reference in the book: 152-159
  • 13. CHAPTER 5 PL/SQL Structure 2 of 3 IF Statement  Allows actions based upon conditions  IF statement can also be nested  Three forms of IF statements: IF … THEN … IF … THEN … ELSE … IF … THEN … ELSIF … ELSE …. Page reference in the book: 152-159
  • 14. CHAPTER 5 PL/SQL Structure 3 of 3 Loops in PL/SQL  Simple Loop Loop PL/SQL statements Exit Condition End Loop  For Loop For variable IN Start..End PL/SQL Statements End Loop;  While Loop While <Condition> Loop PL/SQL Statements End Loop Page reference in the book: 152-159
  • 15. CHAPTER 5 PL/SQL and Oracle 1 of 10 Scope of a Variable in Nested Block PL/SQL statements can be nested SQL Cursor   A cursor is a private SQL work area where all commands defined in the cursor are executed There are two types of cursors:  Implicit cursor  Explicit cursor Page reference in the book: 159-168
  • 16. CHAPTER 5 PL/SQL and Oracle 2 of 10 Implicit Cursor  It is automatically created and handled by Oracle Server  Support all types of DMLs [Insert/Update/Delete]  Supports SELECT statement that returns only Explicit Cursor  Needs to be declared explicitly by the programmer  It is handled using cursor-related commands Page reference in the book: 159-168
  • 17. CHAPTER 5 PL/SQL and Oracle 3 of 10 INTO Clause     Into clause is mandatory in a PL/SQL program It is placed between SELECT and FROM clauses Acts as a container with the associated variable Query must return only one row %TYPE Attribute  Used to declare variables that refer to the column % ROWTYPE Attribute  Represents a row in a table Page reference in the book: 159-168
  • 18. CHAPTER 5 PL/SQL and Oracle 4 of 10 Example EX5_1 Page reference in the book: 159-168
  • 19. CHAPTER 5 PL/SQL and Oracle 5 of 10 EX5_2 Page reference in the book: 159-168
  • 20. CHAPTER 5 PL/SQL and Oracle 6 of 10 EX5_3 Page reference in the book: 159-168
  • 21. CHAPTER 5 PL/SQL and Oracle EX5_5 Page reference in the book: 159-168 7 of 10
  • 22. CHAPTER 5 PL/SQL and Oracle 8 of 10 EX5_10 Page reference in the book: 159-168
  • 23. CHAPTER 5 PL/SQL and Oracle EX5_11 Page reference in the book: 159-168 9 of 10
  • 24. CHAPTER 5 PL/SQL and Oracle 10 of 10 EX5_12 Page reference in the book: 159-168
  • 25. CHAPTER 5 Short/ Objective Type Question Q1. Define identifiers, literals and delimiters in Oracle PL/SQL. Q2. Explain %TYPE and %ROWTYPE attributes with the help of suitable examples. Q3. What do you understand by SQL cursors? Q4. Write a PL/SQL program which will accept three numbers and print the smallest among them. SQL>@ C:/TTP/Q4 Enter value for a: 12 Enter value for b: 34 Enter value for c: 12 Smallest Number is 12 Q5. Write PL/SQL program using Loop … End Loop, For Loop and While Loop, which will accept integer from 1 to 10 and print factorial. For example, factorial of 5 is 5*4*3*2*1=120. SQL>@ C:/TTP/Q5 Enter value for i_num: 6 FACTORIAL OF 6 IS 720
  • 26. CHAPTER 5 Short/Objective Type Question Q6. Write a PL/SQL program which will accept a number from 1 to 20 and display following the the figure. SQL>@ C:/TTP/Q8 Enter value for i_num: 10 -- * ---- * ------ * -------- * ---------- * ------------ * -------------- * ---------------- * ------------------ * -------------------- * Q7. (a) (b) (c) (d) The basic programming unit of a PL/SQL code is a Procedure Subprogram Module Block Q8. (a) (b) (c) (d) Which of the following sections of a PL/SQL program are optional? Declarative Section Exception Handler Section Executable Section All of these
  • 28. DATABASE MANAGEMENT SYSTEM ORACLE SQL AND PL/SQL PART II : Application using Oracle PL/SQL Periods Proposed – 18 Chapter 5 Introduction to PL/SQL Programming 1 Period [Theory] 1 Period [Practical] Chapter 6 Oracle Function, Procedure And Package 1 Period [Theory] 1 Period [Practical] Chapter 7 Oracle Exception Handler and Database Triggers 1 Period [Theory] 1 Period [Practical] Chapter 8 Implicit and Explicit Cursors 1 Period [Theory] 2 Periods [Practical] Chapter 9 Advance Cursors 1 Period [Theory] 1 Period [Practical] Chapter 10 PL/SQL Collection 1 Period [Theory] 1 Period [Practical] Chapter 11 Oracle Objects and Dynamic SQL 1 Period [Theory] 1 Period [Practical] Chapter 12 Performance Tuning 2 Period [Theory] 1 Period [Practical]
  • 29. THE BOOK The book is organized into three parts to introduce the theoretical and programming concepts of DBMS. Part I (Basic Concepts and Oracle SQL) deals with DBMS basic, software analysis and design, data flow diagram, ER model, relational algebra, normal forms, SQL queries, functions, sub‐queries, different types of joins, DCL, DDL, DML, object constraints and security in Oracle. Part II (Application Using Oracle PL/SQL) explains PL/SQL basics, functions, procedures, packages, exception handling, triggers, implicit, explicit and advanced cursors using suitable examples. This part also covers advanced concepts related to PL/SQL, such as collection, records, objects, dynamic SQL and performance tuning. Part III (Advanced Concepts and Technologies) elaborates on advanced database concepts such as query processing, file organization, distributed architecture, backup, recovery, data warehousing, online analytical processing and data mining concepts and their techniques. KEY FEATURES  Includes about 300 examples to illustrate the concepts.  Offers about 400 objective type questions.  Provides about 100 challenging workouts. TEACHING AID MATERIAL Teaching Aid Material for all the chapters is provided on the website of PHI Learning. Visit www.phindia.com/gupta to explore the contents.
  • 30. Visit PHI Learning Center www.phindia.com/gupta and Click on Instructor Resources to access Teaching Aid Material for all the 18 chapters of the book.