Collections:
Use "IF" Statements with Multiple Conditions in Oracle
How To Use "IF" Statements on Multiple Conditions in Oracle?
✍: FYIcenter.com
If you have multiple blocks of codes to be executed based on different conditions, you can use the "IF ... ELSIF" statement. Here is a sample script on IF statements:
DECLARE
day VARCHAR2;
BEGIN
day := 'SUNDAY';
IF day = 'THURSDAY' THEN
DBMS_OUTPUT.PUT_LINE('Checking log files.');
ELSIF day = 'TUESDAY' THEN
DBMS_OUTPUT.PUT_LINE('Helping developers.');
ELSIF day = 'FRIDAY' THEN
DBMS_OUTPUT.PUT_LINE('Rebuild indexes.');
ELSE
DBMS_OUTPUT.PUT_LINE('Reading some papers.');
END IF;
END;
This script should print this:
Reading some papers.
⇒ Use "WHILE" Loop Statements in Oracle
⇐ Types of Execution Flow Control Statements in Oracle
2018-07-13, 2856🔥, 0💬
Popular Posts:
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
How To Enter Unicode Character String Literals in SQL Server Transact-SQL? Unicode characters are mu...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
What are DDL (Data Definition Language) statements for tables in SQL Server? DDL (Data Definition La...
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...