<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Forum PostgreSQL - Jak uruchomić procedurę?]]></title>
		<link>https://forum.postgresql.org.pl/viewtopic.php?id=170</link>
		<description><![CDATA[Najświeższe odpowiedzi w Jak uruchomić procedurę?.]]></description>
		<lastBuildDate>Thu, 02 Apr 2009 14:59:25 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=684#p684</link>
			<description><![CDATA[Dziękuje wykonało się bez problemu. :)]]></description>
			<author><![CDATA[dummy@example.com (woziu)]]></author>
			<pubDate>Thu, 02 Apr 2009 14:59:25 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=684#p684</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=682#p682</link>
			<description><![CDATA[Aha i byl jeszcze kiedyś dodatek to postgresa 'ora coś tam' się nazywał. Który dodawał funkcje z oracla (m.in. chyba była tam funkcja do ładnego wypisywania komunikatów). Jak sobie przypomnę nazwę to podrzucę na forum.]]></description>
			<author><![CDATA[dummy@example.com (rski)]]></author>
			<pubDate>Thu, 02 Apr 2009 14:33:48 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=682#p682</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=681#p681</link>
			<description><![CDATA[Rozwiązań pewnie będzie wiele np
[code]
create function f_test() returns setof test as '
declare r test%rowtype; 
begin 
    for r in select * from test loop 
      return next r; 
    end loop; 
end;
'
language plpgsql;
[/code]
i uruchamiasz poleceniem 
[code] 
select * from f_test();
[/code]
Albo np

[code]
create function f_test2() returns varchar as $$
declare r test%rowtype; 
begin 
   for r in select * from test loop 
    raise info 'wartosci %',r.i;  --i tu wymieniasz to co chcesz wypisac
   end loop; 
   return 'Done'; 
end; 
$$
language plpgsql;
[/code]
i wywołujesz
[code]
select f_test2();
[/code]

Pamiętaj, że plpgsql nie został stworzony do tego aby wypisywać dane na ekran w związku z czym nie ma tu specjalnej koemendy wypisywania czegoś na ekran (cos jak dbms_output w oraclu)]]></description>
			<author><![CDATA[dummy@example.com (rski)]]></author>
			<pubDate>Thu, 02 Apr 2009 14:23:20 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=681#p681</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=680#p680</link>
			<description><![CDATA[Tabela osoby wygląda tak:
CREATE TABLE osoby
(
  idosoby numeric(10) NOT NULL,
  iddzialu numeric(10),
  nazwisko character varying(15),
  imie character varying(15),
  rokurodz numeric(4),
  wzrost numeric(3,2),
  idszefa numeric(10),
  CONSTRAINT osoby_pkey PRIMARY KEY (idosoby)
)]]></description>
			<author><![CDATA[dummy@example.com (woziu)]]></author>
			<pubDate>Thu, 02 Apr 2009 14:03:49 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=680#p680</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=677#p677</link>
			<description><![CDATA[Procedura ma wyświetlić to co się znajduje w tabeli osoby.

No właśnie nie wiem, jaki typ muszę podać " returns typ"?
A kolumny w tabeli osoby mam różnego typu.:)
Jak mam brak typu, to błąd składni?]]></description>
			<author><![CDATA[dummy@example.com (woziu)]]></author>
			<pubDate>Thu, 02 Apr 2009 13:02:26 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=677#p677</guid>
		</item>
		<item>
			<title><![CDATA[Odp: Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=676#p676</link>
			<description><![CDATA[A co ta procedura ma robić? Bo piszesz 'returns numeric' a w kodzie masz 'select * form ...']]></description>
			<author><![CDATA[dummy@example.com (rski)]]></author>
			<pubDate>Thu, 02 Apr 2009 12:42:52 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=676#p676</guid>
		</item>
		<item>
			<title><![CDATA[Jak uruchomić procedurę?]]></title>
			<link>https://forum.postgresql.org.pl/viewtopic.php?pid=675#p675</link>
			<description><![CDATA[Mam taką procedurę,
CREATE FUNCTION p2() Returns numeric AS'
BEGIN 
select * from osoby ;
END; '
LANGUAGE 'plpgsql'

Zapytanie wykonało się.

Jak robię select p2; to mam taki błąd
BŁĄD: query has no destination for result data
Stan SQL:42601
Wskazówka:If you want to discard the results of a SELECT, use PERFORM instead.
Kontekst:PL/pgSQL function "p2" line 2 at SQL statement

przy EXECUTE p2; prepared statement "p2" does not exist

Co zrobić aby tą procedurę uruchomić. Jest to moja pierwsza procedura:)]]></description>
			<author><![CDATA[dummy@example.com (woziu)]]></author>
			<pubDate>Thu, 02 Apr 2009 11:47:58 +0000</pubDate>
			<guid>https://forum.postgresql.org.pl/viewtopic.php?pid=675#p675</guid>
		</item>
	</channel>
</rss>
