2

I have the following view with columns:

TYPE    VARCHAR2(10)
NUMER   VARCHAR2(10)

and when I try to select the data, I get the ORA-00936: missing expression error, because the compiler thinks that columns are actually the data types. So, how to select the data from that columns?

diziaq
  • 6,881
  • 16
  • 54
  • 96
Tony
  • 12,405
  • 36
  • 126
  • 226

2 Answers2

2

You should use double quotes in the query -

select "TYPE", "NUMBER"
 from table_name
Stawros
  • 918
  • 1
  • 10
  • 20
  • And I'm curios how could @Tony create table or view with column names he can't query. – diziaq Oct 21 '15 at 09:55
  • @diziaq - the same, way, by having the names quoted in the `create view` statement. – Alex Poole Oct 21 '15 at 10:29
  • @Alex I allude to it. The author says "I have the following view with columns" and this implies he saw the view description. So he could just put the same (quoted) column names into SELECT. – diziaq Oct 21 '15 at 10:33
  • @diziaq I think its gui. In the ide interface you can see TYPE VARCHAR2(10), but column description in the database will be double qouted. – Stawros Oct 21 '15 at 10:39
-1

You tried to execute a SQL statement but you omitted a part of the syntax.

You should use syntax properly SELECT COL1,COL2....COLN FROM TABLE_NAME WHERE COL = CONDITION

darthcoder
  • 17
  • 2