From: | "Ireneusz Kramarz" <ikramarz(at)wsb-nlu(dot)edu(dot)pl> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | how to create such a function?? |
Date: | 2003-11-25 20:54:57 |
Message-ID: | 001301c3b396$6849d000$0300a8c0@iron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi there,
I want to create a function and a trigger, but I don't know how... :(
I need something that would work when I update the table 'stock' , by insert some integer value into 'sold'. Then the integer value in field 'stock' has to be decreased by that inserted value.
example of my problem:
-table 'stock' before updating 'sold' field
ticket_id | stock | sold
1 | 30 | 0
-how table 'stock' should look like after: update stock set sold=2 where bilet_id=1;
ticket_id | stock | sold
1 | 28 | 2
I have to create something that would work like that, after each update of ticket_id defined rows.
I know that you guys can help me with that... apreciate any help which will be priceless ;-)
iron
From | Date | Subject | |
---|---|---|---|
Next Message | Libor Vanek | 2003-11-26 00:03:14 | Some wayfor checking/updating database/table structure? |
Previous Message | Roy MacGregor Paterson | 2003-11-25 20:21:54 | Re: Failed to create a function |