【问题标题】:scala anorm and mysqlscala异常和mysql
【发布时间】:2016-04-10 10:04:04
【问题描述】:

我想通过使用 mysql 存储过程和 scala play2 异常来读取表的所有记录。

流程如下:-

create or replace procedure readAllUsers(p_cur sys_refcursor) as
begin
   open p_cur for select * from users;
end;

您的热心帮助非常感激。

【问题讨论】:

    标签: scala playframework anorm


    【解决方案1】:

    使用原始 sql 命令,您可以在 anorm 中调用存储过程。 直接来自documentation 示例:

    SQL("EXEC readAllUsers").execute()
    

    【讨论】:

    • @AsaithambiR 我的回答中的 sn-p 是执行存储过程的异常代码。你到底错过了什么?
    • 我需要从 mysql 存储过程中获取结果集,该存储过程以 refcursor 作为输出参数。
    • 有没有可能使用异常读取存储过程的输出参数。
    • 对于 Anorm,只要结果是一组行(不是更新),语句是 SELECT ... 还是 EXEC proc 就没有区别。然后回到 Anorm 的基础知识,documentation of how to parse result 是最合适的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2018-03-18
    • 2011-11-07
    • 2014-02-01
    • 2013-12-30
    • 2021-12-07
    • 2020-08-13
    相关资源
    最近更新 更多