I guess you should do: "...values (${row.ID}, ${row.Name})

The curly brackets...


Am 27.07.2016 um 12:57 schrieb GroovyBeginner:
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: 
http://groovy.329449.n5.nabble.com/Oracle-Insert-Data-from-one-table-to-another-table-using-Groovy-tp5734285p5734303.html
Sent from the Groovy Dev mailing list archive at Nabble.com.


--

*Michael Tetzlaff*
Developer
tetzl...@skillsoftware.de

Office: +49 69 153 2282 22
Mobil: +49 177 3000 633

Skill Software GmbH
Berger Straße 179-181
60385 Frankfurt
http://www.skillsoftware.de

*Sieger Telekom-Innovationspreis 2012*

Skill Software GmbH, Sitz: 60385 Frankfurt
Geschäftsführer: Edgar Reh, Klaus Szilvas
Amtsgericht Frankfurt am Main, HRB 33988
Umsatzsteuer-ID: DE 114211536

Reply via email to