Thread: GoTo statement problem
Hi all,
I have a query about GoTo statement. Is postgres support goto statement or lable can be used for only Exit statement. The book on ste have no clue about this. I had searched all interactive docs for this pupose.(May be some has been left). So I want to know about its implementation . I have a sample fuction for testing this statement. but it is not working.
Function is as follows.
Drop function Gototest();
Create Function Gototest() Returns int4 as'
Declare
DBFirst int2;
Begin
DBFirst := 1;
<<beginlabel>>
While(DBFirst <100)
Loop
DBFirst := DBFirst+1;
If(DBFirst = 5) Then
GoTo Endlable;
End If;
End Loop;
Return DBFirst;
End;
' language 'plpgsql';
Select Gototest();
Create Function Gototest() Returns int4 as'
Declare
DBFirst int2;
Begin
DBFirst := 1;
<<beginlabel>>
While(DBFirst <100)
Loop
DBFirst := DBFirst+1;
If(DBFirst = 5) Then
GoTo Endlable;
End If;
End Loop;
Return DBFirst;
End;
' language 'plpgsql';
Select Gototest();
Any suggesion/bugs may be benificial for me
Regards
Dinesh Parikh.