<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="cs">
	<id>http://postgres.cz/index.php?action=history&amp;feed=atom&amp;title=Condition_statements</id>
	<title>Condition statements - Historie editací</title>
	<link rel="self" type="application/atom+xml" href="http://postgres.cz/index.php?action=history&amp;feed=atom&amp;title=Condition_statements"/>
	<link rel="alternate" type="text/html" href="http://postgres.cz/index.php?title=Condition_statements&amp;action=history"/>
	<updated>2026-05-13T02:18:59Z</updated>
	<subtitle>Historie editací této stránky</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://postgres.cz/index.php?title=Condition_statements&amp;diff=251&amp;oldid=prev</id>
		<title>207.124.141.210: /* CASE Statement */</title>
		<link rel="alternate" type="text/html" href="http://postgres.cz/index.php?title=Condition_statements&amp;diff=251&amp;oldid=prev"/>
		<updated>2008-05-02T21:29:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;CASE Statement&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nová stránka&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== IF Statement ===&lt;br /&gt;
Provide conditional execution based on the truth value of a condition.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Syntax&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF boolean expression THEN&lt;br /&gt;
  sql/psm statements list&lt;br /&gt;
[ELSEIF boolean expression THEN&lt;br /&gt;
  sql/psm statements list [ELSEIF ...]]&lt;br /&gt;
[ELSE&lt;br /&gt;
  sql/psm statements list]&lt;br /&gt;
END IF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CASE Statement ===&lt;br /&gt;
Provide conditional execution based on truth of search conditions or on equality of operands. This statement is similar to SQL CASE statement with differences:&lt;br /&gt;
* after keyword THEN is SQL/PSM statement (not value),&lt;br /&gt;
* CASE statement is finished with pair of keywords - END CASE,&lt;br /&gt;
* if all conditions are false and the CASE statement is missing the ELSE part then exception &amp;#039;20000&amp;#039; is raised.&lt;br /&gt;
&lt;br /&gt;
PL/pgPSM support comma-separated predicates in simple CASE statement.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Syntax&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- simply CASE&lt;br /&gt;
CASE expression&lt;br /&gt;
    WHEN comma separated list of values THEN sql/psm statements list&lt;br /&gt;
    [ WHEN comma separated list of values THEN sql/psm statements list [...]]&lt;br /&gt;
END CASE&lt;br /&gt;
&lt;br /&gt;
-- searching CASE&lt;br /&gt;
CASE&lt;br /&gt;
    WHEN boolean expression THEN sql/psm statements list&lt;br /&gt;
    [ WHEN boolean expression THEN sql/psm statements list [...]]&lt;br /&gt;
END CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>207.124.141.210</name></author>
	</entry>
</feed>