From: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
Cc: mweaver@corpusglobe.com
Subject: Re: "function has no parameter $1" - help.
Date: Fri, 07 Feb 2003 09:28:50 +0100
Message-ID: <3E436E41.ABA852F5@rodos.fzk.de> (raw)
>
> I'm trying to create a trigger to enforce a constraint onto two
possible
> foreign tables
> my function is defined as:
>
> <-- snip -->
> CREATE OR REPLACE FUNCTION
> sp_check_tranitem_productid(tbl_tranitem.fld_tranitem_id%TYPE,
> tbl_tranitem.fld_tranitem_type%TYPE)
RETURNS
> OPAQUE AS '
> DECLARE
> -------[Parameters]-------
> pl_product_id ALIAS FOR $1;
> pl_product_type ALIAS FOR $2;
> <-- snip -->
>
> but when I call the function I get the error:
>
> function has no parameter $1
>
> What is going wrong?
>
> (I am using PostgreSQL 7.3.1)
>
The documentation says about trigger procedures:
PL/pgSQL can be used to define trigger procedures. A trigger procedure
is created with the CREATE FUNCTION command as a
function with no arguments and a return type of OPAQUE. Note that the
function must be declared with no arguments even if it
expects to receive arguments specified in CREATE TRIGGER --- trigger
arguments are passed via TG_ARGV, as described
below.
Refer to that chapter for an example.
Regards, Christoph
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: ch@rodos.fzk.de, mweaver@corpusglobe.com
Subject: Re: "function has no parameter $1" - help.
In-Reply-To: <3E436E41.ABA852F5@rodos.fzk.de>
* 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