user3331535
user3331535

Reputation: 1257

java.sql.SQLException: ORA-00920: invalid relational operator

i cant able to run this query its saying a some error is there any wrong in this query if i remove this in query and GROUP_name it run successfully but i need to include that column too .could some one help on this??

SELECT GROUP_name,
       sum(qty),
       sum(AMOUNT) 
  FROM OUTLET_ITEMWISE_FACT_BACK A,
       OUTLET_DETAILS B,
       WEB_ITEM_MASTER C
 WHERE A.OUTLET_ID = B.OUTLET_ID 
   AND A.ITEM_CODE = C.ITEM_CODES
   and GROUP_name and state_name = 'GOA' 
 group by GROUP_name,
          state_name

Upvotes: 0

Views: 6278

Answers (1)

Maheswaran Ravisankar
Maheswaran Ravisankar

Reputation: 17920

and GROUP_name = 'somegroup' and state_name = 'GOA' 

the error is misleading because, compiler expects some relational operator after column name in WHERE clause .. but it ended up seeing an AND.. So it threw that error!

ALL WHERE conditions are two operand expressions.. There is no unary operation. So you have to specify two operands.. a column or value always.

That is why even for NULL, we have to give IS NULl and not !COLUMN_NAME like in other programming languages.

Upvotes: 1

Related Questions