How to use Oracle stored procedures with Scala Ano

2019-07-04 06:28发布

问题:

I have many stored procedures which have Lists of Strings as result

How can i access the refcurser in the play 2.0 Framework with scala?

Can someone make a simple example how i can fill a list?

I tried this:

case class XXXX(name: String, description: String)


object XXXX{


val simple = {
get[String]("name") ~
get[String]("description") map {
case name~description => XXXX(name, description)
}
}


def all(): List[XXXX] = DB.withConnection { implicit c =>
SQL("""exec PROCEDURE""").as(XXXX.simple *)
}

}

But this is not working for me

thanks in advance

EDIT: Is it even possible to fill a List from a stored procedure?

回答1:

List of strings would correspond to oracle user defined objects. I hope that is what you mean. Possible solutions are 1) First Map the oracle collection object and then use in scala code or 2) return a ref cursor from stored proc instead of collection.

Hope this gives some idea.