On Monday, July 14, 2014 5:13:26 AM UTC-7, Roger Thomas wrote:
>
> H2 does not currently support cursors, but it does support variables so 
> rather than use a subselect you could write your example as
>
> SET @average = SELECT avg(i)  FROM table(i int = (1,2,3,4));
> SELECT i - @average AS result FROM table (i int = (1,2,3,4));
>
> For any large data set this should be a lot faster as it stops the 
> re-processing of the subselect, but on a mult-user system will need to be 
> run within a transaction, otherwise data in the table may change between 
> statements.
>

Nice, thanks. How does this stop re-processing of the subselect?

I guess variables can only be scalars and arrays, not result sets.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to