How to use Oracle stored procedures with Scala Ano

2019-07-04 06:39发布

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条回答
疯言疯语
2楼-- · 2019-07-04 06:59

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.

查看更多
登录 后发表回答