pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTrigger with Stored Procedure [Client Points]
3+ messages / 2 participants
[nested] [flat]
* Trigger with Stored Procedure [Client Points]
@ 2006-08-30 11:56 Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ezequias Rodrigues da Rocha @ 2006-08-30 11:56 UTC (permalink / raw)
To: pgsql-sql
Hi list,
I have a table like this:
Points
---------------------------------
Id
operation
value
and another two tables like this
Client Rule
------------------------ -----------------------
id id
name percent
Points
ps: The Points table is a table that represent each moviment of the Client.
I need to make a trigger that see after all insert on Points table and
update the client table based on the percent on the Rule table.
Anyone that would like to help me I will be very welcomed.
My best regards ...
Ezequias
I must do trigger to update a table based on a field a Stored Procedure to
update a table based
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Atenciosamente (Sincerely)
Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Trigger with Stored Procedure [Client Points]
@ 2006-08-31 15:29 Aaron Bono <postgresql@aranya.com>
parent: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Aaron Bono @ 2006-08-31 15:29 UTC (permalink / raw)
To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>; +Cc: pgsql-sql
On 8/30/06, Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com> wrote:
>
> Hi list,
>
> I have a table like this:
>
> Points
> ---------------------------------
> Id
> operation
> value
>
> and another two tables like this
>
> Client Rule
> ------------------------ -----------------------
> id id
> name percent
> Points
>
>
> ps: The Points table is a table that represent each moviment of the
> Client.
>
>
> I need to make a trigger that see after all insert on Points table and
> update the client table based on the percent on the Rule table.
>
> Anyone that would like to help me I will be very welcomed.
>
I am not exactly sure what you are trying to do here. Can you provide an
example of the data and what you want to occur?
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Trigger with Stored Procedure [Client Points]
@ 2006-08-31 21:42 Aaron Bono <postgresql@aranya.com>
parent: Aaron Bono <postgresql@aranya.com>
0 siblings, 0 replies; 3+ messages in thread
From: Aaron Bono @ 2006-08-31 21:42 UTC (permalink / raw)
To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>; +Cc: pgsql-sql
On 8/31/06, Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com> wrote:
>
> Bono,
>
> I must check each insert on my Points(each shop generate a new line on
> Points table).
>
> When I insert the record on points I must see the field Value(on
> points table already) and update the Client.Points field based in some
> rule. My fear is not get correct row and do not update the correct client.
>
> Any help would be very welcome.
>
> Regards
> Ezequias
>
> 2006/8/31, Aaron Bono < postgresql@aranya.com>:
>
> > On 8/30/06, Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
> > wrote:
> >
> > > Hi list,
> > >
> > > I have a table like this:
> > >
> > > Points
> > > ---------------------------------
> > > Id
> > > operation
> > > value
> > >
> > > and another two tables like this
> > >
> > > Client Rule
> > > ------------------------ -----------------------
> > > id id
> > > name percent
> > > Points
> > >
> > >
> > > ps: The Points table is a table that represent each moviment of the
> > > Client.
> > >
> > >
> > > I need to make a trigger that see after all insert on Points table and
> > > update the client table based on the percent on the Rule table.
> > >
> > > Anyone that would like to help me I will be very welcomed.
> > >
> >
> >
> > I am not exactly sure what you are trying to do here. Can you provide
> > an example of the data and what you want to occur?
> >
>
Please include the list when you reply (reply to all).
So are you saying you need to add foreign keys to the tables? Or are the
rules what dictate what records should be updated? From what you have said
and what I can see of your tables, the rule and points tables need foreign
keys to the clients table so you know what clients the points and rules are
for. Of course I am guessing based off the very limited information you
have provided.
If we are to help you, you really need to provide some examples. What kind
of rules are you talking about?
**
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-08-31 21:42 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-30 11:56 Trigger with Stored Procedure [Client Points] Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
2006-08-31 15:29 ` Aaron Bono <postgresql@aranya.com>
2006-08-31 21:42 ` Aaron Bono <postgresql@aranya.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox