Re: Create function statement with insert statement

Поиск
Список
Период
Сортировка
От Susan Hoddinott
Тема Re: Create function statement with insert statement
Дата
Msg-id 002a01c2ea5b$1c0e06c0$1f84fea9@oemcomputer
обсуждение исходный текст
Ответ на Create function statement with insert statement  ("Susan Hoddinott" <susan@hexworx.com>)
Ответы Re: Create function statement with insert statement  (Joe Conway <mail@joeconway.com>)
Список pgsql-sql
Hi Andrea,

That was my first attempt (i.e. using opaque) but unfortunately when I use
"opaque" it tells me that SQL functions cannot return opaque.  The parse
error is also occurring on the create function statement prior to any
knowledge that the function is being used for a trigger.

Regards


----- Original Message -----
From: "Andreas Schmitz" <a.schmitz@cityweb.de>
To: "Susan Hoddinott" <susan@hexworx.com>; <pgsql-sql@postgresql.org>
Sent: Friday, March 14, 2003 10:52 PM
Subject: Re: [SQL] Create function statement with insert statement


>
> Hi Susan,
>
> I had a similar problem with a function using pl/pgsql. I checked the docs
> (7.3) for it and discovered the following info:
>
> "A trigger procedure is created with the CREATE FUNCTION command as a
function
> with no arguments and a return type of OPAQUE"
>
>
http://www.postgresql.org/docs/view.php?version=7.2&idoc=1&file=plpgsql-trig
ger.html
>
>
> Regards,
>
> -Andreas
>
>
>
>
> > 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
>
> --
> Andreas Schmitz - Phone +49 201 8501 318
> Cityweb-Technik-Service-Gesellschaft mbH
> Friedrichstr. 12 - Fax +49 201 8501 104
> 45128 Essen - email a.schmitz@cityweb.de



В списке pgsql-sql по дате отправления:

Предыдущее
От: Franco Bruno Borghesi
Дата:
Сообщение: Re: [HACKERS] What's wrong with this group by clause?
Следующее
От: "Susan Hoddinott"
Дата:
Сообщение: Re: Create function statement with insert statement