Problem with IN clause

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swetan
    New Member
    • Jun 2010
    • 2

    Problem with IN clause

    Code:
    When i execute the following query:
    
    select * from view1/table1
    where col1 in (select col from table2)
    and col2=something and col3=something and col4=something
    ...
    i get an error, but when i do the same thing using the query
    select * from view1/table1
    where col1 in ('A','B')
    and col2=something and col3=something and col4=something
    i do not get an error.
    
    Is it something related with the order of execution of inner and outer queries?.Or is there another alternative?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    What's the error?

    ~~ CK

    Comment

    • swetan
      New Member
      • Jun 2010
      • 2

      #3
      Actually the table or the view requires atleast one value for col1 otherwise it will give an error "Query must contain atleast one valid value"(for col1).
      The same error is displayed here.
      And it occurs only when some conditions are included (not fixed) in query 1.Initially i thought it was because none of the values for col1 satisfy the conditions and it gave the error.But in that case it should display an empty table as it does when executing the second query.

      Comment

      Working...