2

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
1
  • 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. Commented Feb 1, 2013 at 14:17

2 Answers 2

5

Try,

select Field1, a.* from Table1 a where SomeField = 0;
answered Feb 1, 2013 at 13:50
Sign up to request clarification or add additional context in comments.

6 Comments

You can also use the table name as prefix, no need to alias.
For better readability, it is desirable to make table aliases with an AS key word, for example: Table1 AS a.
@ÁlvaroG.Vicario That will work too. Many different ways of tacking the same problem.
I agree, just to mention :) I prefer "AS" because my editor recognize key words, and color them, nothing more.
@veljasije you're confusing column aliasing with table aliasing. Table aliasing does not permit "AS" keyword in Oracle.
|
1

Simply try:

select Field1, Table1.* from Table1 where SomeField = 0
answered Feb 1, 2013 at 13:56

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.