| From: | "Susan Hoddinott" <susan(at)hexworx(dot)com> | 
|---|---|
| To: | <pgsql-sql(at)postgresql(dot)org> | 
| Subject: | Create function statement with insert statement | 
| Date: | 2003-03-12 09:03:07 | 
| Message-ID: | 003201c2e876$3498a880$1f84fea9@oemcomputer | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
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 manual documentation (7.2).
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 ;
It fails with the cryptic error "parse error at or near ;". Can anyone tell me what is wrong with this syntax?
Regards
| Attachment | Content-Type | Size | 
|---|---|---|
| Susan Hoddinott.vcf | application/octet-stream | 171 bytes | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Susan Hoddinott | 2003-03-12 09:11:19 | Using update statements in create function statements | 
| Previous Message | Christoph Haller | 2003-03-12 08:14:20 | Re: Special characters in SQL queries |