calling function in groovy

To call sql function in groovy

def encryptAccountInformation(number1, keyId) {
def encryptedValue
Sql sql = null
try{
if (accNumber && keyId){
sql = new Sql(dataSource)
sql.call("{? = call TEST_FN_XYZ(?,?)}",[
Sql.VARCHAR,
accNumber,
keyId
]){ result -> encryptedValue = result }
}
} catch (Exception e){
log.error( "Error getting Encryption data " + e)
} finally{
if(sql) sql.close()
}
return encryptedValue
}

Comments

Popular posts from this blog

Conversion from Clob To String in java and Vice versa

Portable Java 8/ JDK8 setup without admin rights

Multi Threading , Producer consumer problem in Java