© Ben Brumm 2019
Ben BrummBeginning Oracle SQL for Oracle Database 18chttps://doi.org/10.1007/978-1-4842-4430-2_23

23. Writing Conditional Logic

Ben Brumm1 
(1)
Melbourne, VIC, Australia
 

Many programming languages include the ability to perform conditional logic, or “if this is true, then do something, otherwise do something else.” SQL is different to other programming languages and doesn’t include a lot of features such as variables and loops. However, SQL does have the ability to use conditional logic.

This is often called an IF statement in other languages, which looks like this:
if (some condition) {
  do_something;
else {
  do_something_else;
}

In SQL, you can do the same kind of thing, but it’s done a little differently. You can use a type of statement ...

Get Beginning Oracle SQL for Oracle Database 18c: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.