joshuadburns@hotmail.com writes:
> Every example within the PLPGSQL "control structures" documentation states
> that the proper syntax for closing a "CASE" statement is to use "END CASE;"
Which it is.
> =====================================
> Example CASE statement with END CASE;
> -------------------------------------
> DO LANGUAGE "plpgsql" $BODY$
> DECLARE my_var INTEGER := 2; BEGIN
> RAISE NOTICE
> '%',
> CASE
> WHEN my_var = 1 THEN 'one'
> WHEN my_var = 2 THEN 'two'
> WHEN my_var = 3 THEN 'three'
> END CASE;
> END $BODY$;
This is not a case statement, it's a case expression (used within a RAISE
statement). That's documented under the main SQL grammar, and there
you just say END. Yeah, I know it's not terribly consistent.
regards, tom lane