Ticker

6/recent/ticker-posts

PL/SQL Control Statements: Sequential Control Statements in PL/SQL

 
PL/SQL Sequential Control Statements

Sequential Control Statements 

By default, all PL/SQL block_s are executed in a top-down sequential process. The process begins with the BEGIN statement and terminates with the END statement. The developer can deviate from this default control structure by introducing one of the control structures discussed. 

For example, the insertion is performed only if the second component is 1r If not, first add 10 to each component and then insert:

DECLARE

a NUMBER;

b NUMBER;

BEGIN

SELECT e, f INTO a, b FROM Tl WHERE e> 1

IF b=1 THEN

INSERT INTO T 1 VALUES(b, a);

ELSE

INSERT INT0 Ti VALUES(b+10,a+ 10);

END IF;

END;