I have a quick question. I am fairly new to pgsql and I am unable to figure out how to fix the syntax error below.
Here is what I am trying to do
start_date := '2011-01-01'::date;
end_date := '2011-03-01'::date;
duration := '6 months'
while start_date < end_date loop
window_start_date = start_date;
window_end_date = window_start_date + interval||duration||;
end loop;
However I keep getting a syntax error.
ERROR: column "interval" does not exist
LINE 1: SELECT $1 + interval|| $2 ||
^
QUERY: SELECT $1 + interval|| $2 ||
What am I doing wrong. Any help would be much appreciated
SELECT ... INTOby the parser. The error messages unfortunately don't get converted back.||at the end of the statement to do? It doesn't make any sense at all,||is the concatenation operator. I think you're trying to writewindow_start_date + duration * INTERVAL '1' daybut it's hard to be sure.