Sql 允许用户从表中进行选择

Sql 允许用户从表中进行选择,sql,oracle,oracle10g,ora-00942,Sql,Oracle,Oracle10g,Ora 00942,cis605的emp表确实存在,我想为用户分配权限。你知道我做错了什么吗 SQL> grant select on emp to user; Grant succeeded. SQL> connect user Enter password: Connected. SQL> select * from emp; select * from emp * ERROR at

cis605的emp表确实存在,我想为用户分配权限。你知道我做错了什么吗

SQL> grant select on emp to user;

     Grant succeeded.

     SQL> connect user
     Enter password:
     Connected.
     SQL> select * from emp;
     select * from emp
                   *
     ERROR at line 1:
     ORA-00942: table or view does not exist
我也尝试过用不同的方式来做

     SQL> connect cis605
     Enter password:
     Connected.
     SQL> grant select on system.emp to chap7;
     grant select on system.emp to chap7
                             *
     ERROR at line 1:
     ORA-00942: table or view does not exist
这是我应该使用的声明


SQL>从cis605.emp中选择*

在第一种情况下,它不起作用,因为您需要:

  • 引用包含其所在架构的表名。i、 e

    从schema.EMP中选择*


  • 2.创建一个[public]同义词,以便能够“查看”表,而不必在每个SQL语句中包含模式


    在第二种情况下,您试图引用模式,但得到了错误的模式。EMP表通常在SCOTT模式中找到,而不是在系统中。但在您的情况下,您可能需要:

    grant select on cis605.emp to chap7;
    

    另外,让一个名为“user”的用户是个坏主意——这是一个Oracle关键字。(虽然我猜这可能只是为了举例)

    可能的重复