From: | Andy Colson <andy(at)camavision(dot)com> |
---|---|
To: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | using a function |
Date: | 2010-01-05 22:31:13 |
Message-ID: | 4B43BDB1.2030809@camavision.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a function that's working for what I needed it to do, but now I
need to call it for every id in a different table... and I'm not sure
what the syntax should be.
Here is an example:
create or replace function test(uid integer, out vhrs integer, out phrs
integer, out fhrs integer)
returns setof record as $$
begin
vhrs := uid + 1;
phrs := uid + 2;
fhrs := uid + 3;
return next;
end;
$$ language 'plpgsql';
I currently use it once, I know the id, and just call:
select * from test(42);
all is well.
But now I need to call it for every record in my employee table.
I tried:
select id, vhrs, phrs, fhrs
from employee, test(id)
I also tried an inner join, but neither work. Any hints how I might do
this?
Thanks
-Andy
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2010-01-05 22:34:28 | Re: PostgreSQL Write Performance |
Previous Message | Greg Smith | 2010-01-05 22:30:40 | Re: timestams in the the pg_standby output |