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

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 !!

No reply so far ? Am I missing something here ?

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)
    cs.execute()
    val result = cs.getString(1)
    ....
}

Posted same on my SO question.

1 Like