具有授予选择/插入权限的视图

发布于 2024-11-06 09:00:40 字数 379 浏览 7 评论 0原文

我在大学里使用 Oracle9i 服务器。

我已授予我的朋友对视图的选择和插入权限 'v1'

他能够在视图上选择插入,但显然,当他插入一行时,视图会为其用户ID维护一个单独的副本。

IE。当我说:

select * from v1;

我看不到他插入到视图 'v1' 中的行。这是默认行为吗?我不应该能够看到他插入的行吗,因为它仍然归我所有?

我是新手,所以我想我不知道有关视图和授予权限的一些概念。

I'm working on an Oracle9i server in college.

I have granted my friend select and insert permissions on a view 'v1'.

He is able to select and insert on the view,but apparently the view maintains a separate copy for his userid when he inserts a row.

ie. when I say:

select * from v1;

I'm not able to see the row he inserted into view 'v1'.Is this the default behaviour?Shouldn't I be able to see the row what he inserted because its still owned by me?

I'm a newbie so I think I'm not aware of some of the concepts with regards to views and granting permissions.

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

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

发布评论

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

评论(1

滥情稳全场 2024-11-13 09:00:40

如果其他用户实际上正在插入满足视图条件的行并且其他用户正在提交他的事务,那么您将能够在会话中看到该行。

  • 您确定其他用户实际上正在使用与您相同的对象吗?他或她所指的 V1 是否有可能与您所指的 V1 不同?你们都使用完全限定的对象名称(即SELECT * FROM Pavitar.v1)吗?
  • 您确定另一个用户在执行 INSERT 后实际上正在提交他的事务吗?
  • 您确定要插入的行符合视图的条件吗?

例如,如果我创建一个视图 EMP_VIEW,它返回 EMP 表中 DEPTNO 为 10 的所有数据,我可以将一行插入到通过 DEPTNO 不为 10 的视图的 EMP 表。

SQL> create or replace view emp_view
  2  as
  3  select *
  4    from emp
  5   where deptno=10;

View created.

SQL> insert into emp_view( empno, ename, job )
  2    values( 7623, 'PAV', 'Dev' );

1 row created.

因此,如果我查询视图,我将看不到该行

SQL> select empno, ename, job
  2    from emp_view;

     EMPNO ENAME      JOB
---------- ---------- ---------
      7782 CLARK      MANAGER
      7839 KING       PRESIDENT
      7934 MILLER     CLERK

,但我会在底层看到它桌子

  1  select empno, ename, job
  2*   from emp
SQL> /

     EMPNO ENAME      JOB
---------- ---------- ---------
      7623 PAV        Dev
      7369 smith      CLERK
      7499 ALLEN      SALESMAN
      7521 WARD       SALESMAN
      7566 JONES      MANAGER
      7654 MARTIN     SALESMAN
      7698 BLAKE      MANAGER
      7782 CLARK      MANAGER
      7788 SCOTT      ANALYST
      7839 KING       PRESIDENT
      7844 TURNER     SALESMAN
      7876 ADAMS      CLERK
      7900 SM0        CLERK
      7902 FORD       ANALYST
      7934 MILLER     CLERK
      1234 FOO

16 rows selected.

If the other user is actually inserting a row that meets the criteria of the view and the other user is committing his transaction, then you would be able to see the row in your session.

  • Are you certain that the other user is actually using the same object that you are? Is there any chance that the V1 he or she is referring to is different than the V1 that you are referring to? Are you both using fully qualified object names (i.e. SELECT * FROM Pavitar.v1)
  • Are you certain that the other user is actually committing his transaction after doing the INSERT?
  • Are you certain that the row that is being inserted meets the criteria of the view?

For example, if I create a view EMP_VIEW that returns all data from the EMP table where the DEPTNO is 10, I can insert a row into the EMP table via the view that does not have a DEPTNO of 10.

SQL> create or replace view emp_view
  2  as
  3  select *
  4    from emp
  5   where deptno=10;

View created.

SQL> insert into emp_view( empno, ename, job )
  2    values( 7623, 'PAV', 'Dev' );

1 row created.

So I won't see the row if I query the view

SQL> select empno, ename, job
  2    from emp_view;

     EMPNO ENAME      JOB
---------- ---------- ---------
      7782 CLARK      MANAGER
      7839 KING       PRESIDENT
      7934 MILLER     CLERK

But I will see it in the underlying table

  1  select empno, ename, job
  2*   from emp
SQL> /

     EMPNO ENAME      JOB
---------- ---------- ---------
      7623 PAV        Dev
      7369 smith      CLERK
      7499 ALLEN      SALESMAN
      7521 WARD       SALESMAN
      7566 JONES      MANAGER
      7654 MARTIN     SALESMAN
      7698 BLAKE      MANAGER
      7782 CLARK      MANAGER
      7788 SCOTT      ANALYST
      7839 KING       PRESIDENT
      7844 TURNER     SALESMAN
      7876 ADAMS      CLERK
      7900 SM0        CLERK
      7902 FORD       ANALYST
      7934 MILLER     CLERK
      1234 FOO

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