Computer Science, asked by sakuntalac410, 4 months ago

What is the use and syntax of IF...THEN statement?




Answers

Answered by Akshita2700
2

When an If ... Then ... Else statement is encountered, condition is tested. If condition is True , the statements following Then are executed. If condition is False , each ElseIf statement (if there are any) is evaluated in order.

Hope it helps u!!...

Answered by Anonymous
13

It is the simplest form of the IF control statement, frequently used in decision-making and changing the control flow of the program execution.

The IF statement associates a condition with a sequence of statements enclosed by the keywords THEN and END IF. If the condition is TRUE, the statements get executed, and if the condition is FALSE or NULL, then the IF statement does nothing.

Syntax

Syntax for IF-THEN statement is −

IF condition THEN

S;

END IF;

Where condition is a Boolean or relational condition and S is a simple or compound statement. Following is an example of the IF-THEN statement −

IF (a <= 20) THEN

c:= c+1;

END IF;

If the Boolean expression condition evaluates to true, then the block of code inside the if statement will be executed. If the Boolean expression evaluates to false, then the first set of code after the end of the if statement (after the closing end if) will be executed.

Flow Diagram

PL/SQL if-then statement

Similar questions