Actually this is what I tried in the first place. Ultimately I would like 
to execute the query as a transaction.

Unfortunately I get the exact same error when using the code you suggested:
java.lang.ClassCastException: 
com.orientechnologies.orient.core.sql.filter.OSQLFilterItemVariable cannot 
be cast to java.lang.Number

Looking at the error message, I think I would need a way to extract the 
integer value of the "count" column from the first row of the result set. I 
couldn't find any information on how to achieve this yet.

On Sunday, May 17, 2015 at 3:20:20 PM UTC+2, Izzet Pembeci wrote:
>
> Did you try using the BATCH 
> <http://orientdb.com/docs/2.0/orientdb.wiki/SQL-batch.html> mode? 
> Something like this may work:
>
> begin
> let cnt = SELECT count(*) from containerUPDATE container INCREMENT position = 
> $cntcommit retry 100
>
>
> iZzeT
>
> On Saturday, May 16, 2015 at 5:41:00 PM UTC+3, Jonathan Kienzle wrote:
>>
>> Hello,
>>
>> I'm looking for a way to use the result of a count sub query as the 
>> argument to an update increment statement.
>> What I currently have is a query like this:
>>
>> UPDATE container INCREMENT position = (SELECT count(*) from container)
>>
>> Unfortunately it leads to the following error:
>> java.lang.ClassCastException: 
>> com.orientechnologies.orient.core.sql.filter.OSQLFilterItemField cannot be 
>> cast to java.lang.Number
>>
>> I'm using OrientDB 2.0.8.
>> Any ideas on how I could use a sub query count result inside an increment 
>> statement?
>>
>> Best regards,
>> Jonathan
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to