You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Avinash Nanda <av...@gmail.com> on 2018/05/10 15:48:57 UTC

Question: Updating a database table

Hi All,

This is my first post here,I am using groovy 2.4.13

Problem: I need to update a value in the oracle database for large
table(754508 records)

Error: Max cursors exceeded

Here is a same code i am using

selectQuery = "select stament goes here"
updateQuery = "Update query with parameters"

sql.row(selectQuery).each{it ->
             sql.execute(updateQuery, [it.name])}
sql.close()

This throws max cursors exceeded and i dont know how to resolve it. Any
help would be appreciated.

Also let me know if there is any additional information is needed.

-- 
Regards
Avi

Re: Question: Updating a database table

Posted by MG <mg...@arscreat.com>.
final Sql sql = ...
sql.setEnableMetaDataChecking(false)

(Also see the comment by Saravanan Subiramaniam at the end of the 
comments section; have not tried this myself...)

Cheers,
mg


On 10.05.2018 18:15, Avinash Nanda wrote:
> Unfortunately i couldnt combine the queries as i have logic which 
> determines what data to update.
>
> Also i tried looking at the below link but could know where i need to 
> update the flag:
> https://issues.apache.org/jira/browse/GROOVY-8397?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=16273333#comment-16273333 
> <https://issues.apache.org/jira/browse/GROOVY-8397?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=16273333#comment-16273333>
>
> Sorry i tried googling around the issue but didnt find anything relavent
>
> On Thu, May 10, 2018 at 12:08 PM, Daniel.Sun <sunlan@apache.org 
> <ma...@apache.org>> wrote:
>
>     Hi Avinash,
>
>     FYI,
>     https://issues.apache.org/jira/browse/GROOVY-8397?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=16273333#comment-16273333
>     <https://issues.apache.org/jira/browse/GROOVY-8397?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=16273333#comment-16273333>
>     https://stackoverflow.com/questions/12192592/java-sql-sqlexception-ora-01000-maximum-open-cursors-exceeded
>     <https://stackoverflow.com/questions/12192592/java-sql-sqlexception-ora-01000-maximum-open-cursors-exceeded>
>
>     In addition, I suggest you try to combine update statement and select
>     statement and execute only one statement, or write an anonymous block
>     `BEGIN...END` to finish your query and update.
>
>     Cheers,
>     Daniel.Sun
>
>
>
>     --
>     Sent from:
>     http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>     <http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html>
>
>
>
>
> -- 
> Regards
> Avinash


Re: Question: Updating a database table

Posted by Avinash Nanda <av...@gmail.com>.
Unfortunately i couldnt combine the queries as i have logic which
determines what data to update.

Also i tried looking at the below link but could know where i need to
update the flag:
https://issues.apache.org/jira/browse/GROOVY-8397?page=
com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&
focusedCommentId=16273333#comment-16273333

Sorry i tried googling around the issue but didnt find anything relavent

On Thu, May 10, 2018 at 12:08 PM, Daniel.Sun <su...@apache.org> wrote:

> Hi Avinash,
>
> FYI,
> https://issues.apache.org/jira/browse/GROOVY-8397?page=
> com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&
> focusedCommentId=16273333#comment-16273333
> https://stackoverflow.com/questions/12192592/java-sql-
> sqlexception-ora-01000-maximum-open-cursors-exceeded
>
> In addition, I suggest you try to combine update statement  and select
> statement and execute only one statement, or write an anonymous block
> `BEGIN...END` to finish your query and update.
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>



-- 
Regards
Avinash

Re: Question: Updating a database table

Posted by "Daniel.Sun" <su...@apache.org>.
Hi Avinash,

FYI, 
https://issues.apache.org/jira/browse/GROOVY-8397?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=16273333#comment-16273333
https://stackoverflow.com/questions/12192592/java-sql-sqlexception-ora-01000-maximum-open-cursors-exceeded

In addition, I suggest you try to combine update statement  and select
statement and execute only one statement, or write an anonymous block
`BEGIN...END` to finish your query and update.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html