Showing posts with label CONTROL STATEMENTS. Show all posts
Showing posts with label CONTROL STATEMENTS. Show all posts

31. CONTROL STATEMENTS

CONTROL STATEMENTS
Control flow
1.   if statement
2.   case statement

If Statements
1. If condition:
Syntax:-
if condition then
                   Do1; (stmts)
          Else if condition then
                   Do2; (stmts)
          Else do3; (stmts)
End if;
 ------------------------------------------------------------------------------------
2. Nested if:
Syntax:-
If condition then
Do1;
If condition then
          Do3;
Else
Do4;
End if;
Else
Do2;
End if;

Ex:-
  declare
     v number(5) :=&n;
  begin
     if v>1000 then
     dbms_output.put_line('hellow given number is > 1000');
  else
     dbms_output.put_line('number is < 1000');
  end if;
  end;/


Output:-