From: Michael Zouroudis <mzouroudis@idealcorp.com>
To: pgsql-admin@postgresql.org
Subject: need help with an insert statement
Date: Mon, 19 Aug 2002 11:34:54 -0400
Message-ID: <3D61101E.50709@idealcorp.com> (raw)
sorry if this becomes a little long, but i want to fully explain the
problem.
three tables;
create table asset(
asset_id serial primary key
);
create table software(
software_id serial primary key
);
create table software_asset(
asset_id integer not null
software_id integer not null
);
what i'm aiming for is to get a function that inserts into the
software_asset table from the software table. i already have a working
function on assets that inserts into software. when that happens, i
need it to set off the function on software to insert into
software_asset. here is the function i am having problems with;
create function soft_asset() returns opaque as '
declare
s software%ROWTYPE;
a assets%ROWTYPE;
sa software_asset%ROWTYPE;
s_id integer;
a_id integer;
asset_id integer;
x integer;
begin
select currval (''assets_asset_id_seq'') into x;
select currval (''software_software_id_seq'') into s_id;
raise notice ''last value = %'', x;
raise notice ''last value = %'', s_id;
insert into software_asset (software_id, asset_id) values (s_id, x);
return null;
end;
create trigger now after insert or update on software
for each row execute procedure soft_asset();
the error happens on the insert statement. if i comment that line out,
it returns a value on the notice, but i can't figure out how to return
that value. if anybody can, i would appreicate their help.
thanks in advance,
mike
--
Mike Zouroudis
Intern
__________________________________________________
I.D.E.A.L. Technology Corporation - Orlando Office
http://www.idealcorp.com - 407.999.9870 x14
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mzouroudis@idealcorp.com
Subject: Re: need help with an insert statement
In-Reply-To: <3D61101E.50709@idealcorp.com>
References: <3D61101E.50709@idealcorp.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox