From: | Dino Vliet <dino_vliet(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | error: insert has more expressions than target column |
Date: | 2004-09-07 13:24:52 |
Message-ID: | 20040907132453.8923.qmail@web40109.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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);
startdate := startdate + i*7;
EXECUTE startdate;
RETURN NEW;
END LOOP;
END;
' LANGUAGE plpgsql;
When I insert a record into courseschedule, I get the
following error:
insert has more expressions than target column
WHAT AM I DOING WRONG?
The function should insert 8 records into lessons when
I insert one record in courseschedule. Now it is done
with a hardcoded for loop but eventually it should be
done based on a attribute in courseschedule.
How can I fix this?
I'm using postgresql 7.4.3 under Freebsd.
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
From | Date | Subject | |
---|---|---|---|
Next Message | Valerie Schneider DSI/DEV | 2004-09-07 13:29:24 | Pb with ecpg and include file on PG 8.0.0 |
Previous Message | Alex Soto | 2004-09-07 13:12:25 | Re: Help supressing NOTICE messages |