zmień kontrast font size: A A A
rss polski
you are at >> pgSQL >>conditional instructions

conditional instructions

At PL/pgSQL there are few conditional instructions.

IF_THEN_ELSE

    IF condition THEN instruction1
    [ELSE instruction2] END IF;

If condition is met there will be executed instruction1. Otherwise there will be executed instruction2 if there is specified ELSE block.

CASE

    CASE WHEN condition THEN expression
       [ WHEN condition2 THEN expression2 ]
       [ ELSE expression ]
       END;

Depending on which condition is met first, that will be returned value of the expression

NULLIF

NULLIF( input, value );

This instruction will return NULL value if input = value

Otherwise there will be returned value value. Depending on which condition is met first that will be returned value of the expression.

[ wróć na górę strony ]