Reputation: 378
i want to create this view in oracle but it doesn't work
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
the select works fine and I want to create a view based on it. the equivalent of this code works on SQL server is there a rule that says you can't create a view based on select from dual thanks.
Upvotes: 0
Views: 2340
Reputation: 2615
there're no problems in your code see log of the scipt in SQLPlus
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>
Upvotes: 3