This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C48589.40041680
Content-Type: text/plain
Can anyone tell me what is wrong with the function below ?
It throws an ERROR: syntax error at or near "FETCH" at character 551
CREATE OR REPLACE FUNCTION "public"."theo_test2" () RETURNS OPAQUE AS'
BEGIN
declare curr_theo cursor for select * from node_names;
fetch next from curr_theo;
close curr_theo;
END;
'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;
However, this appears to work :
begin;
declare curr_theo cursor for select * from node_names;
fetch next from curr_theo;
close curr_theo;
end;
____________________________________________________________ __________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.
------_=_NextPart_001_01C48589.40041680
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Function Issue!</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Arial">Can anyone tell me what is wrong with the function below ? </FONT>
<BR><FONT SIZE=2 FACE="Arial">It throws an ERROR: syntax error at or near "FETCH" at character 551</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">CREATE OR REPLACE FUNCTION "public"."theo_test2" () RETURNS OPAQUE AS'</FONT>
<BR><FONT SIZE=2 FACE="Arial">BEGIN</FONT>
<BR><FONT SIZE=2 FACE="Arial"> declare curr_theo cursor for select * from node_names;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> fetch next from curr_theo;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> close curr_theo;</FONT>
<BR><FONT SIZE=2 FACE="Arial">END;</FONT>
<BR><FONT SIZE=2 FACE="Arial">'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">However, this appears to work :</FONT>
<BR><FONT SIZE=2 FACE="Arial">begin;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> declare curr_theo cursor for select * from node_names;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> fetch next from curr_theo;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> close curr_theo;</FONT>
<BR><FONT SIZE=2 FACE="Arial">end;</FONT>
</P>
</BODY>
</HTML>
<table><tr><td bgcolor=#ffffff><font color=#000000> ____________________________________________________________ __________<br>This email, including attachments, is intended only for the addressee<br>and may be confidential, privileged and subject to copyright. If you<br>have received this email in error, please advise the sender and delete<br>it. If you are not the intended recipient of this email, you must not<br>use, copy or disclose its content to anyone. You must not copy or <br>communicate to others content that is confidential or subject to <br>copyright, unless you have the consent of the content owner.<br></font></td></tr></table>
------_=_NextPart_001_01C48589.40041680--
