| От | Jean-Christian Imbeault |
|---|---|
| Тема | Return value in function/trigger |
| Дата | |
| Msg-id | 3DDAF868.3010506@mega-bucks.co.jp обсуждение исходный текст |
| Ответы |
Re: Return value in function/trigger
|
| Список | pgsql-general |
I have created a trigger and the function executed by the trigger.
However the function merely updates values in a table and doesn't return
any result/value. what is the correct way of "returning" nothing?
I have written this but using "return new" seems pointless as I don't
need(?) to return anything.
create or replace function update_invoice_price() returns opaque as '
begin
update invoices set total_price=(select sum(price) from invoice_li
where invoice_id=new.invoice_id) where id=new.invoice_id;
return new;
end;
' language 'plpgsql' with (iscachable);
create trigger update_invoice_li_price after update
on invoice_li for each row
execute procedure update_invoice_price();
Thanks!
Jc
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера