<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - typ DATE jako parametr do funkcji]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=480&amp;type=atom"/>
	<updated>2010-08-26T08:23:07Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=480</id>
		<entry>
			<title type="html"><![CDATA[Odp: typ DATE jako parametr do funkcji]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2186#p2186"/>
			<content type="html"><![CDATA[faktycznie masz rację i już z tym kiedyś walczyłem zamienię SMALLINT-a na INTEGER-a i będzie ok]]></content>
			<author>
				<name><![CDATA[WitekS]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=760</uri>
			</author>
			<updated>2010-08-26T08:23:07Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2186#p2186</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: typ DATE jako parametr do funkcji]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2185#p2185"/>
			<content type="html"><![CDATA[Problemem nie jest data, tylko pozostale parametry 
[code]function statystyka.f_sint_sint_dt_km_int(integer, integer, unknown) does not exist[/code]
bo Ty masz smallinty w funkcji

Sprobuj
[code]SELECT statystyka.f_sint_sint_dt_km_int(1::smallint, 1424::smallint, '2010-08-26')[/code]]]></content>
			<author>
				<name><![CDATA[6nom]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=971</uri>
			</author>
			<updated>2010-08-26T07:56:07Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2185#p2185</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[typ DATE jako parametr do funkcji]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2184#p2184"/>
			<content type="html"><![CDATA[Witam
Nie mogę sobie poradzić z datą przekazywaną do funkcji jako parametr. Funkcja ma zwrócić ilość km dla dwóch parametrów id i daty. 
[code]
CREATE OR REPLACE FUNCTION statystyka.f_sint_sint_dt_km_int(SMALLINT, SMALLINT, DATE)
  RETURNS INTEGER AS
$BODY$DECLARE
    ile_km INTEGER;
    tab_poj VARCHAR;
BEGIN
-- okreslenie tabeli dla danego idfk_poj
tab_poj := f_int_table_name_txt($1)||'_w';
           execute 'SELECT
                    '||tab_poj||'.int_wartosc
                  FROM
                    pojazdy.'||tab_poj||'
                  WHERE
                    '||tab_poj||'.dt_data_czas = '''||$3||''' AND
                    '||tab_poj||'.idfk_nr_diag = '||$2||';' into ile_km;
END;
$BODY$
  LANGUAGE plpgsql;
[/code] 
próbuję wywołać w ten sposób 
[code]
SELECT statystyka.f_sint_sint_dt_km_int(1, 1424, '2010-08-26')
[/code]
i dostaję komunikat
[code]
ERROR:  function statystyka.f_sint_sint_dt_km_int(integer, integer, unknown) does not exist
LINE 1: SELECT statystyka.f_sint_sint_dt_km_int(1, 1424, '2010-08-26...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

********** Błąd **********

ERROR: function statystyka.f_sint_sint_dt_km_int(integer, integer, unknown) does not exist
Stan SQL:42883
Wskazówka:No function matches the given name and argument types. You might need to add explicit type casts.
Znak:8
[/code]
używam funkcji z jednym argumentem jako data i wszystko jest ok...]]></content>
			<author>
				<name><![CDATA[WitekS]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=760</uri>
			</author>
			<updated>2010-08-26T06:45:44Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2184#p2184</id>
		</entry>
</feed>
