Search Postgresql Archives

hi, what is wrong with my newbie sql?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, the following sql returns "10" and not "20" as would be expected.

Where is the error? This would for sure work in any programming
language, why is this different?

CREATE FUNCTION test () RETURNS INTEGER AS '

	DECLARE
		k integer;

	BEGIN
		k = 10;
		FOR k IN 1..10 LOOP
			k = k +1;
		END LOOP;

		return k;
	END;

' LANGUAGE 'plpgsql';



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux