using a generated series in function

Поиск
Список
Период
Сортировка
От John Fabiani
Тема using a generated series in function
Дата
Msg-id 1356101.40bZh1B7cs@linux-12
обсуждение исходный текст
Ответы Re: using a generated series in function  (David Johnston <polobo@yahoo.com>)
Список pgsql-sql
Hi,

I am attempting (without success) use the generated series of dates that come 
from:
select (cast(date_trunc('week', '2011-11-20'::date ) as date) + (i+6)) as 
week_date from generate_series(0,84,7) i 

in a function.
select function_name(integer, date);  -- function returns a numeric

This does NOT work:
select (function_name(303, week_date::date)) as week_date where week_date in 
(select (cast(date_trunc('week', '2011-11-20'::date ) as date) + (i+6)) as 
week_date from generate_series(0,84,7) i )

The error is:
ERROR:  column "week_date" does not exist
LINE 1: select (xchromasun._chromasun_getqtyordered(303, week_date::...

I hope I can do this?  What am I doing wrong?
Johnf





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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: JDBC Statement.setQueryTimeout : is there plan to implement this?
Следующее
От: David Johnston
Дата:
Сообщение: Re: using a generated series in function