December 2010
Intermediate to advanced
451 pages
11h 16m
English
You are writing a Groovy program and want to call some PL/SQL stored procedures or functions from it.
Use GroovySQL to establish a database connection, and make the call to the PL/SQL stored program. For example, here's how you would use of GroovySQL to connect to an Oracle Database and call a PL/SQL function:
import groovy.sql.Sql
import oracle.jdbc.driver.OracleTypes
Sql sql = Sql.newInstance("jdbc:oracle:thin:@hostname:1521:dbname",
"username","password","oracle.jdbc.driver.OracleDriver")
dept_id = 50
sql.call('{? = call calc_quarter_hour(?)}', [Sql.DOUBLE, 6.35]) { qtr_hour->
println qtr_hour
}
Short and to the point, the Groovy script in this example connects to an Oracle Database, ...
Read now
Unlock full access