0

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.

2
  • This should work fine. What error you are getting while creating it ? Commented Nov 27, 2015 at 10:08
  • 4
    "doesn't work" is not a standard Oracle error. Post the error. And do not tag plsql, as it is not related to plsql. Commented Nov 27, 2015 at 10:24

1 Answer 1

3

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> 
Sign up to request clarification or add additional context in comments.

3 Comments

it's odd i'm working with toad for oracle i tried this code a multiple of times and it always gives me this error [Error] Execution (36: 30): ORA-00604: une erreur s'est produite au niveau SQL récursif 1 ORA-01801: format date trop grand par rapport à la mémoire tampon interne ORA-06512: à ligne 2
@essanousy It is impossible to get those two ORA errors with the code you have posted. Either you are obfuscating the code, or the error comes from somewhere else.
I'm thinking about Unicode symbols. Can your confirm that your code is exactly as you provided and has no unicode symbols?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.