Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7633853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:00:10+00:00 2026-05-31T07:00:10+00:00

I have noticed a strange behaviour of FULL OUTER JOIN in Oracle 11. I

  • 0

I have noticed a strange behaviour of FULL OUTER JOIN in Oracle 11. I was joining tables from HR schema, particularily EMPLOYEES and DEPARTMENTS.

For example, the following query returns 123 rows:

    SELECT * FROM employees e
    FULL JOIN departments d ON e.department_id = d.department_id

However, what is tricky to understand – when I put a set of particular columns in the select clause, the query will return 122 rows (a missing row is for an employee which has no department assigned – the one which is additionally returned with left join in comparison to inner join):

    SELECT first_name, last_name, department_name FROM employees e
    FULL JOIN departments d on e.department_id = d.department_id

Even when I count the rows it returns 122 (COUNT(*))!!! WHAT IS GOING ON? What is the difference between SELECT * and SELECT COUNT(*)?

The explain plan for SELECT * ... :

SELECT STATEMENT                                      122
  VIEW                 VW_FOJ_0                       122
    HASH JOIN                          FULL OUTER     122
      Access Predicates
        E.DEPARTMENT_ID = D.DEPARTMENT_ID
      TABLE ACCESS     DEPARTMENTS     FULL            27
      TABLE ACCESS     EMPLOYEES       FULL           107

and for SELECT COUNT(*) ... :

SELECT STATEMENT                                             1
  SORT                                     AGGREGATE         1
    VIEW               VW_FOJ_0                            122
      HASH JOIN                            FULL OUTER      122
        Access Predicates
          E.DEPARTMENT_ID = D.DEPARTMENT_ID
        INDEX          DEPT_ID_PK          FAST FULL SCAN   27
        INDEX          EMP_DEPARTMENT_IX   FAST FULL SCAN  107
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:00:12+00:00Added an answer on May 31, 2026 at 7:00 am

    The optimizer should not be choosing to use the index on EMP.DEPT_ID in the second query, since it can have NULL values. This is what’s causing it to exclude one row from the results.

    The only non-bug explanation I can think of at the moment is that you have somehow created constraints in DISABLE RELY mode so that the optimizer thinks that the field cannot contain NULLs. In this case it would be correct to use the index given the incorrect information in the constraints. However, it seems the RELY option is not available for NOT NULL constraints, so I don’t see how this could be the problem. Nonetheless, take a careful look at all constraints on the tables.

    That aside, there are a surprising number of bugs on Oracle’s site regarding wrong results from full outer joins. You might be hitting one of them. In quite a few of these cases, the workaround is to disable “native” full outer joins, which you can do for your current session with this statement:

    alter session set "_optimizer_native_full_outer_join"=off; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed a strange behaviour when intercepting the preUpdate row hook in Propel
I am creating a responsive website, and have just noticed a strange behaviour in
after adding adMob ads to my application, I have noticed some strange memory behaviour.
I have noticed a strange piece of behaviour when using MessageDlg and attempting to
I have noticed a rather strange behaviour in IE. I have a HTML form
I have noticed a strange behaviour of TextBox while BorderThickness property is set to
I have noticed a strange behaviour of a str_replace function. Can you tell me
I just noticed a strange behaviour in IE7. I have radio buttons with associated
I have noticed a strange behaviour when using the command functionality in Silverlight: When
I've noticed some very strange behaviour today in Code Igniter. I have this locations

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.