首页 文章

在对象表上授予select后ORA-00904错误

提问于
浏览
0

我在Oracle授予对象表选择权时遇到问题 .

创建表格时

create table t (name char, ...)

然后我没有任何问题将任何权限授予任何用户 .

但是当从一个对象创建表时

create or replace 
type type_client under type_personne (
   num int ,
   username varchar(30),
   balance int,
   ta table_achat,
   ref_admin ref type_admin,

   member function get_prix_achat_total return int
);

create table t of type_client

我尝试将其选择为 user1 ,但是当我从 user1 连接并尝试从该表中选择任何数据时:

select * from system.table_client

我看到了这样的信息:

ORA-00904 ::无效标识符00904. 00000 - “%s:无效标识符”*原因:*操作:行错误:1列:34

有时我看到这样的信息:

内部错误:未知或未实现的访问者类型:9

1 回答

  • 1

    好像你的 Select 查询不是 correct . 你可以这样做:

    SQL> show user
    USER is "SCOTT"
    
    SQL> CREATE TYPE emp_type AS OBJECT (
      2    eno     NUMBER,
      3    ename   VARCHAR2(36));
      4  /
    
    Type created.
    
    SQL> CREATE TABLE emp_tp OF emp_type;
    
    Table created.
    
    SQL> GRANT SELECT on emp_tp TO system ;
    
    Grant succeeded.
    
    SQL> connect
    Enter user-name: system
    Enter password: ****
    Connected.
    
    SQL> show user
    USER is "SYSTEM"
    
    SQL> Select * from scott.emp_tp;--<--Make sure you put schema name before table name
    
    no rows selected
    
    SQL>
    

    编辑:

    正如我的评论中所提到的,对象定义也具有 member 函数 . 所以如果你做 Select tb.get_prix_achat_total() from t tb ,它应该返回结果 . 当定义中有任何功能时,您必须使用列名代替 * .

相关问题