Firebird 2.0
PSQL Reference
Manual

SUSPEND STATEMENT

Pupose

Use SUSPEND to return a row of data from a procedure to its caller.

Syntax

<suspend_stmt> ::=
   SUSPEND ;


Semantics

Suspends execution of a PSQL routine until the next value is requested by the calling application, and returns output values, if any, to the calling application.

If the procedure is called from a select statement, processing will continue at the statement following SUSPEND when the next row of data is needed. Use the EXIT statement – or let the code path end at the final END of the body – to signal that there are no more rows to return.

If the procedure is called from a EXECUTE PROCEDURE statement, then SUSPEND has the same effect as EXIT. This usage is legal, but not recommended.

Examples

The below creates a procedure that returns the a series of integers and stops as soon as a value larger than 1000 has been reached.

CREATE PROCEDURE range RETURNING ( a INTEGER ) AS
DECLARE i INTEGER = 1;
DECLARE j INTEGER = 1;
BEGIN
   a = i + j;
   i = j; j = a;
   IF (a>1000) THEN EXIT;
   SUSPEND;
END;


See also

EXIT statement; PSQL Programs; See the SQL Reference Manual for a description of using procedures in SELECT statements.


previous page goto index next page

Legal information


User comments:


Contributed by Zoren on 24 December 2006 05:38 AM

is RETURNING really a valid word along with RETURNS?

Contributed by xHDErhLMiWSpZbUHwx on 1 June 2008 09:46 AM

doors.txt;10;15

Contributed by Magda on 3 September 2012 01:00 AM

With the bases ldoaed you struck us out with that answer!

Contributed by cheap backlinks on 18 July 2014 06:16 PM

eOvJ5D Wow, great article post.Really thank you! Great.

Contributed by crorkz linkz on 2 August 2014 03:46 AM

OdVQZL Muchos Gracias for your blog article. Really Great.

Contributed by crorkz on 17 December 2014 02:30 PM

SgdLFi Very good blog article.Really looking forward to read more. Cool.

Contributed by crorkz on 16 January 2015 04:53 AM

ftrKBB I have been reading out some of your articles and i must say nice stuff. I will definitely bookmark your blog.

Contributed by crorkzz backz on 5 February 2015 06:54 PM

KosEay Very nice post. I just stumbled upon your blog and wished to say that I\'ve truly enjoyed surfing around your blog posts. In any case I\'ll be subscribing to your feed and I hope you write again soon!

Contributed by crork alise on 6 March 2015 11:33 PM

AHfdjz This website online is known as a stroll-via for the entire info you needed about this and didn\'t know who to ask. Glimpse right here, and you\'ll positively discover it.

Contributed by crork alise on 7 March 2015 11:44 AM

aScwas Hello! Would you mind if I share your blog with my myspace group? There\'s a lot of people that I think would really appreciate your content. Please let me know. Many thanks

Contributed by crorkz on 7 April 2015 10:32 AM

AJ0VEO Well I definitely enjoyed reading it. This information provided by you is very useful for proper planning.

Contributed by crorkservice on fiverr on 6 May 2015 07:28 AM

crwoiU I\'m so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that\'s at the other blogs. Appreciate your sharing this greatest doc.

Contributed by nick crorkz on 30 May 2015 12:49 PM

Xu1QPn I\'m not sure why but this web site is loading incredibly slow for me. Is anyone else having this issue or is it a issue on my end? I\'ll check back later on and see if the problem still exists.

Contributed by jonn3 on 4 June 2015 10:32 PM

\"Very efficiently written information. It will be helpful to anyone who usess it, together with myself.\"

Contributed by Shanghai Escort on 9 June 2015 06:05 PM

\"When i visit a blog, chances are that i get disappointed. Regarding your blog,I have to say that you have done a good job here.\"

Contributed by Workouts and diets or visit home page on 9 June 2015 06:47 PM

\"I cannot subscribe to your rss feed for some reason. I�m using google reader by the way.\"

Contributed by legal steroids on 13 June 2015 02:49 PM

\"Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful info. Thanks for the post. I�ll certainly return.\"

Contributed by Vapage coupon code on 25 June 2015 08:56 AM

\"When i visit a blog, chances are that i get disappointed. Regarding your blog,I have to say that you have done a good job here.\"

Contributed by Energy Efficiency in Buildings on 25 June 2015 09:21 AM

\"Just saying thanks will not just be sufficient, for the tremendous lucidity in your writing. I will right away grab your rss feed to stay abreast of any updates.\"

Contributed by Testosterone Booster on 30 June 2015 12:33 AM

\"Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I�ll be subscribing to your feed and I hope you write again soon!\"

Contributed by Testosterone Booster on 30 June 2015 03:45 AM

\"You really make it seem so simple with your presentation but I find this topic before really hard to understand. It seems too complicated and very broad for me. I am looking forward for your next post.\"

Contributed by light boxes on 1 July 2015 08:53 AM

\"I cannot subscribe to your rss feed for some reason. I�m using google reader by the way.\"

Contributed by crorkzz on 1 July 2015 04:04 PM

UusMhX I really liked your post. Really Cool.

Contributed by where to buy phd degree on 2 July 2015 08:47 PM

\"Great stuff from you, man. Ive read your stuff before and youre just too awesome. I love what youve got here, love what youre saying and the way you say it. You make it entertaining and you still manage to keep it smart. I cant wait to read more from you. This is really a great blog.\"


Extend this topic - Post a comment

Your name:
Your comment:
This post is plain text
This post is html formatted