简体   繁体   中英

How to use Oracle stored procedures with Scala Anorm in Playframework

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM