From: Josh Berkus <josh@agliodbs.com>
To: Wim <wdh@belbone.be>
To: pgsql-sql@postgresql.org
Subject: Re: Trying to write a function...
Date: Wed, 24 Jul 2002 11:26:27 -0700
Message-ID: <200207241126.27263.josh@agliodbs.com> (raw)
In-Reply-To: <3D3EFBB1.9040904@belbone.be>
References: <3D3EFBB1.9040904@belbone.be>
Wim,
> CREATE FUNCTION f_addrtr (varchar(16),varchar(32)) RETURNS bool AS '
> DECLARE
> index int4;
> BEGIN
> index := 'nextval('s_routerid')';
> INSERT INTO t_routers VALUES (index, $1, $2);
> RETURN 1;
> END;'
> LANGUAGE 'plpgsql';
>
> What am I doing wrong?
Bad quotes, bad data type usage. Change as follows:
CREATE FUNCTION f_addrtr (varchar(16),varchar(32)) RETURNS bool AS '
DECLARE
index int4;
BEGIN
index := nextval(''s_routerid'');
INSERT INTO t_routers VALUES (index, $1, $2);
RETURN TRUE;
END;'
LANGUAGE 'plpgsql';
--
-Josh Berkus
Aglio Database Solutions
San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, wdh@belbone.be
Subject: Re: Trying to write a function...
In-Reply-To: <200207241126.27263.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox