O'Reilly logo

Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts by John Adolph Palinski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The IF-THEN-ELSE and ELSIF Structures

To be effective, a code block or procedure needs to have commands that allow the developer to document the logic necessary to determine the behavior. Oracle uses conditional logic statements to form the procedure’s behavior. The logic statements come in two forms:

				IF-THEN-ELSE structures
				ELSIF statements
			

The IF-THEN-ELSE Structure

The most common conditional logic device is the IF-THEN-ELSE structure. This is a very powerful device that allows developers to create the most intricate logic. The structure contains required keywords (IF-THEN-END IF) and one optional (ELSE) keyword. The basic structure is as follows:

					If (conditional expression) then
					Statements;
					Else
					Statements;
					End if;
				

The structure begins ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required