groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalarn...@ABINITIO.COM
Subject Re: Oracle Insert Data from one table to another table using Groovy
Date Tue, 26 Jul 2016 11:54:06 GMT
The notation $row is for use inside a string (called string 

Try changing your sql.executeInsert line to:

        sql.executeInsert "INSERT INTO A (ID, Name) VALUES 


From:   GroovyBeginner <>
Date:   07/26/2016 02:46 AM
Subject:        Oracle Insert Data from one table to another table using 

I have a requirement of inserting the data from table A into table B and 
using Oracle database. My condition is am going to insert only those 
which are not present in table B and am facing an issue of retrieving the
current row column values. Here is the code am trying.

    import groovy.sql.Sql;
    import java.sql.ResultSet;
    import java.util.Properties;
    sql = 
"password", "oracle.jdbc.driver.OracleDriver")
        sql.query("select ID, NAME from A where ID not in (select id from
B)") { 
       row-> while( {
        sql.executeInsert "INSERT INTO A (ID, Name) VALUES ("+$row.ID"+,+"

and am facing issue `No such property: $row`. Kindly suggest me where am
going wrong and also is there any better approach of doing this in terms 
security and performance.

View this message in context:

Sent from the Groovy Dev mailing list archive at

NOTICE from Ab Initio: This email (including any attachments) may contain 
information that is subject to confidentiality obligations or is legally 
privileged, and sender does not waive confidentiality or privilege. If 
received in error, please notify the sender, delete this email, and make 
no further use, disclosure, or distribution. 
View raw message