1. 程式人生 > >oracle建立和使用檢視

oracle建立和使用檢視

SQL> conn system/111;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS

SQL> grant create view to tudou;

Grant succeeded

SQL> conn tudou/111;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as tudou

SQL> select * from temp1;

NAME                AGE
------------------- ---
土土                22


SQL> create view vw_Name as select name from temp1;

View created

SQL> conn scce/111;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as scce


SQL> select * from vw_Name;

select * from vw_Name

ORA-00942: 表或檢視不存在

SQL> conn tudou/111;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as tudou

SQL> grant select on vw_name to scce;

Grant succeeded

Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as scce

SQL> select * from vw_name;

select * from vw_name

ORA-00942: 表或檢視不存在

SQL> select * from tudou.vw_name;

NAME
-------------------
土土

SQL>