In my jenkinsfile when i executing the below sql statement and returning the returnStatus , whether sql statement pass or fail it always returns "0"
def user_code= sh(script: """sqlplus "a/b/c/test.sql" """, returnStatus: true)
if ( "${user_code}" != "0") {
error("sql statement failed with status code ${user_code}")
} else {
println "successfull"
}
}
I referred to this page Sql*plus always returns exit code 0? where it suggest to handle this in SQL Query but i have limitation, I have to implement it in Jenkinsfile.
- I have tried returnStdout: true as well but it throw junk of output.
Can someone please suggest how i can handle this in jenkinsfile.