java没有方法的签名:groovy。sql。Sql。callWithAllRows()适用于参数类型
我正在通过groovy方法groovy调用一个sql存储过程。sql。Sql。callWithAllRows,它不需要参数,只返回结果集。但是,在发出以下方法时,由于“没有方法的签名:groovy.sql.sql.callWithAllRows()适用于参数类型”而失败,我假设您可以在不发送参数的情况下调用WithAllRows,因为存储过程不需要这些参数,这对吗
以下是失败的呼叫:
List<List<GroovyRowResult>> results = sql.callWithAllRows("{call
myStoredProcedure()}",[],{});
results.each { result ->
result.each { row ->
row.each {
println(it.FormalName.toString())
}
}
}
我的存储过程
CREATE PROCEDURE myStoredProcedure
AS
BEGIN
SELECT TOP 10 Title + ' ' + FirstName + ' ' + LastName AS FormalName
FROM Person.Contact
END
# 1 楼答案
正确的语法是
以下是参考:http://docs.groovy-lang.org/latest/html/gapi/groovy/sql/Sql.html#callWithAllRows(java.lang.String,%20List%3CObject%3E,%20groovy.lang.Closure)