Hi All
I have a basic problem that I hope can be
addressed.
I need to insert data from one table into three other
tables.
I attempted the following format.
CREATE OR REPLACE FUNCTION p_id_monitor() RETURNS "trigger" AS $$ Begin insert into p_id.loops (monitor) Select p_id.devices.devices_id Where p_id.devices.device_number = library.devices.device_number and library.devices.type_ = 'mon' ; insert into p_id.settings (monitor) Select p_id.devices.devices_id Where p_id.devices.device_number = library.devices.device_number and library.devices.type_ = 'mon' ; insert into p_id.alarms (monitor)
Select p_id.devices.devices_id Where p_id.devices.device_number = library.devices.device_number and library.devices.type_ = 'mon' ; Return Null ;
End; $$ LANGUAGE 'plpgsql' ; create trigger mon after insert on p_id.devices for each row execute procedure p_id_monitor() ; Unfortunately this gave multiple results on the target tables.
Is there a format that will give me a single insert for each
original field without the need of creating three triggers???
Bob
|