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 7017119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:52:24+00:00 2026-05-27T22:52:24+00:00

I have three basic queries that are related to each other and I need

  • 0

I have three basic queries that are related to each other and I need a single result set to return.

Simplified:

Query1 (possible return not a show stopper return null):

SELECT * FROM monkey WHERE monkey.ENDDATE IS NULL AND monkey.TEMPLATEID = 1

Query2 (possible return not a show stopper return null):

SELECT * FROM banana WHERE banana.ENDDATE IS NULL AND banana.TEMPLATEID = 1

Query3 (must return something):

SELECT * FROM tree WHERE tree.TEMPLATEID = 1

Query 1 and 2 may or may not return a value (come back null).

The third one will need to return a result (or not) IF the third query returns something I and query 1 or 2 fail I still want to return something.

I can’t do an outer join with 2 queries, because oracle won’t let me the error said… a.b (+) = b.b and a.c(+) = c.c is not allowed instead turn b+c into a view.

I think I understand the logical reason, never-the-less I need to return query 3 and maybe query 1, 2 or 1 and 2 along with 3 as a single result set.

I hope this makes sense.

  • 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-27T22:52:25+00:00Added an answer on May 27, 2026 at 10:52 pm

    You seem to be hitting ORA-01417. Using made up tables and data as you haven’t provided any, or the join conditions, I can get the same effect by trying to outer join monkey to both tree and banana – in a completely contrived way, of course:

    with banana as (select 'yellow' as colour, 1 as template_id, null as enddate
            from dual),
        monkey as (select 'capuchin' as monkeytype, 1 as template_id, null as enddate
            from dual),
        tree as (select 'tropical' as treetype, 1 as template_id from dual)
    select t.treetype, b.colour, m.monkeytype
    from tree t, banana b, monkey m
    where t.template_id = 1
    and b.template_id (+) = t.template_id
    and b.enddate (+) is null
    and m.template_id (+) = t.template_id
    and m.enddate (+) is null
    and m.template_id (+) = b.template_id;
    
    Error at Command Line:10 Column:22
    Error report:
    SQL Error: ORA-01417: a table may be outer joined to at most one other table
    01417. 00000 -  "a table may be outer joined to at most one other table"
    *Cause:    a.b (+) = b.b and a.c (+) = c.c is not allowed
    *Action:   Check that this is really what you want, then join b and c first
               in a view.
    

    if you use the ‘new’ (since 9i, I think) ANSI join syntax, rather the Oracle-specific (+) notation, you can do more:

    with banana as (select 'yellow' as colour, 1 as template_id, null as enddate
            from dual),
        monkey as (select 'capuchin' as monkeytype, 1 as template_id, null as enddate
            from dual),
        tree as (select 'tropical' as treetype, 1 as template_id from dual)
    select t.treetype, b.colour, m.monkeytype
    from tree t
    left join banana b on b.template_id = t.template_id
        and b.enddate is null
    left join monkey m on m.template_id = t.template_id
        and m.enddate is null
        and m.template_id = b.template_id
    where t.template_id = 1;
    
    TREETYPE COLOUR MONKEYTYPE 
    -------- ------ ---------- 
    tropical yellow capuchin   
    

    See the documentation for some of the restrictions on (+); Oracle recommend using the ANSI version, though they seem to use their own most of the time in examples in the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three unordered lists that have been created as Scriptaculous Sortables so that
I'm using Visual Basic 2010 Express. I have a form that can be minimized.
I have a file that goes thru a large data set and splits out
I've got a WCF service that is working for basic queries. I started with
We have a hosted application that manages pages of content. Each page can have
I have some basic questions related to the conversion of Web Service (.asmx) into
I am trying to make LDAP queries via Visual Basic. I don't have administrator
I have a very simple CSS related question on iPad. I have a set
I'm using MySQLdb and Python. I have some basic queries such as this: c=db.cursor()
I have an sql table of PlayerTrial that holds, well, player trials. ---PlayerTrials Basic

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.