pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
"function has no parameter $1" - help.
3+ messages / 3 participants
[nested] [flat]

* "function has no parameter $1" - help.
@ 2003-02-07 08:10  Michael Weaver <mweaver@corpusglobe.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Weaver @ 2003-02-07 08:10 UTC (permalink / raw)
  To: Pgsql-Novice (pgsql-novice@postgresql.org) <pgsql-novice@postgresql.org>; pgsql-sql

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)
, 

Mike Weaver
Software Developer

5, 42 Ladner Street
O'Connor, WA, 6163
All correspondence:
PO Box Y3502
East St Georges Terrace
Perth WA 6832

P: (+618) 9331 2700
F: (+618) 9331 3733
M: 0403 385 181
W: http://www.corpusglobe.com/
E: mweaver@corpusglobe.com 

This email is intended only for the use of the individual or entity named
above and may contain information that is confidential. If you are not the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this email is strictly prohibited. When addressed
to our clients, any opinions or advice contained in this email are subject
to the terms and conditions expressed in the governing Corpus Globe client
engagement letter. If you have received this Email in error, please notify
us immediately by return email or telephone +61 8 9331 2700 and destroy the
original message. Thank You. 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: "function has no parameter $1" - help.
@ 2003-02-07 08:28  Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Christoph Haller @ 2003-02-07 08:28 UTC (permalink / raw)
  To: pgsql-sql; +Cc: mweaver@corpusglobe.com

>
> 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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: "function has no parameter $1" - help.
@ 2003-02-07 16:52  Daniel Schuchardt <daniel_schuchardt@web.de>
  parent: Michael Weaver <mweaver@corpusglobe.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Schuchardt @ 2003-02-07 16:52 UTC (permalink / raw)
  To: pgsql-sql

In > 7.3 you can also

CREATE OR REPLACE FUNCTION xxx() RETURNS TRIGGER AS'
BEGIN
END'LANGUAGE plpgsql;





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-02-07 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-07 08:10 "function has no parameter $1" - help. Michael Weaver <mweaver@corpusglobe.com>
2003-02-07 16:52 ` Daniel Schuchardt <daniel_schuchardt@web.de>
2003-02-07 08:28 Re: "function has no parameter $1" - help. Christoph Haller <ch@rodos.fzk.de>

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