What's wrong with this function

From: Najm Hashmi <najm(at)mondo-live(dot)com>
To: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: What's wrong with this function
Date: 2001-02-10 18:04:00
Message-ID: 3A858290.270E2473@mondo-live.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,
Here is a plpgsql function:
flipr'#create function test_cur() returns text as'
flipr'# declare
flipr'# mycur cursor for select title from songs where song_id=10;
flipr'# usr record;
flipr'# results text;
flipr'# begin
flipr'# open mycur;
flipr'# fetch next from mycur into usr;
flipr'# close mycur;
flipr'# results:= usr.title;
flipr'#
flipr'# end;
flipr'# ' language 'plpgsql';
CREATE
flipr=# select test_cur() as Title;
NOTICE: plpgsql: ERROR during compile of test_cur near line 2
ERROR: parse error at or near "cursor"

What I am doing wrong?
Thanks in advance for your help.
Regards, Najm

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kim Yunhan 2001-02-10 18:59:07 How to make operator class?
Previous Message Josh Berkus 2001-02-10 18:03:24 Re: How to make operator class?