Re: Create function statement with insert statement

From: "Susan Hoddinott" <susan(at)hexworx(dot)com>
To: "Ian Harding" <ianh(at)tpchd(dot)org>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Create function statement with insert statement
Date: 2003-03-14 14:28:46
Message-ID: 022001c2ea36$072b3180$1f84fea9@oemcomputer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Unfortunately this did not solve the problem (I tried both upper and lower
case). It is a strange one. I end up with the following 3 errors:

ERROR: parser: parse error at or near "1"
ERROR: parser: parse error at or near ";"
ERROR: parser: parse error at or near "orderinsert"

Regards

----- Original Message -----
From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <jong(at)e88(dot)org>; <susan(at)hexworx(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, March 13, 2003 10:45 PM
Subject: Re: [SQL] Create function statement with insert statement

> I think the language needs to be in quotes ...
>
> ...
> ' language 'sql';
>
> >>> "Jon Griffin" <jong(at)e88(dot)org> 03/12/03 11:59AM >>>
> 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
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Susan Hoddinott 2003-03-14 14:52:11 Re: Create function statement with insert statement
Previous Message Carmen Sarlo 2003-03-14 14:15:34 Re: Poor performance on a right join