How to use Oracle stored procedures with Scala Anorm in Playframework

江枫思渺然 提交于 2019-12-23 18:45:47

问题


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.



来源:https://stackoverflow.com/questions/15250734/how-to-use-oracle-stored-procedures-with-scala-anorm-in-playframework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!