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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:46:06+00:00 2026-05-25T00:46:06+00:00

How do I write an Oracle query which is equivalent to the following Informix

  • 0

How do I write an Oracle query which is equivalent to the following Informix query?

select tab1.a,tab2.b,tab3.c,tab4.d 
  from table1 tab1,
       table2 tab2 OUTER (table3 tab3,table4 tab4,table5 tab5) 
 where tab3.xya = tab4.xya 
   AND tab4.ss = tab1.ss 
   AND tab3.dd = tab5.dd 
   AND tab1.fg = tab2.fg 
   AND tab4.kk = tab5.kk 
   AND tab3.desc = "XYZ"

I tried:

select tab1.a,tab2.b,tab3.c,tab4.d 
  from table1 tab1,
       table2 tab2 LEFT OUTER JOIN (table3 tab3,table4 tab4,table5 tab5) 
 where tab3.xya = tab4.xya 
   AND tab4.ss = tab1.ss 
   AND tab3.dd = tab5.dd 
   AND tab1.fg = tab2.fg 
   AND tab4.kk = tab5.kk 
   AND tab3.desc = "XYZ"

What is the correct syntax?

  • 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-25T00:46:06+00:00Added an answer on May 25, 2026 at 12:46 am

    Write one table per join, like this:

    select tab1.a,tab2.b,tab3.c,tab4.d 
    from 
      table1 tab1
      inner join table2 tab2 on tab2.fg = tab1.fg
      left join table3 tab3 on tab3.xxx = tab1.xxx and tab3.desc = "XYZ"
      left join table4 tab4 on tab4.xya = tab3.xya and tab4.ss = tab3.ss
      left join table5 tab5 on tab5.dd = tab3.dd and tab5.kk = tab4.kk
    

    Note that while my query contains actual left join, your query apparently doesn’t.
    Since the conditions are in the where, your query should behave like inner joins. (Although I admit I don’t know Informix, so maybe I’m wrong there).

    The specfific Informix extension used in the question works a bit differently with regards to left joins. Apart from the exact syntax of the join itself, this is mainly in the fact that in Informix, you can specify a list of outer joined tables. These will be left outer joined, and the join conditions can be put in the where clause. Note that this is a specific extension to SQL. Informix also supports ‘normal’ left joins, but you can’t combine the two in one query, it seems.

    In Oracle this extension doesn’t exist, and you can’t put outer join conditions in the where clause, since the conditions will be executed regardless.

    So look what happens when you move conditions to the where clause:

    select tab1.a,tab2.b,tab3.c,tab4.d 
    from 
      table1 tab1
      inner join table2 tab2 on tab2.fg = tab1.fg
      left join table3 tab3 on tab3.xxx = tab1.xxx
      left join table4 tab4 on tab4.xya = tab3.xya
      left join table5 tab5 on tab5.dd = tab3.dd and tab5.kk = tab4.kk
    where
      tab3.desc = "XYZ" and
      tab4.ss = tab3.ss
    

    Now, only rows will be returned for which those two conditions are true. They cannot be true when no row is found, so if there is no matching row in table3 and/or table4, or if ss is null in either of the two, one of these conditions is going to return false, and no row is returned. This effectively changed your outer join to an inner join, and as such changes the behavior significantly.

    PS: left join and left outer join are the same. It means that you optionally join the second table to the first (the left one). Rows are returned if there is only data in the ‘left’ part of the join. In Oracle you can also right [outer] join to make not the left, but the right table the leading table. And there is and even full [outer] join to return a row if there is data in either table.

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

Sidebar

Related Questions

I tried to write the following inner join query using an Oracle database: SELECT
I am running oracle and have a query which pulls some results from the
Write a class ListNode which has the following properties: int value; ListNode *next; Provide
Write a SQL query to find those values from column A in table X
Possible Duplicate: Oracle DB: How can I write query ignoring case? I have an
i'm trying to write an Oracle query that sorts the results in the same
Guys i want to write an oracle sql query for table A of the
i am trying trying to get a query from oracle table called sys.all_objects into
I am trying to write an SQL query. If it works in Oracle SQL
I have a query like this - SELECT * FROM mytable WHERE id IN()

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.