How To Use “IF” Statements on Multiple Conditions?
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:DECLAREday VARCHAR2;BEGINday := ‘SUNDAY’;IF day = ‘THURSDAY’ THENDBMS_OUTPUT.PUT_LINE(’Checking log files.’);ELSIF day = ‘TUESDAY’ THENDBMS_OUTPUT.PUT_LINE(’Helping developers.’);ELSIF day = ‘FRIDAY’ THENDBMS_OUTPUT.PUT_LINE(’Rebuild indexes.’);ELSEDBMS_OUTPUT.PUT_LINE(’Reading some papers.’);END IF;END;This script should print this:Reading some papers.