InterviewSolution
Saved Bookmarks
| 1. |
How To Use "if" Statements On Multiple Conditions? |
|
Answer» 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.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: |
|