Database function syntax for inserting records
Database function syntax for inserting records
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
Re: Database function syntax for inserting records
От:
Josh Berkus <josh@agliodbs.com>
Дата:
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 changed through the various versions. -- Josh Berkus josh@agliodbs.com Aglio Database Solutions San Francisco