help me on a trigger

From: Pedro <pedro100(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: help me on a trigger
Date: 2006-06-02 06:09:03
Message-ID: 9f2d5e960606012309i6be0c0cbp57a7fa968208d06b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I need to create a trigger that decreases on a "stocks" table the amount
that have been inserted on the "tooken_from_stock" table.

the trigger should be something like:

CREATE TRIGGER triggerdecrease
BEFORE INSERT ON tooken_from_stock
EXECUTE PROCEDURE decrease();

then i need to create the procedure decrease that gets the inserted
"tooken_from_stock.amount" and subtracts it on "stocks.amount"

can anybody help me with this please?

thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Terry Lee Tucker 2006-06-02 08:16:03 Re: help me on a trigger
Previous Message Bruno Wolff III 2006-06-02 05:00:32 Re: Restoring databases from a different installment on Windows