X-Original-To: pgsql-sql@postgresql.org Received: from linux012.intern.cityweb.de (linux012.intern.cityweb.de [195.71.215.252]) by postgresql.org (Postfix) with ESMTP id BABED476392 for ; Fri, 14 Mar 2003 10:08:37 -0500 (EST) Received: from zahedi.intern.cityweb.de (zahedi.intern.cityweb.de [193.189.226.198]) by linux012.intern.cityweb.de (8.11.0/8.11.0) with ESMTP id h2EF8YJ24434; Fri, 14 Mar 2003 16:08:35 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Andreas Schmitz Reply-To: a.schmitz@cityweb.de Organization: Cityweb Network To: "Susan Hoddinott" , Subject: Re: Create function statement with insert statement Date: Fri, 14 Mar 2003 15:52:38 +0100 User-Agent: KMail/1.4.1 References: <003201c2e876$3498a880$1f84fea9@oemcomputer> In-Reply-To: <003201c2e876$3498a880$1f84fea9@oemcomputer> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200303141552.38325.a.schmitz@cityweb.de> X-Archive-Number: 200303/364 X-Sequence-Number: 12403 Hi Susan, I had a similar problem with a function using pl/pgsql. I checked the docs (7.3) for it and discovered the following info: "A trigger procedure is created with the CREATE FUNCTION command as a function with no arguments and a return type of OPAQUE" http://www.postgresql.org/docs/view.php?version=7.2&idoc=1&file=plpgsql-trigger.html Regards, -Andreas > Hello, > > I am trying to create a database trigger which inserts into a second table. > I have created the following function in accordance with the reference > manual documentation (7.2). > > > CREATE OR REPLACE FUNCTION orderinsert(INTEGER, VARCHAR) RETURNS INTEGER AS > ' > > INSERT INTO HEXORDERS ( CUSTOMER_ID, ORDER_KEY, DISTRIBUTOR_ID, > ORDER_AMOUNT, ORDER_GST ) VALUES ( $1, $2, 1, 0, 0 ) ; > > SELECT 1 ; > > ' LANGUAGE SQL ; > > > > It fails with the cryptic error "parse error at or near ;". Can anyone > tell me what is wrong with this syntax? > > Regards -- Andreas Schmitz - Phone +49 201 8501 318 Cityweb-Technik-Service-Gesellschaft mbH Friedrichstr. 12 - Fax +49 201 8501 104 45128 Essen - email a.schmitz@cityweb.de