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, 3438🔥, 0💬
Popular Posts:
What Is a Parameter File in Oracle? A parameter file is a file that contains a list of initializatio...
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDAT...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...