Updated on 2024-12-06 GMT+08:00

Control Statements

Table 1 Conditional statements

No.

Oracle Database

GaussDB

1

IF THEN

Supported.

2

IF THEN ELSE

Supported.

3

IF THEN ELSIF

Supported.

4

simple CASE:

CASE selector

WHEN selector_value_1 THEN statements_1

WHEN selector_value_2 THEN statements_2

...

WHEN selector_value_n THEN statements_n

[ ELSE

else_statements

END CASE;]

Supported.

5

searched CASE:

CASE

WHEN condition_1 THEN statements_1

WHEN condition_2 THEN statements_2

...

WHEN condition_n THEN statements_n

[ ELSE

else_statements

END CASE;]

Supported.

Table 2 LOOP statements

No.

Oracle Database

GaussDB

1

[ label ] LOOP

statements

END LOOP [ label ];

Supported.

2

EXIT;

Supported.

3

EXIT WHEN;

Supported.

4

CONTINUE;

Supported.

5

CONTINUE WHEN;

Supported.

Table 3 FOR LOOP statements

No.

Oracle Database

GaussDB

Difference

1

[ label ] FOR index IN [ REVERSE ] lower_bound..upper_bound LOOP

statements

END LOOP [ label ];

Supported, with differences.

When the keyword REVERSE is used in GaussDB, the lower bound must be greater than or equal to the upper bound; otherwise, the loop body is not executed.

2

EXIT WHEN;

Supported.

-

3

CONTINUE WHEN;

Supported.

-

Table 4 WHILE LOOP statement

No.

Oracle Database

GaussDB

1

[ label ] WHILE condition LOOP

statements

END LOOP [ label ];

Supported.

Table 5 GOTO statement

No.

Oracle Database

GaussDB

1

GOTO

Supported.

Table 6 NULL statement

No.

Oracle Database

GaussDB

1

NULL

Supported.