plpgsql function

From: Marcin Mazurek <M(dot)Mazurek(at)poznan(dot)multinet(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: plpgsql function
Date: 2000-09-05 14:42:59
Message-ID: 20000905164259.D3626@poznan.mtl.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
creation of following function works just fine but usage not:):
mtldb=# select mtldb_wykonane(0);
ERROR: unexpected SELECT query in exec_stmt_execsql()
Can You help me find an error?
tia

CREATE FUNCTION mtldb_wykonane (integer) RETURNS integer AS '
DECLARE
zlecenie alias for $1;
tls integer;
twz integer;
BEGIN
SELECT count(*) as ls FROM serwery;
tls:=new.ls;
SELECT count(*) as wz FROM wykonanie
WHERE zadanie_id=zlecenie AND kiedy IS NOT NULL;
twz:=new.wz;

if tls>twz
RETURN -1;
end if;
if tls=twz
RETURN 1;
end if;
END;
' LANGUAGE 'plpgsql' ;

Marcin Mazurek

--
Kierownik Działu Systemowego
MULTINET SA o/Poznan
http://www.multinet.pl/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2000-09-05 14:52:26 Re: Column name case conversion
Previous Message Peter Mount 2000-09-05 14:34:29 Re: JDBC