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 180FF4758E6 for ; Wed, 12 Mar 2003 04:03:31 -0500 (EST) Received: from oemcomputer (dialup-174.37.194.203.acc01-stge-pth.comindico.com.au [203.194.37.174]) (authenticated) by sydney1.qnix.com.au (8.11.6/8.11.6) with ESMTP id h2C99rQ24720 for ; Wed, 12 Mar 2003 20:09:53 +1100 Message-ID: <003201c2e876$3498a880$1f84fea9@oemcomputer> Reply-To: "Susan Hoddinott" From: "Susan Hoddinott" To: Subject: Create function statement with insert statement Date: Wed, 12 Mar 2003 17:03:07 +0800 Organization: Hexworx MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002E_01C2E8B9.40A45320" 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/290 X-Sequence-Number: 12330 This is a multi-part message in MIME format. ------=_NextPart_000_002E_01C2E8B9.40A45320 Content-Type: multipart/alternative; boundary="----=_NextPart_001_002F_01C2E8B9.40A45320" ------=_NextPart_001_002F_01C2E8B9.40A45320 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 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? Regards ------=_NextPart_001_002F_01C2E8B9.40A45320 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
I am trying to create a database trigger w= hich=20 inserts into a second table.  I have created the following function in= =20 accordance with the reference manual documentation (7.2). 
 
 

CREATE OR REPLACE FUNCTION orderinsert(INTEGER, VARCHAR) RETURNS INTEGER= AS=20 '

INSERT INTO HEXORDERS ( CUSTOMER_ID, ORDER_KEY, DISTRIBUTOR_ID, ORDER_AM= OUNT,=20 ORDER_GST ) VALUES ( $1, $2, 1, 0, 0 ) ;

SELECT 1 ;

' LANGUAGE SQL ;

 

It fails with the cryptic error "parse error at or near ;".   = Can=20 anyone tell me what is wrong with this syntax?

Regards

------=_NextPart_001_002F_01C2E8B9.40A45320-- ------=_NextPart_000_002E_01C2E8B9.40A45320 Content-Type: application/octet-stream; name="Susan Hoddinott.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Susan Hoddinott.vcf" BEGIN:VCARD VERSION:2.1 N:Hoddinott;Susan FN:Susan Hoddinott EMAIL;INTERNET:susan@perth.dialix.com.au EMAIL;PREF;INTERNET:susan@hexworx.com REV:20030312T090307Z END:VCARD ------=_NextPart_000_002E_01C2E8B9.40A45320--