Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why my subqueries all get ORA-00933 when I execute them?

508560Jun 23 2006 — edited Jun 26 2006
Everytime I try to run a subquery, I always get the following error:

[error]
ORA-00933: SQL command not properly ended
[error]

Here are two examples. The 1st is a large one, and the 2nd one is more paired down, because I'm trying to figure out where the error is, but Golden always points to where the subquery begins.

1st query
select p1.associate_id, p1.application_id, p1.entity_id, p1.profile_id, p1.language, p1.neutrals, p1.created_date, p1.sf_completed_date,
p1.completed_time, p1.parent_respondent, p1.parent_aid, p1.attempt, p1.parent_attempt, p1.reported_top1, p1.reported_top2, p1.reported_top3,
p1.reported_top4, p1.reported_top5, p1.top1, p1.top2, p1.top3, p1.top4, p1.top5
from sf.profiles p1
where p1.sf_completed_date < to_date('15-June-2006 00:00:00', 'DD-MM-YYYY HH24:MI:SS')
and p1.parent_respondent is null
and p1.parent_aid is null
and p1.neutrals < 155 in (
select nvl(max(p2.attempt), 0)
from sf.profiles p2
where p2.associate_id = p1.associate_id);
2nd query
select p1.language, pl.neutrals, p1.top1, p1.top2, p1.top3, p1.top4, p1.top5
from sf.profiles
where p1.parent_respondent_id is null (
select nvl(max(p2.attempt), 0)
from sf.profiles p2
where p2.associate_id = p1.associate_id);
I'm not sure what I'm doing wrong, is there anything that I can read up on to get better at these?

I found this via Google

http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/queries.htm#2057934

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2006
Added on Jun 23 2006
4 comments
1,371 views