help with function .. .. date data type

From: "ed" <ntworldnet(at)netzero(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: help with function .. .. date data type
Date: 2005-06-20 03:39:39
Message-ID: KGELJGBAHPDNPFCCDAKHAEBHCAAA.ntworldnet@netzero.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a table with 7 columns and Im trying to pull a section(rows) of the
table

by using the date column(field), in a function. I want it to work like so;

# Select Slice('03/01/2004', '03/05/2003');

But Im getting an error .. .. ...

------------------------- this is the error ------------------------------

NOTICE: Error occurred while executing PL/pgSQL function slice

NOTICE: line 9 at SQL statement

ERROR: zero-length delimited identifier

-------------------------- end of error -----------------------------------

What Am I doing wrong.

------------------------------ my code ----------------------------------

CREATE FUNCTION Slice(date, date)

RETURNS date AS'

DECLARE

f_table RECORD;

lower Alias for $1;

upper Alias for $2;

BEGIN

set datestyle to ""US, SQL"";

for name in lower..upper

Loop

SELECT * INTO f_table from g_table -- my g_table is the real table
in the datebase.

WHERE g_table.date BETWEEN upper AND lower

ORDER BY g_table.date;

End Loop;

END;

'Language 'plpgsql';

Ed..

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message sara simoes 2005-06-20 10:00:38 Data Migration from Access to Postgresql
Previous Message Michael Fuhr 2005-06-20 03:15:21 Re: Raise Notice