error: insert has more expressions than target column

Поиск
Список
Период
Сортировка
От Dino Vliet
Тема error: insert has more expressions than target column
Дата
Msg-id 20040907132453.8923.qmail@web40109.mail.yahoo.com
обсуждение исходный текст
Ответы Re: error: insert has more expressions than target column  (Richard Huxton <dev@archonet.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Alex Soto
Дата:
Сообщение: Re: Help supressing NOTICE messages
Следующее
От: Valerie Schneider DSI/DEV
Дата:
Сообщение: Pb with ecpg and include file on PG 8.0.0