gpt4 book ai didi

sql - ORA-00942:表或 View 不存在(当使用单独的sql时有效,但在oracle函数中不起作用)

转载 作者:行者123 更新时间:2023-12-03 10:49:00 31 4
gpt4 key购买 nike

当我有一个像select * from table1这样的sql语句时,它很好用,但是一旦将其放入函数中,我就会得到:

ORA-00942: table or view does not exist 

如何解决呢?

最佳答案

您可以看几件事。根据您的问题,函数所有者似乎与表所有者不同。

1)通过角色授予:为了在另一个用户的对象上创建存储过程和函数,您需要直接访问对象(而不是通过角色进行访问)。

2)

By default, stored procedures and SQL methods execute with the privileges of their owner, not their current user.



如果在Schema A中创建了一个表,在Schema B中创建了该功能,则应查看Oracle的Invoker / Definer Rights概念,以了解可能引起此问题的原因。

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/subprograms.htm#LNPLS00809

关于sql - ORA-00942:表或 View 不存在(当使用单独的sql时有效,但在oracle函数中不起作用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6669575/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com