CASE when_clause [...] [ ELSE statement [...] ] END CASE ;
- when_clause
WHEN conditional_expression THEN statement [...]
- statement
{ SQL_statement | compound_statement | assignment_statement | condition_statement | [ label_name : ] iteration_statement [ label_name ] | ITERATE label_name | LEAVE label_name }- compound_statement
[ label_name : ] BEGIN [ local_declaration ] [...] [ cursor_declaration ] [...] [ condition_handler ] [...] [ statement; ] [...] END [ label_name ] ;
- assignment_statement
SET assignment_target = assignment_source
- condition_statement
{ CASE_statement | IF_statement }- iteration_statement
{ WHILE conditional_expression DO statement; [...] | LOOP statement; [...] END LOOP | FOR for_loop_variable AS [ cursor_name CURSOR FOR ] cursor_specification DO statement; [...] END FOR | REPEAT statement; [...] UNTIL conditional_expression END REPEAT }- local_declaration
DECLARE { variable_name [,...] data_type [ DEFAULT { literal | NULL } ] | condition_name CONDITION [ FOR SQLSTATE [VALUE] sqlstate_cod ] } ;- cursor_declaration
DECLARE cursor_name [ [NO] SCROLL ] CURSOR [ WITHOUT RETURN | WITH RETURN [ONLY] [ TO { CALLER | CLIENT } ] ] [ FOR { cursor_specification [ FOR { READ ONLY | UPDATE } ] | statement_name } ] ;
- IF_statement
- <IF>を参照してください。
- CASE_statement
- CASE文のいずれかの形式。
- condition_handler
DECLARE { CONTINUE | EXIT } HANDLER FOR { { SQLSTATE [ VALUE ] sqlstate_code | condition_name } [,...] | { SQLEXCEPTION | SQLWARNING | NOT FOUND } [,...] } handler_action_statement ;- cursor_specification
SELECT cursor_spec [,...] FROM { table_name [,...] | table_name { INNER | { LEFT | RIGHT | FULL } OUTER } JOIN table_name ON condition }
- cursor_spec
{ column_name [ [AS] alias_name ] | expression [AS] alias_name | * }