Hi,
I have some problems by using functions with plpgsql.
For example:
tbl:
CREATE TABLE "logs" (
"id" int4 DEFAULT nextval('"logs_id_seq"'::text) NOT NULL,
"session" varchar NOT NULL,
"addr" inet NOT NULL,
"host" varchar NOT NULL,
"agent" varchar NOT NULL,
"datum" timestamptz DEFAULT now(),
"referer" varchar,
CONSTRAINT "logs_pkey" PRIMARY KEY ("id")
);
function:
CREATE FUNCTION "next_id"(character varying) RETURNS integer AS '
DECLARE
tabelle ALIAS FOR $1;
BEGIN
SELECT MAX(id)+1 FROM tabelle;
END;
' LANGUAGE 'plpgsql'
query:
SELECT next_id(logs);
error:
PostgreSQL meldet: ERROR: parser: parse error at or near "$1"
Can anybody help me?
MfG
Bernd Hoffmann
unixserver.info
96123 Litzendorf
Tel: +499505/8050485
Fax: +499505/8050486
info@unixserver.info