groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GroovyBeginner <>
Subject Re: Oracle Insert Data from one table to another table using Groovy
Date Wed, 27 Jul 2016 10:57:21 GMT
I have tried the following code now and seems to be nothing is being inserted
into the database table. I have executed the following code and the result
is displayed as null.

import groovy.sql.Sql;
import java.sql.ResultSet;
import java.util.Properties;

sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:XE","username",
"password", "oracle.jdbc.driver.OracleDriver")
    sql.eachRow("select ID, NAME from A where ID not in (select id from B)")
{ row-> 
    sql.executeInsert "INSERT INTO A (ID, Name) VALUES ($row.ID,$row.Name)" 

View this message in context:
Sent from the Groovy Dev mailing list archive at

View raw message