Solved

SQL Left Join

Posted on 2008-10-22
11
1,571 Views
Last Modified: 2013-12-07
What's wrong with this SQL statement?

Whenever I try and run it I get an "ORA-00933: SQL command not properly ended" error.

I've tried it with and without the semi-colon at the end.
SELECT *

FROM S_ORG_EXT T1

LEFT JOIN S_ORG_EXT_X T4 ON (T1.row_id = T4.row_id);

Open in new window

0
Comment
Question by:Compmouse
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22777115
the * is not allowed like that:
SELECT T1.*, T4.*
FROM S_ORG_EXT T1
LEFT JOIN S_ORG_EXT_X T4 ON T1.row_id = T4.row_id
;

Open in new window

0
 
LVL 1

Author Comment

by:Compmouse
ID: 22777219
I'm pretty sure it is.  But either way when I put your code in I still got the same error.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 22777285
well, anyhow, the syntax as you showed it is valid.
how do you use it?
0
 
LVL 31

Expert Comment

by:awking00
ID: 22777290
What happens if you remove the parentheses -
SELECT *
FROM S_ORG_EXT T1
LEFT JOIN S_ORG_EXT_X T4 ON T1.row_id = T4.row_id;
0
 
LVL 1

Author Comment

by:Compmouse
ID: 22777331
I'm actually just typing it into Toad as is then running it.

I get the same error when I remove the parentheses. This is very strange to me that I would be getting this kind of error.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:Compmouse
ID: 22777549
Well this is even more odd, this works:
SELECT * 

FROM S_ORG_EXT T1, S_ORG_EXT_X T4

WHERE T1.row_id = T4.row_id (+);

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22777581
your are using oracle 8 or lower, then ...
0
 
LVL 31

Expert Comment

by:awking00
ID: 22777593
What version are you running? That is the old outer join syntax.
0
 
LVL 1

Author Comment

by:Compmouse
ID: 22778575
When I run the following statement:
SELECT * FROM v$version
WHERE banner LIKE 'Oracle%';

It returns:
Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
0
 
LVL 22

Assisted Solution

by:dportas
dportas earned 25 total points
ID: 22778690
No ISO join syntax in 8i, you need to use the proprietary (+) syntax instead.
0
 
LVL 31

Expert Comment

by:awking00
ID: 22780724
>>What's wrong with this SQL statement?<<
So, the answer to that question is nothing as long as you're using 9i or later :-(
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now