How to call Stored procedures (e.g. Oracle DB) using Anorm in Play+Scala?


(Nikhil) #1

I am looking for an example specifically on how to access OUT or INOUT param when calling a procedure to RDMS DB. Can’t find anywhere !!

(Nikhil) #2

No reply so far ? Am I missing something here ?

(Nikhil) #3

Seems there is no mechanism to use Anorm for accessing OUT param of stored procedure. On the other hand the connection object can be used directly and the stored procedure can be called using Java libraries. Refer below example code:

dbch.dbprod.withConnection { implicit connection =>
    val cs: CallableStatement = connection.prepareCall("{call MY_STORED_PROC(?)}")
    cs.registerOutParameter(1, Types.VARCHAR)
    val result = cs.getString(1)

Posted same on my SO question.