X-Original-To: pgsql-sql@postgresql.org Received: from mail.tpchd.org (unknown [192.103.155.40]) by postgresql.org (Postfix) with SMTP id 2FB52476CD3 for ; Thu, 13 Mar 2003 09:47:11 -0500 (EST) Received: from TPC-Message_Server by mail.tpchd.org with Novell_GroupWise; Thu, 13 Mar 2003 06:46:52 -0800 Message-Id: X-Mailer: Novell GroupWise Internet Agent 5.5.2.1 Date: Thu, 13 Mar 2003 06:45:19 -0800 From: "Ian Harding" To: , Cc: Subject: Re: Create function statement with insert statement Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Archive-Number: 200303/353 X-Sequence-Number: 12392 I think the language needs to be in quotes ... ... ' language 'sql'; >>> "Jon Griffin" 03/12/03 11:59AM >>> You need to put your aliases in: value1 alias for $1; etc. 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster