Re: Create function statement with insert statement

From: "Jon Griffin" <jong(at)e88(dot)org>
To: <susan(at)hexworx(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Create function statement with insert statement
Date: 2003-03-12 19:59:12
Message-ID: 38008.192.168.1.12.1047499152.squirrel@mail.mayuli.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You need to put your aliases in:
value1 alias for $1;
etc.

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chad Thompson 2003-03-12 20:03:43 Re: filtering out doubles
Previous Message Dan Langille 2003-03-12 19:36:08 extending ORDER BY make query much slower