Index: plsql.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/plsql.sgml,v
retrieving revision 2.32
diff -w -b -i -B -c -r2.32 plsql.sgml
*** plsql.sgml 2001/05/17 21:50:16 2.32
--- plsql.sgml 2001/05/22 12:38:49
***************
*** 880,891 ****
Conditional Control: IF statements
! IF statements let you take action
! according to certain conditions. PL/pgSQL has three forms of
! IF: IF-THEN, IF-THEN-ELSE, IF-THEN-ELSE IF. NOTE: All
! PL/pgSQL IF statements need a corresponding END
! IF statement. In ELSE-IF statements you need two:
! one for the first IF and one for the second (ELSE IF).
--- 880,890 ----
Conditional Control: IF statements
! IF statements let you take action according to
! certain conditions. PL/pgSQL has four forms of IF: IF-THEN, IF-THEN-ELSE,
! IF-THEN-ELSE IF, IF-THEN-ELSIF-THEN-ELSE. NOTE: All PL/pgSQL IF statements need
! a corresponding END IF statement. In ELSE-IF statements
! you need two: one for the first IF and one for the second (ELSE IF).
***************
*** 979,984 ****
--- 978,1018 ----
+
+
+
+ IF-THEN-ELSIF-ELSE
+
+
+
+
+ IF-THEN-ELSIF-ELSE allows you, to add multiple decisions
+ in one statement. Internally it is handled as nested
+ IF-THEN-ELSE-IF-THEN commands. The (optionally) ELSE
+ branch is called, when none of all conditions is met.
+
+
+
+ Here is an example:
+
+
+
+ IF number = 0 THEN
+ result := ''zero'';
+ ELSIF number < 0 THEN
+ result := ''negative'';
+ ELSIF number > 0 THEN
+ result := ''negative'';
+ ELSE
+ -- now it seems to be NULL
+ result := ''NULL'';
+ END IF;
+
+
+
+
+
+