Re: help me on a trigger

From: Terry Lee Tucker <terry(at)esc1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: help me on a trigger
Date: 2006-06-02 08:16:03
Message-ID: 200606020416.03975.terry@esc1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 02 June 2006 02:09 am, Pedro <pedro100(at)gmail(dot)com> thus communicated:
--> 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.
-->
See the documentation at the link below for a discussion on writting triggers.
http://www.postgresql.org/docs/8.1/static/plpgsql-trigger.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomi NA 2006-06-02 08:30:36 review SQL command history?
Previous Message Pedro 2006-06-02 06:09:03 help me on a trigger