1
votes

I am not able to execute this query getting

ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"

select count(user_id) 
from t_user 
where user_id = 2699478, object_id = 1329 
  and user_id not in
      (SELECT owner_user_id FROM t_obj where actual_id = 17447);  
4
Can only only guess what you intended the query to do but the comma after user_id=2699478 is the problem, could be an AND or OR?? - Tony Hopkinson

4 Answers

5
votes

You have to replace the comma , between the two conditions user_id=2699478 ,object_id=1329 with a proper conditional operators, and use parentheses to express them the way you want, like this:

SELECT COUNT(user_id) 
FROM t_user 
WHERE user_id = 2699478 
  AND object_id = 1329 
  AND user_id NOT IN
    (
        SELECT owner_user_id 
        FROM t_obj 
        WHERE actual_id = 17447
    ) 
4
votes

Try replacing your comma with AND:

select count(user_id) from t_user where user_id=2699478 AND object_id=1329 and user_id not in
  (SELECT owner_user_id FROM t_obj where actual_id = 17447);
3
votes

Replace a comma by and:

select count(user_id)
from t_user
where user_id=2699478
  and object_id=1329
  and user_id not in (SELECT owner_user_id FROM t_obj where actual_id = 17447);
1
votes

You need to replace the comma with an "AND":

SELECT count(user_id) FROM t_user WHERE user_id=2699478 AND object_id=1329 AND user_id NOT IN
      (SELECT owner_user_id FROM t_obj WHERE actual_id = 17447);