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, 2568🔥, 0💬
Popular Posts:
How To Download Oracle Database 10g XE in Oracle? If you want to download a copy of Oracle Database ...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
What Is an Oracle Instance in Oracle? Every running Oracle database is associated with an Oracle ins...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...