Re: Grammar-problems with pl/pgsql in gram.y - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Grammar-problems with pl/pgsql in gram.y
Date
Msg-id 200105221352.f4MDqJ311439@candle.pha.pa.us
Whole thread Raw
In response to Re: Grammar-problems with pl/pgsql in gram.y  (Klaus Reger <K.Reger@twc.de>)
List pgsql-hackers
Here is the patch I applied.  I cleaned it up a bit.  Thanks a lot.

[ Charset ISO-8859-1 unsupported, converting... ]
> Am Samstag, 19. Mai 2001 00:07 schrieben Sie:
>
> > How about some documentation?
>
> Her is some documentation. Because I don't have the tools and scripts
> installed, to format sgml, I never have written SGML-docs and my english is
> bad, please revisit and correct the additions.
>
> Thank you
>
> Klaus
>
> --
> TWC GmbH
> Schlossbergring 9
> 79098 Freiburg i. Br.
> http://www.twc.de

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
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 ****
      <title>Conditional Control: IF statements</title>

      <para>
!      <function>IF</function> 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 <function>END
!      IF</function> statement. In ELSE-IF statements you need two:
!      one for the first IF and one for the second (ELSE IF).
      </para>

      <variablelist>
--- 880,890 ----
      <title>Conditional Control: IF statements</title>

      <para>
!     <function>IF</function> statements let you execute commands based on
!       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 <function>END IF</function> clause. With ELSE-IF statements,
!       you need two: one for the first IF and one for the second (ELSE IF).
      </para>

      <variablelist>
***************
*** 979,984 ****
--- 978,1018 ----
         </para>
        </listitem>
       </varlistentry>
+
+      <varlistentry>
+       <term>
+        IF-THEN-ELSIF-ELSE
+       </term>
+
+       <listitem>
+        <para>
+         IF-THEN-ELSIF-ELSE allows you test multiple conditions
+         in one statement. Internally it is handled as nested
+         IF-THEN-ELSE-IF-THEN commands. The optional ELSE
+         branch is executed when none of the conditions are met.
+        </para>
+
+        <para>
+         Here is an example:
+        </para>
+
+ <programlisting>
+ 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;
+ </programlisting>
+        </para>
+       </listitem>
+      </varlistentry>
+
+
      </variablelist>
     </sect3>


pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: AW: PL/pgSQL CURSOR support
Next
From: mordicus
Date:
Subject: RE: Re: Functions returning sets