http://postgres.cz/index.php?title=SQL_statements_in_SQL/PSM_samples&feed=atom&action=historySQL statements in SQL/PSM samples - Historie editací2024-03-29T07:56:45ZHistorie editací této stránkyMediaWiki 1.36.0http://postgres.cz/index.php?title=SQL_statements_in_SQL/PSM_samples&diff=218&oldid=prev85.160.108.43 v 3. 12. 2006, 18:292006-12-03T18:29:02Z<p></p>
<p><b>Nová stránka</b></p><div>=== SQL support ===<br />
<pre><br />
CREATE OR REPLACE FUNCTION fx(OUT a int) AS<br />
$$<br />
SELECT INTO a sum(y)<br />
FROM foo;<br />
$$ LANGUAGE plpgpsm;<br />
<br />
CREATE OR REPLACE FUNCTION fx() <br />
RETURNS int AS <br />
$$ <br />
BEGIN<br />
DECLARE i int DEFAULT 0; <br />
WHILE i < 10 <br />
DO <br />
INSERT INTO foo VALUES(i, i+1); <br />
SET i = i + 1; <br />
END WHILE; <br />
RETURN i; <br />
END; <br />
$$ LANGUAGE plpgpsm;<br />
</pre></div>85.160.108.43