PL/SQL (MOSC)

MOSC Banner

Query Issues

edited Dec 15, 2010 5:42AM in PL/SQL (MOSC) 12 commentsAnswered ✓
 Can anyone explain to me why the first query below does not work but the second one does?  The first one works if I remove the literal (1 as lookup).  Just looking for a little background on why it's failing with a Ora-000936 expression behind the scenes. 

Query 1 - Fails

select
1 as Lookup,
*
from Table1
where ID in (Select subid from Table2)

Query 2 - Works

select
1 as Lookup,
t1.*
from Table1 t1
where t1.ID in (Select subid from Table2)


Note that they both work correctly with Microsoft SQL Server. 

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center