Subject | Re: [firebird-support] intermediate messages from a query |
---|---|
Author | Martijn Tonies |
Post date | 2003-09-12T08:42:23Z |
> > > >please look this code:with
> > > >
> > > >create procedure test
> > > >returns
> > > > (cmessage varchar(20)
> > > >as
> > > >begin
> > > > for select id_emp from tb_emp do
> > > > begin
> > > > cmessagge='employee ' || id_per || ' is being processed';
> > > > suspend;
> > > > /*some action*/
> > > > end
> > > >end
> > > >
> > > >only _at the end_ of the query I get the messages _all together_,
> > > >what is completely unuseless to me.
> > > >
> > > >No way to get what I want ?
> > >
> > > Not this way. A stored procedure call is atomic. It can't interact
> > > the client during execution. What your procedure actually does isbuild
> >anthe
> > > output set. If the procedure completes without an exception, you get
> > > output set. If an exception occurs at any point, the procedure willexit
> > > and return the exception -- and there will be no output.loop
> >
> >Shouldn't this procedure start returning before the complete procedure
> >is finished because of the SUSPEND?
>
> Well...yes...it will output that row then recommence /* whatever */ in the
> next line, work through to the end of the loop and then go through the
> again. But it will keep looping like that until it is all done.ok - then we agree. By using SUSPEND this way, you can do a bit of
a progress callback to the client - that is, if you use SELECT to execute
it :-)
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com