Dino Vliet wrote:
> Hi there,
> I want to put a number of records (variable number
> depending on a attribute of a table) into a certain
> table with a trigger statement.
>
> I have created the follwing trigger:
>
> CREATE FUNCTION vullalles() RETURNS trigger AS '
> BEGIN
> FOR i in 0..7 LOOP
> INSERT INTO lessons (select
> dayofweek,startdate,endate,startime,endtime,teacher,location,roomnr
> from courseschedule);
Try it without the brackets around select, or put the column-names in
brackets before it.
> startdate := startdate + i*7;
> EXECUTE startdate;
Not sure what this is supposed to be doing. The EXECUTE is redundant.
> RETURN NEW;
> END LOOP;
> END;
> ' LANGUAGE plpgsql;
--
Richard Huxton
Archonet Ltd