From susan@perth.dialix.com.au Tue Mar 4 00:34:41 2003 X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4C106475ADE for ; Mon, 3 Mar 2003 19:34:41 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 44388-06 for ; Mon, 3 Mar 2003 19:34:39 -0500 (EST) Received: from home.dialix.com (miso.justnet.info [203.15.150.9]) by postgresql.org (Postfix) with ESMTP id 2A3AF475AD7 for ; Mon, 3 Mar 2003 19:34:39 -0500 (EST) Received: from oemcomputer (dialup-173.38.194.203.acc02-stge-pth.comindico.com.au [203.194.38.173]) by home.dialix.com (Postfix) with SMTP id B16A9344E46 for ; Tue, 4 Mar 2003 11:34:32 +1100 (EST) Message-ID: <000901c2e1e5$cd7ee100$1f84fea9@oemcomputer> From: "Susan Hoddinott" To: Subject: Database function syntax for inserting records Date: Tue, 4 Mar 2003 08:34:19 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0005_01C2E228.D9A2F5A0" 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-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/125 X-Sequence-Number: 12165 This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C2E228.D9A2F5A0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0006_01C2E228.D9AC1D60" ------=_NextPart_001_0006_01C2E228.D9AC1D60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I have created the following function: CREATE OR REPLACE FUNCTION orderinsert(INTEGER, VARCHAR) RETURNS INTEGER AS= ' INSERT INTO HEXORDERS ( CUSTOMER_ID, ORDER_KEY, DISTRIBUTOR_ID, ORDER_AMOUN= T, ORDER_GST )=20 VALUES ( $1, $2, 1, 0, 0 ) ; SELECT 1 ; ' LANGUAGE SQL ; which seems to me to be consistent with the instructions given in the Refer= ence manual. However, when trying to create this function I receive the er= rors: parser: parse error at or near ";" parser: parse error at or near "orderinsert" Can any one tell my what I am doing wrong as this seems to be exactly as sp= ecified in the Reference and Programmer manuals? Regards ------=_NextPart_001_0006_01C2E228.D9AC1D60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
I have created the following function:
 

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 ;

 

which seems to me to be consistent with the instructi= ons=20 given in the Reference manual.  However, when trying to create this=20 function I receive the errors:

parser: parse error at or near ";"

parser: parse error at or near "orderinsert"

Can any one tell my what I am doing wrong as this see= ms to=20 be exactly as specified in the Reference and Programmer manuals?

 

Regards

 

------=_NextPart_001_0006_01C2E228.D9AC1D60-- ------=_NextPart_000_0005_01C2E228.D9A2F5A0 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:20030304T003419Z END:VCARD ------=_NextPart_000_0005_01C2E228.D9A2F5A0-- From josh@agliodbs.com Tue Mar 4 18:52:34 2003 X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1274047628E for ; Tue, 4 Mar 2003 13:52:34 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 71707-03 for ; Tue, 4 Mar 2003 13:52:29 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id B5D004762D3 for ; Tue, 4 Mar 2003 13:52:13 -0500 (EST) Received: from [216.135.165.74] (HELO lazarus) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP-TLS id 2879621; Tue, 04 Mar 2003 10:51:58 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Susan Hoddinott" , Subject: Re: Database function syntax for inserting records Date: Tue, 4 Mar 2003 09:31:14 -0800 User-Agent: KMail/1.4.3 References: <000901c2e1e5$cd7ee100$1f84fea9@oemcomputer> In-Reply-To: <000901c2e1e5$cd7ee100$1f84fea9@oemcomputer> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200303040931.14851.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/129 X-Sequence-Number: 12169 Susan, > which seems to me to be consistent with the instructions given in the > Reference manual. However, when trying to create this function I receive > the errors: > > parser: parse error at or near ";" > > parser: parse error at or near "orderinsert" What version of Postgres are you using? Create function syntax has change= d=20 through the various versions. --=20 Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco