Re: [firebird-support] Number list without table
Markus Ostenried wrote: > looks like Sean answered faster than me. And me ;-) > Here's the documentation for what you want (search the page for "Our last > example"): > http://www.firebirdsql.org/refdocs/langrefupd20-execblock.html Ha! Could have referred to that. I admit I was too lazy to give an example in my reply - totally forgot I wrote that one. One thing though, Piotr: if your Firebird client doesn't support input parameters on executable blocks (like isql), you have to write an SP. But this is hardly more work, and it has the additional advantage that, once written, you can call it from any number of places in your code. The executable block would have to be copied over and over again (or included in a programming language function/procedure/macro). Paul Vinkenoog
Re: [firebird-support] Number list without table
On Thu, Jul 25, 2013 at 8:46 PM, Piotr Olszewski < piotr.olszew...@eskrzynka.pl> wrote: > ** > > I need to get list of number (f.e 1,2,3,4,5) as rows but using only SQL > query (without extra table or view). > Hi there, looks like Sean answered faster than me. Here's the documentation for what you want (search the page for "Our last example"): http://www.firebirdsql.org/refdocs/langrefupd20-execblock.html HTH, Markus [Non-text portions of this message have been removed]
Re: [firebird-support] Number list without table
Hi Piotr, > I need to get list of number (f.e 1,2,3,4,5) as rows but using only SQL > query (without extra table or view). > > Something what after running query looks like: > > List_of_numbers > --- > 1 > 2 > 3 > 4 > 5 You can write a selectable stored procedure to achieve that, with the number of rows as a parameter. Or use EXECUTE BLOCK. Cheers, Paul Vinkenoog
RE: [firebird-support] Number list without table
Piotr > I need to get list of number (f.e 1,2,3,4,5) as rows but using only SQL query > (without extra table or view). > > Something what after running query looks like: > > List_of_numbers > > --- > > 1 > 2 > 3 > 4 > 5 > > Any ideas?? > EXECUTE BLOCK ( StartNumber Integer, EndNumber Integer ) RETURNS ( List_of_Numbers Integer ) AS BEGIN List_of_Numbers = StartNumber; WHILE (List_Of_Numbers <= EndNumber) DO BEGIN Suspend; List_Of_Numbers = List_Of_Numbers + 1; END END
[firebird-support] Number list without table
Hi I need to get list of number (f.e 1,2,3,4,5) as rows but using only SQL query (without extra table or view). Something what after running query looks like: List_of_numbers --- 1 2 3 4 5 Any ideas?? Piotr [Non-text portions of this message have been removed]