PL/SQL Example for IF .. ELSIF

  • 2,342 views
Uploaded on

Design for Class to teach main points of IF .. ELSIF concepts.

Design for Class to teach main points of IF .. ELSIF concepts.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,342
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. PL/SQL Example #1
    • Two types of conditional control in PL/SQL:
      • IF statements
      • ELSIF statements
  • 2. IF Example?
    • Procedure process_task (task_in IN INTEGER)
    • IS
    • BEGIN
    • IF task_in = 1 THEN
    • Task_line1;
    • END IF;
    • IF task_in = 2 THEN
    • Task_line2;
    • END IF;
    • IF task_in = 20 THEN
    • Task_line20;
    • END IF;
    • END;
  • 3. Rewrite!
    • Procedure process_task (task_in IN INTEGER)
    • IS
    • BEGIN
    • IF task_in = 1 THEN
    • Task_line1;
    • ELSIF task_in = 2 THEN
    • Task_line2;
    • ELSIF task_in = 20 THEN
    • Task_line20;
    • END IF;
    • END;
  • 4. ELSIF Statement
    • If one condition is TRUE, no others can be TRUE. ELSIF offers the most efficient implementation for processing mutually exclusive clauses. When one clause evaluates to TRUE, all subsequent classes are ignored.
  • 5. Good Points!
    • Use ELSIF with mutually exclusive clauses
    • Use IF…ELSIF only to test a single, simple condition.
    • Replace and simplify IF statements with Boolean expressions.
  • 6. Q&A
    • Use IF wisely?
    • Next Week Case.
    • Thank You!