I have some knowledge about SQL but a complete novice in Oracle. The following sql statement will execute properly in SQL Server. But this doesn't execute in Oracle and throws an error.
select Field1, * from Table1 where SomeField = 0
Please let know how to execute a similar statement in Oracle. The error recieved is as follows:
ORA-00936: missing expression
00936. 00000 - "missing expression"
Orangecrush
1,9902 gold badges15 silver badges26 bronze badges
asked Feb 1, 2013 at 13:48
Unni Kris
3,1034 gold badges39 silver badges58 bronze badges
-
I deleted my answer almost immed. because I noticed I made an error-missed an alias. It happens sometimes when you rush... I do not know why you was able to see my answer.Art– Art2013年02月01日 14:17:53 +00:00Commented Feb 1, 2013 at 14:17
2 Answers 2
Try,
select Field1, a.* from Table1 a where SomeField = 0;
answered Feb 1, 2013 at 13:50
Orangecrush
1,9902 gold badges15 silver badges26 bronze badges
Sign up to request clarification or add additional context in comments.
6 Comments
Álvaro González
You can also use the table name as prefix, no need to alias.
veljasije
For better readability, it is desirable to make table aliases with an AS key word, for example: Table1 AS a.
Orangecrush
@ÁlvaroG.Vicario That will work too. Many different ways of tacking the same problem.
veljasije
I agree, just to mention :) I prefer "AS" because my editor recognize key words, and color them, nothing more.
Florin Ghita
@veljasije you're confusing column aliasing with table aliasing. Table aliasing does not permit "AS" keyword in Oracle.
|
Simply try:
select Field1, Table1.* from Table1 where SomeField = 0
answered Feb 1, 2013 at 13:56
Vishal Suthar
17.3k4 gold badges64 silver badges109 bronze badges
Comments
lang-sql