From the course: Oracle Database 19c: PL/SQL
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Programming constructs: IF statement - Oracle Database Tutorial
From the course: Oracle Database 19c: PL/SQL
Programming constructs: IF statement
- [Instructor] Modern procedural languages rely heavily on the IF statement. The IF statement in PL/SQL operates similarly and can use ELSIF and ELSE to provide alternative execution paths. Here is what an IF statement looks like in plain English. In fact, here are three different ways you can use an IF statement in English, and, of course, Oracle PL/SQL supports all three. The first example shows that I have to perform some action if I'm going to the store to buy groceries. The second example is more complicated. I can bring my wallet to pay for groceries, but if that doesn't work, I can charge it to my credit card with my phone. The last example lists multiple alternatives, only one of which will end up true. Once I find a way to pay for groceries, I'm done and I don't have to pay another way. But if I have no way to pay, I'm not leaving the grocery store with any groceries. This is what the PL/SQL code would look like with IF statements for the first example in the pseudo code…
Contents
-
-
-
-
-
-
-
(Locked)
Programming contstructs: FOR loop5m 57s
-
(Locked)
Programming constructs: WHILE loop5m 1s
-
(Locked)
Programming constructs: LOOP4m 12s
-
(Locked)
Programming constructs: IF statement3m 25s
-
(Locked)
Programming constructs: CONTINUE and EXIT3m 31s
-
(Locked)
New features of PL/SQL loop constructs3m 14s
-
(Locked)
-
-
-
-