Ticker

6/recent/ticker-posts

IF STATEMENT in Oracle PLSQL

Hello Readers, This is another blog of PLSQL Tutorial, In this Oracle PLSQL Tutorial, We will explain IF Statement in Oracle PLSQL.

IF Statement in Oracle PLSQL

In this post, we will discuss below following topic.

  • What is IF statements in Oracle PLSQL?
  • Type of IF Statements in Oracle PLSQL?
  • IF-THEN Statements in Oracle PLSQL
  • Syntax of  IF-THEN Statements in Oracle PLSQL
  • Example of  IF-THEN Statements in Oracle PLSQL

Discuss IF Statement in Oracle PLSQL

In Oracle PLSQL, IF statement is a control structure statement that allow you to executes or skips a sequence of statements depending on the value of Boolean expression.

Let's understand the meaning of Boolean Expression

An expression that returns the boolean value like true, false or null. Examples are comparisons for equality, greater-than, less-than.

Type of IF Statement in Oracle PLSQL

  • IF-THEN Statement
  • IF-THEN-ELSE Statement
  • IF-THEN-ELSIF

In this Post, we will proceed with IF-THEN Statement.

Let's Understand IF-THEN Statement

The simplest form of IF statements associates a condition with a sequence of statements enclosed by the keywords THEN and END IF;(Not ENDIF).

Syntax of IF-THEN Statement

IF condition THEN
 sequence_of_statements
END IF;

Example of IF-THEN Statement

DECLARE
V_NUMBER NUMBER:=10;

BEGIN

IF V_NUMBER IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('V_NUMBER VARIABLE VALUE IS'||' '||V_NUMBER);
END IF;

END;

Example of IF-THEN Statement in Oracle

That's all for today, I think(IF STATEMENT in Oracle PLSQL) post will be helpful for you. If you like the post then share your view in the comment box.

If you want to watch this topic then click here

Post a Comment

0 Comments