Solved

SQL Left Join

Posted on 2008-10-22
11
1,578 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 143

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 143

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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 32

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
 
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 143

Expert Comment

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

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 32

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What's wrong with this T-SQL Foreign Key? 7 51
capture vmstat info and insert it into an oracle table 31 34
Fill Null values 5 28
TSQL Challenge... 7 35
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to recover a database from a user managed backup

809 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