X-Original-To: pgsql-sql@postgresql.org Received: from sydney1.qnix.com.au (unknown [203.98.67.20]) by postgresql.org (Postfix) with ESMTP id 8CE92476371 for ; Fri, 14 Mar 2003 09:30:04 -0500 (EST) Received: from oemcomputer (dialup-16.37.194.203.acc01-stge-pth.comindico.com.au [203.194.37.16]) (authenticated) by sydney1.qnix.com.au (8.11.6/8.11.6) with ESMTP id h2EEZlQ26938; Sat, 15 Mar 2003 01:35:49 +1100 Message-ID: <022001c2ea36$072b3180$1f84fea9@oemcomputer> Reply-To: "Susan Hoddinott" From: "Susan Hoddinott" To: "Ian Harding" Cc: References: Subject: Re: Create function statement with insert statement Date: Fri, 14 Mar 2003 22:28:46 +0800 Organization: Hexworx MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Archive-Number: 200303/361 X-Sequence-Number: 12400 Unfortunately this did not solve the problem (I tried both upper and lower case). It is a strange one. I end up with the following 3 errors: ERROR: parser: parse error at or near "1" ERROR: parser: parse error at or near ";" ERROR: parser: parse error at or near "orderinsert" Regards ----- Original Message ----- From: "Ian Harding" To: ; Cc: Sent: Thursday, March 13, 2003 10:45 PM Subject: Re: [SQL] Create function statement with insert statement > 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 > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster