Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How To Use “IF” Statements on Multiple Conditions?

Conditions statements
0
10 Posted

How To Use “IF” Statements on Multiple Conditions?

0

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.

0

If you have multiple blocks of codes to be executed based on different conditions, you can use the “IF … ELSIF” statement.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123