Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2010
    Posts
    2

    Unanswered: join with null values?

    I have this query that I have to modify

    Select a.code_prim,
    a.code_sec,
    b.type_prim,
    b.type_sec
    from a.code_tbl
    b.type_tbl
    where a.code_prim in (5,10)
    and a.code_sec (+)= b.type_sec

    I am not getting any rows back because b.type_sec is null for these cases I am looking at but that may not always be the case. How do I do this join where b.type_sec can be NULL sometimes?
    thanks so much for your help in advance!

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    OR b.type_sec is null
    Last edited by anacedent; 06-24-10 at 17:28.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2010
    Posts
    2
    I received an error with that that says:

    outer join operator (+) not allowed in operand of OR or IN

  4. #4
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    Avoid using the deprecated (+) syntax. OUTER JOIN is the recommended syntax and is more powerful and concise, industry standard, etc.

    I think this may be the query you want:

    Code:
    SELECT a.code_prim, 
    a.code_sec,
    b.type_prim,
    b.type_sec
    FROM type_tbl b
    LEFT OUTER JOIN code_tbl a 
    ON a.code_sec = b.type_sec
    AND a.code_prim IN (5,10);
    HTH

  5. #5
    Join Date
    Feb 2005
    Posts
    57
    You could try using NVL.

  6. #6
    Join Date
    Jul 2010
    Posts
    1
    Hi !! This is Devan..

    I would like to know how real time work ..I'm working in a company as soft QA..Want to change to Pl/sql developer.

    I'm good in sql , pl/sql and advanced pl/sql ..I'm OCA .

    Can any one guide me...

    my personal email ID is dharmaji_devender@yahoo.com

Posting Permissions

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