After completing this lesson, you should be able to do the following:
Identify the uses and types of control structures
Construct an IF statement
Construct and identify different loop statements
Use logic tables
Control block flow using nested loops and labels
After completing this lesson, you should be able to do the following:
Distinguish between an implicit and an explicit cursor
Use a PL/SQL record variable
Write a cursor FOR loop
After completing this lesson, you should be able to do the following:
Write a multiple-column subquery
Describe and explain the behavior of subqueries when null values are retrieved
Write a subquery in a FROM clause
After completing this lesson, you should be able to do the following:
Write a successful SELECT statement in PL/SQL
Declare the datatype and size of a PL/SQL variable dynamically
Write DML statements in PL/SQL
Control transactions in PL/SQL
Determine the outcome of SQL DML statements
After completing this lesson, you should be able to do the following:
Define PL/SQL exceptions
Recognize unhandled exceptions
List and use different types of PL/SQL exception handlers
Trap unanticipated errors
Describe the effect of exception propagation in nested blocks
Customize PL/SQL exception messages
After completing this lesson, you should be able to do the following:
Recognize the significance of the executable section
Write statements in the executable section
Describe the rules of nested blocks
Execute and test a PL/SQL block
Use coding conventions
Les08[1] Producing Readable Output with SQL*Plussiavosh kaviani
After completing this lesson, you should be able to do the following:
Produce queries that require an input variable
Customize the SQL*Plus environment
Produce more readable output
Create and execute script files
Save customizations
After completing this lesson, you should be able to do the following:
List the benefits of PL/SQL
Recognize the basic PL/SQL block and its sections
Describe the significance of variables in PL/SQL
Declare PL/SQL variables
Execute a PL/SQL block
After completing this lesson, you should be able to do the following:
Write a cursor that uses parameters
Determine when a FOR UPDATE clause in a cursor is required
Determine when to use the WHERE CURRENT OF clause
Write a cursor that uses a subquery
After completing this lesson, you should be able to do the following:
Distinguish between an implicit and an explicit cursor
Use a PL/SQL record variable
Write a cursor FOR loop
After completing this lesson, you should be able to do the following:
Write a multiple-column subquery
Describe and explain the behavior of subqueries when null values are retrieved
Write a subquery in a FROM clause
After completing this lesson, you should be able to do the following:
Write a successful SELECT statement in PL/SQL
Declare the datatype and size of a PL/SQL variable dynamically
Write DML statements in PL/SQL
Control transactions in PL/SQL
Determine the outcome of SQL DML statements
After completing this lesson, you should be able to do the following:
Define PL/SQL exceptions
Recognize unhandled exceptions
List and use different types of PL/SQL exception handlers
Trap unanticipated errors
Describe the effect of exception propagation in nested blocks
Customize PL/SQL exception messages
After completing this lesson, you should be able to do the following:
Recognize the significance of the executable section
Write statements in the executable section
Describe the rules of nested blocks
Execute and test a PL/SQL block
Use coding conventions
Les08[1] Producing Readable Output with SQL*Plussiavosh kaviani
After completing this lesson, you should be able to do the following:
Produce queries that require an input variable
Customize the SQL*Plus environment
Produce more readable output
Create and execute script files
Save customizations
After completing this lesson, you should be able to do the following:
List the benefits of PL/SQL
Recognize the basic PL/SQL block and its sections
Describe the significance of variables in PL/SQL
Declare PL/SQL variables
Execute a PL/SQL block
After completing this lesson, you should be able to do the following:
Write a cursor that uses parameters
Determine when a FOR UPDATE clause in a cursor is required
Determine when to use the WHERE CURRENT OF clause
Write a cursor that uses a subquery
After completing this lesson, you should be able to do the following:
Create user-defined PL/SQL records
Create a record with the %ROWTYPE attribute
Create a PL/SQL table
Create a PL/SQL table of records
Describe the difference between records, tables, and tables of records
After completing this lesson, you should be able to do the following:
List the capabilities of SQL SELECT statements
Execute a basic SELECT statement
Differentiate between SQL statements and SQL*Plus commands
After completing this lesson, you should be able to do the following:
Describe various types of functions available in SQL
Use character, number, and date functions in SELECT statements
Describe the use of conversion functions
After completing this lesson, you should be able to do the following:
Describe some database objects and their uses
Create, maintain, and use sequences
Create and maintain indexes
Create private and public synonyms
After completing this lesson, you should be able to do the following:
Describe the types of problems that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
After completing this lesson, you should be able to do the following:
Describe each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Control transactions
After completing this lesson, you should be able to do the following:
Describe the main database objects
Create tables
Describe the datatypes that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
Les05[1]Aggregating Data Using Group Functionssiavosh kaviani
After completing this lesson, you should be able to do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
After completing this lesson, you should be able to do the following:
Describe a view
Create a view
Retrieve data through a view
Alter the definition of a view
Insert, update, and delete data through a view
Drop a view
Database Management System,PL-SQL DIFFERENT PROGRAMS. Simple basic programs that can give you idea about implement that in SQL.how to use if statement,different types of loops and etc in PL/SQL.
After completing this lesson, you should be able to do the following:
Create user-defined PL/SQL records
Create a record with the %ROWTYPE attribute
Create a PL/SQL table
Create a PL/SQL table of records
Describe the difference between records, tables, and tables of records
After completing this lesson, you should be able to do the following:
List the capabilities of SQL SELECT statements
Execute a basic SELECT statement
Differentiate between SQL statements and SQL*Plus commands
After completing this lesson, you should be able to do the following:
Describe various types of functions available in SQL
Use character, number, and date functions in SELECT statements
Describe the use of conversion functions
After completing this lesson, you should be able to do the following:
Describe some database objects and their uses
Create, maintain, and use sequences
Create and maintain indexes
Create private and public synonyms
After completing this lesson, you should be able to do the following:
Describe the types of problems that subqueries can solve
Define subqueries
List the types of subqueries
Write single-row and multiple-row subqueries
After completing this lesson, you should be able to do the following:
Describe each DML statement
Insert rows into a table
Update rows in a table
Delete rows from a table
Control transactions
After completing this lesson, you should be able to do the following:
Describe the main database objects
Create tables
Describe the datatypes that can be used when specifying column definition
Alter table definitions
Drop, rename, and truncate tables
Les05[1]Aggregating Data Using Group Functionssiavosh kaviani
After completing this lesson, you should be able to do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
After completing this lesson, you should be able to do the following:
Describe a view
Create a view
Retrieve data through a view
Alter the definition of a view
Insert, update, and delete data through a view
Drop a view
Database Management System,PL-SQL DIFFERENT PROGRAMS. Simple basic programs that can give you idea about implement that in SQL.how to use if statement,different types of loops and etc in PL/SQL.
Want to learn Kotlin Quickly? Get started with this Kotlin for Beginners Guide - Visual Content to get you up to speed in no time. Please share if you like it.
Visual Basic loop structures allow you to run one or more lines of code repetitively. You can repeat the statements in a loop structure until a condition is True, until a condition is False, a specified number of times, or once for each element in a collection.
This is chapter 2 on PL/SQL programming introducing PL/SQL language program structure including conditional controls like IF/CASE statements, sequential controls statements like GOTO, iterative processing like different loops in PLSQL like while, numeric FOR and CURSOR FOR loops and concepts of exception handling in detail.This chapter also covers Practitioners Guide contains examples on the PL/SQL concepts explained in the slides.Practitioners guide contains example based on application named SCHOOL MANAGEMENT SYSTEM(SMS) that is being developed by team VISTA.Most PLSQL program are codes describing back-end structure of 'SMS'. This is helpful in easy development of skills in PLSQL programming.
sara-shortCV SARA GHIASI TABRIZI Computer Science PhD Applicationsiavosh kaviani
The objective of my role as a junior researcher in the field of computer science is to engage in rigorous research activities under the guidance of seasoned academics, with the aim of advancing knowledge and
understanding within the discipline. This involves actively participating in research projects, contributing to scholarly publications, and gaining valuable experience in research methodologies and techniques. Ultimately, the goal is to develop a solid foundation in research skills,
deepen comprehension of computer science concepts, and potentially pave the way for future contributions to the academic community.
The Lean Canvas is a strategic management template that helps entrepreneurs to create and validate a business model. It provides a concise way to document and communicate a business idea, focusing on problems, solutions, key metrics, and competitive advantages.
Attaque chimique contre les écolières en Iran version 2.pptxsiavosh kaviani
This presentation is about the chemical attacks to school girls, Iran from September 2022 up to now. I produced this lecture on three language of French, English, and Persian.
SUMMARY
Emotionally intelligent and computer-savvy Administrative Assistant with an Associate’s degree in Business Administration. Strong interpersonal skills and a lifelong focus on supporting others and helping them shine.
German literature graduate with proven communication in English & French, office planning, and email management skills and Microsoft tools. Seeking a position as an administrative assistant, to leverage organizational and research skills to support internal and external communication.
Experienced software developer and business model designer with efficient experience on windows, web-based, mobile applications and a deep knowledge on database design and techniques. I have decent analytical and problem solving skills and I am inclined to work with a team on challenging problems. I always welcome challenges to raise my experience. Designing optimized and efficient solutions for real world problems is my expertise.
Solution-oriented IT software manager With over 30 years of advanced experience in developing, implementing, and supporting sophisticated infrastructure and technical solutions, a lot of industry leaders are highly regarded. Superior expertise with development methodologies, developer supervision, and customer relations. Motivational and effective project manager, providing effective leadership in fast and deadline environments. As you progress through the IT solutions, pursue a history beyond your goals and expectations for quality, timing, and cost. An outside-frame thinker who thrives in collaborative environments, working in business and technical teams to increase profits and reduce costs through continuous improvement and strategic planning of IT infrastructure.
AS my position in CTO position often overlaps with other jobs, in particular, that of the chief information officer (CIO) or chief science officer. Depending on the company's size and focus, it may have some or all of these positions. In some environments, the CTO might oversee infrastructure or act as a strategic planner or customer relations liaison. The position attributes of a CTO vary by organization. As a rule, the CTO reports to the chief executive officer. I have encountered these problems in many of my projects that have been hired by different organizations for similar jobs, and I have gained the ability to deal with those difficulties.
As a senior marketing manager, I do my duties as a mid-to senior-level executive who leads the marketing efforts of an organization. I am responsible for developing and executing marketing strategies that help the company grow and succeed. This might include working with product development teams to ensure that new products or services are ready when they’re needed, coordinating with customer service to make sure customers have a positive experience interacting with the company brand, etc.
Senior Marketing Manager with 20+ years of experience in new era solutions, and Digital marketing environments. Proven record in managing products and service launches that increase brand awareness and sales. Personally recruited and trained 100+ marketing and sales specialists, improving overall sales targets by 24%, and directed the launch of 100 new product lines with huge annual revenue.
SIAVOSH KAVIANI
CE / CS MASTER PROFESSOR
Objective:
Highly motivated and dedicated individual with a doctorate in software Engineering and excellent teaching and research skills and knowledge of educational technologies looking for the position of a professor in Software Engineering courses. A highly enthusiastic online professor with over 25 years of experience teaching Software Eng. Courses Software Eng. (I,II,Advance)/ Advance Software Discourse/Decision support system/IT Strategic management /Database(I,Advance)in digital education technologies with outstanding communication and teaching skills.
A B O U T M E:
Exceptionally seasoned and dedicated Engineering Professor with a strong record in both teaching and administration. Adept at explaining highly complex engineering theories and practices in a clear and accessible manner to a variety of professional and non-professional audiences. Committed to offering interested students my full attention and expertise to help further their academic and professional goals.
Siavosh Kaviani cv francais 2022 version 2.pdfsiavosh kaviani
PROFIL
Un leader innovant et influent avec une expérience éprouvée de succès dans le développement de logiciels créatifs et stratégiques, la gestion de projets et de programmes.
Un communicateur exceptionnel qui se spécialise dans les présentations aux clients, les réunions techniques et l'interaction avec les investisseurs, le personnel et les clients.
Professeur d'université, j'offre dans le développement et la mise en œuvre d'outils, d'applications et de services technologiques dans l'industrie de la haute technologie.
CONTACT
TELEPHONE
06-48-91-52-82
SITE WEB
https://avengering.com/prof-siavosh-kaviani-2/
LINKEDIN
https://ksra.eu
EMAIL:
siavosh@avengering.com
PUBLICATION
Les articles Scientifiques
SEO- REFERENCEMENT
Sujets du site Web
Sujets généraux
Vidéo
PDF & PowerPoint
Siavosh Kaviani
Un leader innovant et influent avec une expérience éprouvée de succès dans le développement de logiciels créatifs et stratégiques, la gestion de projets et de programmes.
Un communicateur exceptionnel qui se spécialise dans les présentations aux clients, les réunions techniques et l'interaction avec les investisseurs, le personnel et les clients.
Le professeur d'université offre une mine de talents dans le développement et la mise en œuvre d'outils, d'applications et de services technologiques dans l'industrie de la haute technologie.
One of the biggest problems for newcomers to Oracle Apex is the lack of a system for assigning roles and accessing application items.
Also, with a little searching in discussion forums, you can see the problems of users in this area.
At Apex, we can create a pre-opportunity system for managing access users. As in asp.net applications, for example, the identity system is provided that the user can personalize it.
To do this, we started designing a comprehensive authentication and access management system that includes the following 6 database entities:
Users: The list of system users includes the following columns
Id, UserName, FirstName, LastName, UserIsEnable
Roles: The list of system roles includes the following columns
ID, Title
, RoleClaims: RoleClaims single-role access table of program items including the following columns
Id, RoleID (FK), COMPONENTID, CanAccess
, UserRoles: The role chart assigned to each user includes the following columns
ID, UserId (fk), RoleId (fk)
UserLogins: User login history includes the following columns
Id, UserId, LogindateTime, Ip, Browser
UserUsedPassword .: Passwords used by the user include the following columns
Id, UserId (FK), Password, CreateDateTime
To describe the function of the designed system, we can provide details with you through text or video or a demo program.
Thanks
After completing this lesson, you should be able to do the following:
Create users
Create roles to ease setup and maintenance of the security model
Use the GRANT and REVOKE statements to grant and revoke object privileges
Creating tables and sequences
Modifying data in the tables
Modifying a table definition
Creating a view
Writing scripts containing SQL and SQL*Plus commands
Generating a simple report
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Home assignment II on Spectroscopy 2024 Answers.pdf
Les19[1]Writing Control Structures
1. Copyright س Oracle Corporation, 1999. All rights reserved.
19
Writing Control Structures
2. 19-2 Copyright س Oracle Corporation, 1999. All rights reserved.
Objectives
After completing this lesson, you should
be able to do the following:
• Identify the uses and types of control
structures
• Construct an IF statement
• Construct and identify different loop
statements
• Use logic tables
• Control block flow using nested loops
and labels
3. 19-3 Copyright س Oracle Corporation, 1999. All rights reserved.
Controlling PL/SQL Flow
of Execution
You can change the logical flow of
statements using conditional IF
statements and loop control structures.
Conditional IF statements:
• IF-THEN-END IF
• IF-THEN-ELSE-END IF
• IF-THEN-ELSIF-END IF
4. 19-4 Copyright س Oracle Corporation, 1999. All rights reserved.
IF Statements
IF condition THEN
statements;
[ELSIF condition THEN
statements;]
[ELSE
statements;]
END IF;
Syntax
Simple IF statement:
Set the manager ID to 22 if the employee
name is Osborne.
IF v_ename = 'OSBORNE' THEN
v_mgr := 22;
END IF;
5. 19-5 Copyright س Oracle Corporation, 1999. All rights reserved.
Simple IF Statements
Set the job title to Salesman, the department
number to 35, and the commission to 20%
of the current salary if the last name is
Miller.
Example
. . .
IF v_ename = 'MILLER' THEN
v_job := 'SALESMAN';
v_deptno := 35;
v_new_comm := sal * 0.20;
END IF;
. . .
6. 19-6 Copyright س Oracle Corporation, 1999. All rights reserved.
IF-THEN-ELSE Statement
Execution Flow
IF condition
TRUE
THEN actions
(including further IFs)
FALSE
ELSE actions
(including further IFs)
7. 19-7 Copyright س Oracle Corporation, 1999. All rights reserved.
IF-THEN-ELSE Statements
Set a flag for orders where there are fewer
than five days between order date and
ship date.
Example
...
IF v_shipdate - v_orderdate < 5 THEN
v_ship_flag := 'Acceptable';
ELSE
v_ship_flag := 'Unacceptable';
END IF;
...
8. 19-8 Copyright س Oracle Corporation, 1999. All rights reserved.
IF-THEN-ELSIF
Statement Execution Flow
IF condition
TRUE
THEN actions
FALSE
ELSIF
condition
TRUE
THEN actions
FALSE
ELSE
actions
9. 19-9 Copyright س Oracle Corporation, 1999. All rights reserved.
IF-THEN-ELSIF Statements
For a given value, calculate a percentage
of that value based on a condition.
Example
. . .
IF v_start > 100 THEN
v_start := 2 * v_start;
ELSIF v_start >= 50 THEN
v_start := .5 * v_start;
ELSE
v_start := .1 * v_start;
END IF;
. . .
10. 19-10 Copyright س Oracle Corporation, 1999. All rights reserved.
Building Logical Conditions
• You can handle null values with the IS
NULL operator.
• Any arithmetic expression containing a
null value evaluates to NULL.
• Concatenated expressions with null
values treat null values as an empty
string.
11. 19-11 Copyright س Oracle Corporation, 1999. All rights reserved.
Logic Tables
Build a simple Boolean condition with a
comparison operator.
NOT
TRUE
FALSE
NULL
OR
TRUE
FALSE
NULL
TRUE FALSE NULL
FALSE
TRUE
NULL
AND
TRUE
FALSE
NULL
TRUE FALSE NULL
TRUE
NULL NULL
NULL
FALSE FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
NULL NULL
NULL
12. 19-12 Copyright س Oracle Corporation, 1999. All rights reserved.
Boolean Conditions
What is the value of V_FLAG in each case?
V_REORDER_FLAG V_AVAILABLE_FLAG V_FLAG
TRUE TRUE
TRUE FALSE
NULL TRUE
NULL FALSE
v_flag := v_reorder_flag AND v_available_flag;
TRUE
FALSE
NULL
FALSE
13. 19-13 Copyright س Oracle Corporation, 1999. All rights reserved.
Iterative Control: LOOP
Statements
• Loops repeat a statement or sequence
of statements multiple times.
• There are three loop types:
– Basic loop
– FOR loop
– WHILE loop
14. 19-14 Copyright س Oracle Corporation, 1999. All rights reserved.
Basic Loop
Syntax
LOOP
statement1;
. . .
EXIT [WHEN condition];
END LOOP;
where: condition is a Boolean variable or
expression (TRUE, FALSE,
or NULL);
-- delimiter
-- statements
-- EXIT statement
-- delimiter
15. 19-15 Copyright س Oracle Corporation, 1999. All rights reserved.
Basic Loop
DECLARE
v_ordid item.ordid%TYPE := 601;
v_counter NUMBER(2) := 1;
BEGIN
LOOP
INSERT INTO item(ordid, itemid)
VALUES(v_ordid, v_counter);
v_counter := v_counter + 1;
EXIT WHEN v_counter > 10;
END LOOP;
END;
Example
16. 19-16 Copyright س Oracle Corporation, 1999. All rights reserved.
FOR Loop
Syntax
• Use a FOR loop to shortcut the test for
the number of iterations.
• Do not declare the counter; it is
declared implicitly.
FOR counter in [REVERSE]
lower_bound..upper_bound LOOP
statement1;
statement2;
. . .
END LOOP;
17. 19-17 Copyright س Oracle Corporation, 1999. All rights reserved.
FOR Loop
Guidelines
• Reference the counter within the loop
only; it is undefined outside the loop.
• Use an expression to reference the
existing value of a counter.
• Do not reference the counter as the target
of an assignment.
18. 19-18 Copyright س Oracle Corporation, 1999. All rights reserved.
FOR Loop
Insert the first 10 new line items for order
number 601.
Example
DECLARE
v_ordid item.ordid%TYPE := 601;
BEGIN
FOR i IN 1..10 LOOP
INSERT INTO item(ordid, itemid)
VALUES(v_ordid, i);
END LOOP;
END;
19. 19-19 Copyright س Oracle Corporation, 1999. All rights reserved.
WHILE Loop
Syntax
Use the WHILE loop to repeat statements
while a condition is TRUE.
WHILE condition LOOP
statement1;
statement2;
. . .
END LOOP;
Condition is
evaluated at the
beginning of
each iteration.
20. 19-20 Copyright س Oracle Corporation, 1999. All rights reserved.
WHILE Loop
Example
ACCEPT p_new_order PROMPT 'Enter the order number: '
ACCEPT p_items -
PROMPT 'Enter the number of items in this order: '
DECLARE
v_count NUMBER(2) := 1;
BEGIN
WHILE v_count <= &p_items LOOP
INSERT INTO item (ordid, itemid)
VALUES (&p_new_order, v_count);
v_count := v_count + 1;
END LOOP;
COMMIT;
END;
/
21. 19-21 Copyright س Oracle Corporation, 1999. All rights reserved.
Nested Loops and Labels
• Nest loops to multiple levels.
• Use labels to distinguish between
blocks and loops.
• Exit the outer loop with the EXIT
statement referencing the label.
22. 19-22 Copyright س Oracle Corporation, 1999. All rights reserved.
Nested Loops and Labels
...
BEGIN
<<Outer_loop>>
LOOP
v_counter := v_counter+1;
EXIT WHEN v_counter>10;
<<Inner_loop>>
LOOP
...
EXIT Outer_loop WHEN total_done = 'YES';
-- Leave both loops
EXIT WHEN inner_done = 'YES';
-- Leave inner loop only
...
END LOOP Inner_loop;
...
END LOOP Outer_loop;
END;
23. 19-23 Copyright س Oracle Corporation, 1999. All rights reserved.
Change the logical flow of statements by
using control structures.
• Conditional (IF statement)
• Loops:
– Basic loop
– FOR loop
– WHILE loop
– EXIT statement
Summary
24. 19-24 Copyright س Oracle Corporation, 1999. All rights reserved.
Practice Overview
• Performing conditional actions using
the IF statement
• Performing iterative steps using the
loop structure