using a function

Поиск
Список
Период
Сортировка
От Andy Colson
Тема using a function
Дата
Msg-id 4B43BF9A.7050401@squeakycode.net
обсуждение исходный текст
Список pgsql-general
(*Sorry if this posts twice, I sent it from the wrong account the first
time*)

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

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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: PostgreSQL Write Performance
Следующее
От: Andres Freund
Дата:
Сообщение: Re: PostgreSQL Write Performance