Solved

SQL Left Join

Posted on 2008-10-22
11
1,579 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

740 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