dimanche 3 juillet 2016

Parse out parmeters from groovy sql

I am calling a stored procedure using groovy sql to fetch the output result set and output parameters. Below is my high level code. When i am trying to print my output parameter,I am not getting the output as a readable object. Any thoughts on how can I parse the output parameter.

def params = [
        Sql.INTEGER(500), //input parm to stored proc
        Sql.SMALLINT(1),  //input parm to stored proc
        Sql.INTEGER       //output parm to stored proc
    ]
def sqlCall = "{CALL SP1234(?,?,?)}" //prepare stored proc call statement
List<GroovyRowResult> rows = sql.execute(sqlCall, params) //invoke stored proc

for (GroovyRowResult rs : rows) {
//logic to iterate result set - able to get output records
}

println "params1 "+params[2].value //expecting integer output from stored proc but not able to get the output value
println "params2 "+params.get(2) //expecting integer value from store proc output but getting a data not in readable format.

Aucun commentaire:

Enregistrer un commentaire