-3
 def aa=colarray.join(',')
                        println aa
                        sql.eachRow("select col01,$aa from read_csv where col01=? and col${usercol}!=? ", [file.name,""])


                    }

i was trying to save the col name into the colarray and call it in select statment, but i get erro like following

URI /racetrack/readUserRole/index

Class groovy.lang.MissingMethodException

Message No signature of method: groovy.sql.Sql.eachRow() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, java.util.ArrayList) values:

[select col01,col03,col04,col05,col06,col07,col08,col09,col10,col11,col12,col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25,col26,col27,col28,col29,col30,col31,col32,col33 from read_csv where col01=? and col02!=? , ...]

Possible solutions: eachRow(groovy.lang.GString, groovy.lang.Closure), eachRow(java.lang.String, groovy.lang.Closure), eachRow(groovy.lang.GString, groovy.lang.Closure, groovy.lang.Closure), eachRow(java.lang.String, groovy.lang.Closure, groovy.lang.Closure), eachRow(java.lang.String, java.util.List, groovy.lang.Closure), eachRow(java.lang.String, java.util.Map, groovy.lang.Closure)

so how should i fix it??? thx

tim_yates
  • 167,322
  • 27
  • 342
  • 338
Long Chen
  • 11
  • 5

1 Answers1

0

Maybe just try to change:

sql.eachRow("select col01,$aa from read_csv where col01=? and col${usercol}!=? ", [file.name,""])

to:

sql.eachRow("select col01,$aa from read_csv where col01=? and col${usercol}!=?".toString(), [file.name,""])
Opal
  • 81,889
  • 28
  • 189
  • 210