如何在Playframework中将Oracle存储过程与Scala Anorm一起使用 [英] How to use Oracle stored procedures with Scala Anorm in Playframework

查看:84
本文介绍了如何在Playframework中将Oracle存储过程与Scala Anorm一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多存储过程,其结果是字符串列表

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

如何在带有scala的play 2.0 Framework中访问refcurser?

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?

我尝试过:

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 *)
}

}

但这对我不起作用

预先感谢

甚至可以从存储过程中填充列表吗?

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

推荐答案

字符串列表将对应于oracle用户定义的对象.我希望那是你的意思. 可能的解决方案是 1)首先映射oracle集合对象,然后在scala代码中使用 或者 2)从存储的proc而不是collection中返回一个ref游标.

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.

这篇关于如何在Playframework中将Oracle存储过程与Scala Anorm一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆