X-Original-To: pgsql-sql@postgresql.org Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id E710B474E44 for ; Thu, 13 Mar 2003 05:07:45 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Thu Mar 13 11:07:46 2003 +0100 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id LAA01120; Thu, 13 Mar 2003 11:07:45 +0100 (MET) Message-ID: <3E705871.E0CBB9E@rodos.fzk.de> Date: Thu, 13 Mar 2003 11:07:45 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: susan@hexworx.com Subject: Re: Create function statement with insert statement Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/330 X-Sequence-Number: 12369 > > 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 ma= > nual documentation (7.2).=20=20 > > CREATE OR REPLACE FUNCTION orderinsert(INTEGER, VARCHAR) RETURNS INTEGER AS= > ' > INSERT INTO HEXORDERS ( CUSTOMER_ID, ORDER_KEY, DISTRIBUTOR_ID, ORDER_AMOUN= > T, 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 te= > ll me what is wrong with this syntax? > I cannot see anything wrong with this syntax, except the newline in ORDER_AMOUN\nT. But this is probably originated from your mailing tool, isn't it? Could you provide us with the CREATE TABLE HEXORDERS ( ... ); statement? Did you try the INSERT command within psql? Regards, Christoph