NHibernate 如何调用带 schema 前缀的 Oracle 存储过程?

发布于 2024-09-11 03:30:01 字数 320 浏览 4 评论 0原文

我现在有 NHibernate 调用 Oracle 中的存储过程。但是,如何在标记的 {call} 语法中指定架构前缀?

我尝试过,

<sql-query name="my_sproc">
<return class="my_sproc_class" />
    {call schema2.my_sproc (:p1)}
</sql-query>

但 NHibernate 运行时返回时未定义“schema2”,而“schema2”是我的 Oracle 数据库上明确定义的架构。

谢谢。

I have NHibernate calling stored procedure in Oracle working currently. However, how do I specify a schema prefix in the {call} syntax in the tag?

I tried

<sql-query name="my_sproc">
<return class="my_sproc_class" />
    {call schema2.my_sproc (:p1)}
</sql-query>

But NHibernate run-time came back with 'schema2' not defined while 'schema2' is a definitely defined schema on my Oracle db.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别想她 2024-09-18 03:30:01

难道是特权?该过程可能存在于该架构中,但您可能没有执行它的权限,或者您可能通过未启用的角色拥有权限。

可能是参数。如果该过程需要两个参数(或者是一个函数),那么尝试用一个参数调用它可能会出现“不存在”错误,而实际上它意味着“我无法仅用一个参数调用它”。

最后一个选项是您的架构中有一个与其他架构同名的包。可能会发生在像“UTILS”这样的通用事物上。如果您要求 Oracle 执行 UTILS.PROC 并且您有一个 UTILS 包,那么它会在该包中查找,如果没有找到它,则抛出一个错误,即使存在带有过程 PROC 的 UTILS 模式。


编辑添加

在这种情况下,我倾向于参数问题
此处的示例似乎使用 ?作为参数占位符。

Could it be privileges ? The procedure may exist in that schema but you may not have privileges to execute it, or you may have privileges through a role that isn't enabled.

Could be parameters. If the procedure expects two parameters (or is a function) then trying to call it with one can get a "Doesn't exist" error when it really means "There isn't one I can call with just one parameter".

Final option is if you have a package in your schema with the same name as the other schema. Can happen with something generic like 'UTILS'. If you ask Oracle to execute UTILS.PROC and you have a UTILS package, then it will look in the package and throw an error if it doesn't find it, even if there is a UTILS schema with a procedure PROC.


Edited to add

In that case, I'm leaning towards a parameters issue
The example here seems to use ? as the parameter placeholder.

意中人 2024-09-18 03:30:01

我可能在这里弄错了,但我认为 NHibernate 要求所有 UDF/SPROCS 都以“dbo”为前缀; {call dbo.schema2.my_sproc (:p1)} 有效吗?

I could be mistaken here, but I thought that NHibernate requires all UDFs/SPROCS to be prefixed with "dbo"; does {call dbo.schema2.my_sproc (:p1)} work?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文