help -- cursor inside a function

From: jprem <jprem(at)srmsoft(dot)co(dot)in>
To: pgman <pgman(at)candle(dot)pha(dot)pa(dot)us>, postgresql <pgsql-general(at)postgresql(dot)org>
Subject: help -- cursor inside a function
Date: 2000-07-03 12:23:39
Message-ID: 396085CB.358C91C3@srmsoft.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


hello ,
i have a procedure as below.

-------------------------------------------------------------------------------------------------------------

create function retrec(integer) returns integer
as
'declare
uid alias for $1;
begin
declare retrec_cur cursor for select * from jd_user_master where

um_user_id>uid;
if found then
fetch 1 from retrec_cur;
move next from retrec_cur;
return 1;
end if;
end;'
language 'plpgsql';
-------------------------------------------------------------------------------------------------------------------------

this gets created , but while running it i get the error below,
-------------------------------------------------------------------------------------------------------------------

NOTICE: plpgsql: ERROR during compile of retrec near line 5
ERROR: parse error at or near "cursor"
--------------------------------------------------------------------------------------------------------------------------

why this is so ? can anyone help me out ? thanx in advance.

Browse pgsql-general by date

  From Date Subject
Next Message eisentrp 2000-07-03 12:39:12 Re: Regarding editor commands
Previous Message Joseph 2000-07-03 10:37:29 ODBC and Connection staying open