469,167 Members | 1,238 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,167 developers. It's quick & easy.

help with trigger

Hi folks,
I'm new to PostgreSQL and am busy tring to work with
it. Of pl/pgsql I know even less and that's the part I
have a question on right now. I have this nice example
to get me started with

I have a table with the schedule of a service my sport
team wants to offer:

Table Schedule
name length startdate enddate day
soccer 4 01-sep-2004 30-sep-2004 Mon
tennis 4 01-sep-2004 30-sep-2004 Wed

This means, that I want to offer soccer weekly, for a
total of 4 weeks as from 1st sep till 30 sep on

Now, what I do want is a second table that creates all
the dates on which there will be soccer training if I
finish entering this record in table Schedule. So,
then the other table, called ScheduledDates has the
follwing records:

Table ScheduleDates
name occurrence date
soccer 1 06-sep-2004
soccer 2 13-sep-2004
soccer 3 20-sep-2004
soccer 4 27-sep-2004

Can someone help me with writing this as a trigger in

Another variant is that the trigger starts when the
table Schedule is populated, but it not just
automatically creates the 4 records as described
above, but because the date 20-sep-2004 is a national
holiday and is in table Exceptions, the sheme just
shifts one up and the occurrence 4 becomes occurrence
3 and the last schedule date becomes monday the 4th of

I hope you can help me with this one, will put me way
up the learning curve of pl/pgsql

Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Nov 23 '05 #1
0 875

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Curtis Gilchrist | last post: by
9 posts views Thread by Martin | last post: by
11 posts views Thread by Jules Alberts | last post: by
reply views Thread by Michael L | last post: by
15 posts views Thread by Jay | last post: by
3 posts views Thread by Sam Durai | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.