如何在oracle中基于双重创建视图?

时间:2015-11-27 10:04:13

标签: sql oracle

我想在oracle中创建此视图,但它不起作用

create view view_E as
SELECT 'value 1' col from dual  UNION  
SELECT 'value 2'  from dual UNION   
SELECT 'value 3'  from dual UNION  
SELECT 'value 4'  from dual 

选择工作正常,我想基于它创建一个视图。 相当于此代码适用于SQL服务器是否存在一条规则,即您无法根据双重感谢选择创建视图。

1 个答案:

答案 0 :(得分:3)

您的代码没有问题 请参阅SQLPlus中的scipt日志

Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0 
Connected as user1

SQL> 
SQL> create or replace view view_E as
  2  SELECT 'value 1' col from dual  UNION
  3  SELECT 'value 2'  from dual UNION
  4  SELECT 'value 3'  from dual UNION
  5  SELECT 'value 4'  from dual;

View created
SQL> /

View created
SQL> select * from view_E
  2  /

COL
-------
value 1
value 2
value 3
value 4

SQL>