Thread: Fw: Problem Related to Goto
Dear All
I have a strange problem. Some documents suggests that I can use Goto statement. My program is like this one.
Drop function Gototest();
Create Function Gototest() Returns int4 as'
Declare
DBFirst int2;
Begin
DBFirst := 1;
Start: DBFirst:= DBFirst+1;
If (DBFirst != 10) Then
Goto Start;
End If;
Raise Notice ''val %'',DBFirst;
Return DBFirst;
End;
' language 'plpgsql';
Create Function Gototest() Returns int4 as'
Declare
DBFirst int2;
Begin
DBFirst := 1;
Start: DBFirst:= DBFirst+1;
If (DBFirst != 10) Then
Goto Start;
End If;
Raise Notice ''val %'',DBFirst;
Return DBFirst;
End;
' language 'plpgsql';
Select Gototest();
But when I am running it , it gives error
DROP
CREATE
ERROR: parser: parse error at or near "start"
CREATE
ERROR: parser: parse error at or near "start"
What may be cause of it. Actually I am converting oracle stored procedure to postgres function.So what is alternate.Is there any support of Continue statement.
Thanks
Regards
Dinesh Parikh