<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Zwracany wynik z procedury]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=431&amp;type=atom"/>
	<updated>2010-04-21T10:20:49Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=431</id>
		<entry>
			<title type="html"><![CDATA[Odp: Zwracany wynik z procedury]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=1984#p1984"/>
			<content type="html"><![CDATA[na szybko 
[code]
CREATE OR REPLACE FUNCTION add_activity(idik integer)
  RETURNS integer AS
$BODY$declare 
numrows int;
begin
insert into t1 select * from t2 where id between $1 and $1+2;
GET DIAGNOSTICS numrows = ROW_COUNT;
return numrows;
end;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
[/code]]]></content>
			<author>
				<name><![CDATA[psocha]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=519</uri>
			</author>
			<updated>2010-04-21T10:20:49Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=1984#p1984</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Zwracany wynik z procedury]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=1975#p1975"/>
			<content type="html"><![CDATA[A nie prościej napisać funkcję w plpgsql?]]></content>
			<author>
				<name><![CDATA[rski]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=26</uri>
			</author>
			<updated>2010-04-19T16:46:35Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=1975#p1975</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Zwracany wynik z procedury]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=1974#p1974"/>
			<content type="html"><![CDATA[Jak zrobić aby zwrócić z procedury ilość wstawionych/aktualizowanych wierszy?


CREATE OR REPLACE FUNCTION add_activity(date = CURRENT_DATE) 
RETURNS integer AS $$
	DELETE FROM activity as a WHERE a.date = $1;

	INSERT INTO activity 
	SELECT v.vid, v.uid, v.aid, v.pop, p.pop_total, $1 as insertDate
	FROM players as p, villages as v
	WHERE v.uid = p.uid
	RETURNING 1;

$$ LANGUAGE SQL;


zamiast zwracanej wartości 1 chciałbym aby była ilość wstawianych wierszy.]]></content>
			<author>
				<name><![CDATA[akoliber]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1096</uri>
			</author>
			<updated>2010-04-19T15:04:06Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=1974#p1974</id>
		</entry>
</feed>
