Database function syntax for inserting records

From: "Susan Hoddinott" <susan(at)perth(dot)dialix(dot)com(dot)au>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Database function syntax for inserting records
Date: 2003-03-04 00:34:19
Message-ID: 000901c2e1e5$cd7ee100$1f84fea9@oemcomputer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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_AMOUNT, ORDER_GST )

VALUES ( $1, $2, 1, 0, 0 ) ;

SELECT 1 ;

' LANGUAGE SQL ;

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"

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

Regards

Attachment Content-Type Size
Susan Hoddinott.vcf application/octet-stream 171 bytes

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Nachbaur 2003-03-04 01:03:21 Re: Forcing query to use an index
Previous Message Josh Berkus 2003-03-03 23:32:47 Re: Forcing query to use an index