Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 31st, 2004, 05:45 PM
smarti smarti is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 smarti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Why won't this statement work? PLEASE HELP!

select student_id, first_name, last_name
from users
where student_id not in
(
select u1.student_id
from users u1, messages m1, groups g1
where u1.student_id = m1.student_id and
g1.group_id = m1.group_id and
g1.group_name = 'All Groups'
)



Basically I want to select the users who haven't sent any messages (denoted by "squad"). I'm using JSP and the error I get is:

ORA-00933: SQL command not properly ended


Please help.

Thanks in advance!
Cheers
Arti

Reply With Quote
  #2  
Old April 6th, 2004, 09:19 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
I think the last line of your query is not ended properly, take a look :
g1.group_name = 'All Groups'

in JSP how you can pass any value that is enclosed in single quote? As my understanding you have to write this query as follows:

private String group_name;

group_name = "All Groups";

SQL_STMT = "select student_id, first_name, last_name
from users
where student_id not in
(
select u1.student_id
from users u1, messages m1, groups g1
where u1.student_id = m1.student_id and
g1.group_id = m1.group_id and
g1.group_name = '" +group_name+"')";

If above query does not work then remove the last line of query and run it through your JSP, If it does work then you have to read the JSP specification document how to pass any value enclosed in single quote or how can you use any string value in SQL statement.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Why won't this statement work? PLEASE HELP!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway