Re: Oracle Insert Data from one table to another table using Groovy

2016-07-28 Thread GroovyBeginner
Thanks !! It worked -- View this message in context: http://groovy.329449.n5.nabble.com/Oracle-Insert-Data-from-one-table-to-another-table-using-Groovy-tp5734285p5734338.html Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-28 Thread Dinko Srkoč
Result is probably being displayed as null because `forEach` method in fact returns `void`, which Groovy transforms into `null`, as it expects a method to actually return something. As for nothing being inserted, perhaps there is nothing to insert (every ID in A is also in B)? Cheers, Dinko On 2

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-27 Thread Michael Tetzlaff
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

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-27 Thread 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:@lo

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread Russel Winder
It does seem a pity that Groovy only provides drivers of SQL statements when Groovy is a language superb for DSLs and builders. Python is very similar to Groovy in this respect and Python has SQLAlchemy which provides the low level SQL driving stuff, but also provides an expression language, DSL a

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread Dinko Srkoč
On 26 July 2016 at 15:47, GroovyBeginner wrote: > I tried this and facing the following issue > > groovy.lang.MissingPropertyException: No such property: ID for class: > oracle.jdbc.driver.OracleResultSetImpl I'm only guessing here because I can't run the code at the moment and I'd always avoided

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread GroovyBeginner
I tried this and facing the following issue groovy.lang.MissingPropertyException: No such property: ID for class: oracle.jdbc.driver.OracleResultSetImpl Possible solutions: row at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codeh

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread ngalarneau
The notation $row is for use inside a string (called string interpolation). Try changing your sql.executeInsert line to: sql.executeInsert "INSERT INTO A (ID, Name) VALUES ($row.ID,$row.Name)" See: http://docs.groovy-lang.org/latest/html/documentation/index.html#_string_interpolation

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread Jochen Theodorou
On 26.07.2016 08:46, GroovyBeginner wrote: I have a requirement of inserting the data from table A into table B and am using Oracle database. My condition is am going to insert only those records which are not present in table B and am facing an issue of retrieving the current row column values