Results 1 to 5 of 5

Thread: SQL Query Error

  1. #1
    Join Date
    Oct 2007
    Posts
    10

    SQL Query Error

    When I run this SQL query, I get the following error:

    injury_or_illness, cust from test where cust
    LIKE (
    select code from lookup where lookuparea='DEPARTMENTS' and data_id in (
    select data_id from lookup_email where receipient = 'Admin'
    and notification_type = 'Representative'))||'%';


    ORACLE-01427: single-row subquery returns more than one row.

    Is there a SQL equivalent that will achieve the above using the LIKE operator?

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Don't cross post.

  3. #3
    Join Date
    Oct 2007
    Posts
    10
    Sorry, I am new to this. I just need help that is all. I orginally posted in the wrong place that is why I posted here.

  4. #4
    Join Date
    Jun 2007
    Posts
    41
    I don't think you need LIKE here, try this one:
    select injury_or_illness, cust from test,lookup
    where lookuparea='DEPARTMENTS'
    and data_id in (select data_id from lookup_email where receipient = 'Admin'
    and notification_type = 'Representative')
    and INSTR(cust,code) = 1;

    It should return result set with all custs, containing code.

  5. #5
    Join Date
    Oct 2007
    Posts
    10
    Thanks for your help. It worked!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •