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, 3158🔥, 0💬
Popular Posts:
How to format a number of bytes in a human-readable unit using the FORMAT_BYTES() function? FORMAT_B...
How To List All Stored Procedures in the Current Database in SQL Server Transact-SQL? If you want to...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How to print value on console in SQL Server Transact-SQL? How to use the PRINT statements? In Transa...