Create function statement with insert statement

Поиск
Список
Период
Сортировка
От Susan Hoddinott
Тема Create function statement with insert statement
Дата
Msg-id 003201c2e876$3498a880$1f84fea9@oemcomputer
обсуждение исходный текст
Ответы Re: Create function statement with insert statement  ("Jon Griffin" <jong@e88.org>)
Re: Create function statement with insert statement  (Andreas Schmitz <a.schmitz@cityweb.de>)
Список 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

Вложения

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

Предыдущее
От: August Detlefsen
Дата:
Сообщение: Using column alias in WHERE clause?
Следующее
От: "Susan Hoddinott"
Дата:
Сообщение: Using update statements in create function statements