Subject | Re: [firebird-support] Order of rows returned by stored procedures |
---|---|
Author | Josef Kokeš |
Post date | 2011-12-08T07:30:07Z |
> >It's been my experience that if I have a stored procedure which returns*Returned* is obvious. But if I *read* these returned rows and output
> >rows in a particular order and perform a SELECT on this procedure, the
> >row order of the SELECT matches that of the procedure. E.g.:
> >
> >What I would like to know, is this behavior documented or is it just a
> >random occurence? I know that when SELECTing from tables/views I should
> >always use ORDER BY if I need the records sorted in a particular order,
> >but is the same thing true for selecting from stored procedures?
>
> Rows are returned in the exact order they are sent, i.e., the first
> SUSPEND sends the first row to the buffer, the second SUSPEND sends the
> second row, and so on.
them again, is it a documented behavior that the output will reflect the
ordering from the stored procedure?
> It is much more efficient to have your SSP work with an ordered set, asOf course. But that's not the issue here. The issue is, if my procedure
> the FOR SELECT inside the SP can use indexes. Ordering the set of
> virtual output is a sloooooow process and of course there are no indexes
> to call on.
returns a growing sequence, can I depend on it always being growing or
should I make sure by an explicit order outside of the procedure?
Thanks,
Pepa