Outer joins across multiple databases

I'm trying to join three tables: 2 from data warehouse and 1 from Siebel database in OBIEE. I create the physical and logical joins (no errors or warnings). The model looks like this: Account Address (table 1) -> Account (table 2) -> Siebel Customer Data (table 3)
I create two queries in Answers:
(1) Account.Number and Siebel.Address (the query works)
(2) Account Address.Zip, Account.Number, and Siebel.Address (the query gets the following error):
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 42019] Join condition, D901.c3 <> 0, contains predicates that are currently not supported for outer joins across multiple databases. (HY000)
Can someone help me understand why the join between the two databases works for the first query but when I add a second table it fails?
thanks...

Either you can link the Oracle DB into Access (by using File/Get External Data/Link Tables)
or you have to simulate the join in Java by doing two separate queries and looping through the results.

Similar Messages

  • A dimension table outer join across two databases

    I have two databases of the same schema but may have different data that I would like to do comparisons on. For this discussion, each has two tables, Dimension and Fact. I created a common dimension which would show dimension data that exists on both databases. However, I want a common dimension which is a full outer join of the two Dimension tables that can be used to view data on the Fact tables on the two databases; this seems to be a little difference than a fact which may having missing value, isn't it? should this outer join occurs at the physical or logical? Can I even do it at physical if the data are from two different source? Any recommendation on what is the best way to do so? Thanks

    It depends on how you are defining your BM. Always, BM is for creating joins on folders within BM, in the sense that each folder can contain data from within multiple databases. So, create it in Physical layer and also create new joins for your defined facts dimensions in BM. But remember, cross database joins are not recommended. If both your schemas reside on 2 different oracle databases, you would be better off creating a single view (by creating a dblink between these 2 databases). So, create a single view and include that in the physical layer.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Joins across multiple databases using jdbc

    I have two databases, Access and Oracle. I can read and write to them, but now I need to execute an outer join. How would I construct the join in Java? I'd also like to store the result in Access. Thanks in advance.

    Either you can link the Oracle DB into Access (by using File/Get External Data/Link Tables)
    or you have to simulate the join in Java by doing two separate queries and looping through the results.

  • How to execute sql scripts from Powershell across multiple databases

    Re: How to execute sql scripts from Powershell across multiple databases
    I have an tsql script that I want to run across a list of databases. How is the best way to do this in Powershell? Thanks.

    My example below, using just the SMO and not breaking up the batches, the ExecuteWithResults give the following error when the .sql file contains a GO. My script files are as simple as a DECLARE and then a GO.
    WARNING: SQL Script Failed
    The object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not valid or not in the correct sequence. This is likely caused by a user-specified "format-list" comm
    and which is conflicting with the default formatting.
        + CategoryInfo          : InvalidData: (:) [out-lineoutput], InvalidOperationException
        + FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand
    Also, when executing from the ISE, is there a way to force the ISE to release the files. I am having to close the ISE and reopen my script every time I want to make a testing change to the .sql file.
    [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")
    $scriptspath = "C:\temp\psExecuteSQLScripts\scripts"
    $SQLServer = "fidevc10"
    $SQLDB = "Bank03"
    # Create SMO Server Object
    $Server = New-Object ('Microsoft.SQLServer.Management.Smo.Server') $SQLServer
    # Get SMO DB Object
    $db = $Server.Databases[$SQLDB]
    # Load All SQL Scripts in Directory
    $scripts = Get-ChildItem -Path (Join-Path $scriptspath "*") -Include "*.sql" -Recurse
    # Loop through each script and execute
    foreach ($SQLScript in $scripts)
    $fullpath = $SQLScript.FullName
    # Read the Script File into Powershell Memory
    $reader = New-Object System.IO.StreamReader($fullpath)
    $script = $reader.ReadToEnd()
    # Execute SQL
    Write-Host "Executing $SQLScript on $SQLDB...."
    try
    $ds = $db.ExecuteWithResults($script)
    Foreach ($t in $ds.Tables)
    Foreach ($r in $t.Rows)
    Foreach ($c in $t.Columns)
    Write-Host $c.ColumnName "=" $r.Item($c)
    Write-Host "Complete"
    catch [Exception]
    Write-Warning "SQL Script Failed"
    echo $_.Exception|format-list -force
    Write-Host " " -BackgroundColor DarkCyan

  • Left outer join using multiple table

    Hi,
    I am trying to use left outer join with multiple tables , the join condition will be based on  PERNR and BEGDA & ENDA for each infotype in selection screen.
      select pa00~pernr pa00~begda pa00~endda pa00~massn pa00~massg pa00~stat2 pa00~aedtm pa00~uname
        pa01~begda pa01~endda pa01~bukrs pa01~persg pa01~persk pa01~mstbr pa01~ename pa01~aedtm pa01~uname
        pa02~begda pa02~endda pa02~nachn pa02~vorna pa02~midnm pa02~aedtm pa02~uname
        pa016~begda pa016~endda pa016~cttyp pa016~aedtm pa016~uname
        into CORRESPONDING FIELDS OF TABLE i_pall
        from  ( PA0000 as pa00 left OUTER JOIN pa0001 as pa01 on pa00~pernr = pa01~pernr )
        left OUTER JOIN pa0002 as pa02 on pa00~pernr eq pa02~pernr )
        left OUTER JOIN  pa0016 as pa016 on pa00~pernr eq pa016~pernr )
        where pa00~pernr in S_pernr
        AND pa00~begda in s_bg0000
        and pa00~endda in s_nd0000.
    but this fails  to fetch the value of begda enda from each pa0000,pa0001,pa0002,pa0016.
    Please help!
    Monirul

    Why don't you use the standard logical database PNPCE and then Provide statement?

  • Oracle outer join on  multiple tables throws error

    Hi ,
    We are using ansi joins with outer joins on multiple tables in oracle 9i.
    Now these queries have to be used in Oracle8i.
    Since Oracle8i does not support ansi sql we are replacing the ansi sql queries with the oracle joins.
    On trying the same we found that the following query
    select *from tab1 a, tab2 b, tab3 c where a.c1 = b.col1(+) and c.c2 = b.col2 (+)
    throws the error
    ORA-01417: a table may be outer joined to at most one other table.
    Is there a way to simulate this query without using the outer joins on multiple tables?
    thanks

    Try writing the query in this form:
    select * from
    (select t1.col1, t1.col2
    from schema.table1 t1, schema.table2 t2
    where t1.col1 = t2.col1(+)) t4,
    schema.table3 t3 where t4.col2 = t3.col2(+)
    In the subquery, you will have to list all the columns you want to see, and you will need to provide unique aliases for any columns with duplicate names. I tested this on 9i, and don't have an 8i system to work with, so I hope this helps.

  • Outer Joins with multiple conditions - alternatives to UNION?

    It is my understanding that Oracle 8i does not directly support mutiple conditions for outer joins. For instance, I'm looking for PEOPLE who may, or may not, be on MEDICATIONS.
    All MEDICATIONS are listed with DRUGNAME and DRUGID. There thousand of different drugs. I'm only looking for PEOPLE on either one or two of them (to make it simple) or no drug at all (ignoring all other DRUGS they're on..) IF they are on the DRUG, it's gerts printed.
    I'd ideally do a LEFT OUTER JOIN to do this with multiple conditions:
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    (MEDICATION.DRUGID (+) = 632 OR
    MEDICATION.DRUGID (+) = 956)
    This, of course, is not valid, at least in 8i...
    So I've taken the UNION approach:
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    MEDICATION.DRUGID (+) = 632
    UNION
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    MEDICATION.DRUGID (+) = 956
    This of course, does work, but as I've added more drugs this becomes quite unwieldly and not really sure what this does to performance. (There are also several more joins to other tables, not relevent here.)
    In addition, if I import this into Crystal Reports 8.5 (as opposed to the Crystal Query Designer), it refuses to recognize the UNION.
    -- Any suggestions for alternative syntax ???
    -- Has this been addressed in 9i ???
    Thanks,
    Will

    You could try
    select Distinct Person.Name, Med.DrugName, Med.DrugId
    from Person,
    (select ID, DrugName, DrugId from Medication
    where DrugId in (632, 956) ) Med
    where Person.ID = Med.ID(+)
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    (MEDICATION.DRUGID (+) = 632 OR
    MEDICATION.DRUGID (+) = 956)
    This, of course, is not valid, at least in 8i...
    So I've taken the UNION approach:
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    MEDICATION.DRUGID (+) = 632
    UNION
    SELECT DISTINCT
    PERSON.NAME,
    MEDICATION.DRUGNAME,
    MEDICATION.DRUGID
    FROM
    PERSON,
    MEDICATION
    WHERE
    PERSON.ID = MEDICATION.ID (+) AND
    MEDICATION.DRUGID (+) = 956
    This of course, does work, but as I've added more drugs this becomes quite unwieldly and not really sure what this does to performance. (There are also several more joins to other tables, not relevent here.)
    In addition, if I import this into Crystal Reports 8.5 (as opposed to the Crystal Query Designer), it refuses to recognize the UNION.
    -- Any suggestions for alternative syntax ???
    -- Has this been addressed in 9i ???
    Thanks,
    Will

  • Outer join on multiple tables

    Hi All,
    I need to create multiple outer join in Discoverer.
    My requirements is like this
    I have a report where in I show the sales of components. I have Year as page item in Discoverer cross tab.
    I have 2 years in my year table, 1999 and 2000
    in the components table I have 3 components, X, Y, Z
    In the fact table, I have 5 records as below
    YEAR     PRODUCT     AMOUNT
    1999     X     100
    1999     Y     200
    1999     Z     300
    2000     X     400
    2000     Y     500
    Now with this data, when I create a cross tab with year as page item, I get the following output on selecting 1999 as year in page item,
    component     Amount SUM
    X     $100
    Y     $200
    Z     $300
    similarly when I get report for 2000 it will be as follows
    component     Amount SUM
    X     $400
    Y     $500
    Now I want some way to get a report as below for 2000 and similar cases
    component     Amount SUM
    X     400
    Y     500
    Z     0
    Can some body help me??
    Thanks,

    Hi Mrutyunjay,
    If you keep the query as described by Csaba but leave out time_period.year from the SELECT and GROUP BY list. In addition, replace the SUM(...) function with the following expression.
    SUM (CASE WHEN <condition> THEN fact_tab.amount ELSE 0 END)
    Where <condition> will be along the lines of 'time_period.year = 1999'.
    This will give you the result you require.
    Do be aware that this will force Oracle to do a full scan on the fact_tab table. This may render the solution unworkable.
    Cheers,
    denty.

  • Credit Approval across multiple databases

    Hi,
    We are trying to create a credit approval across two databases i.e. set my limit in the one database but would like to have an approval fire in my other database if the combined customer balances + new transaction amount is greater than the limit set.
    We get an cannot commit ADOC error.
    Please have a look at the query and let us know what needs to be changed.
    Thanks
    Jacques
    SELECT 'TRUE' FROM SBODemoUK.dbo.OCRD a, SBODemoUS.dbo.OCRD b WHERE $[a.cardcode]=$[$4.0.0] and $[b.CreditLine]< (($[a.Balance]$[b.Balance])$[$29.0.0])) and $[a.cardcode]=$[b.cardcode}

    The $ before a.cardcode is not the right syntax.  Also when you are referencing the DocTotal I changed the syntax to
    $[$29.0.Number]
    so that we can get the value without the currency symbol
    Could you please try this
    SELECT DISTINCT 'TRUE' FROM SBODemoUK.dbo.OCRD a, SBODemoUS.dbo.OCRD b WHERE a.cardcode=$[$4.0.0] and b.CreditLine< ((a.Balance+b.Balance)+$[$29.0.Number]) and a.cardcode=b.cardcode

  • Transaction across multiple databases in the same BDB environment

    Hi,
    I have multiple databases and one metadata database all in the same BDB environment. At runtime I want to create an additional database, update this database and update the metadata database in the same environment under one transaction. Are there any issues in having transactions that span multiple databases in the same environment?
    Thanks,
    Pooja

    There is virtually no difference between using multiple databases and a single database in a transaction. Concurrency is determined by other factors such as whether multiple threads access the same records. See the Writing Transactional Applications for more information:
    http://www.oracle.com/technology/documentation/berkeley-db/je/TransactionGettingStarted/index.html
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Left outer join with multiple conditions

    Is it possible to add to a left outer join (= anyOfAllowingNone) more than the primary condition (in SQL this would be added per "and").
    Background: The execution plan of the produced SQL shows large results on which the final filter is applied although I have conditions that would decrease this last result set much earlier...

    There is no easy way to do this in TopLink expressions, other than including the join in the regular where clause as you have done. Does it make a big impact in the performance of your query?
    <p>
    You could use custom SQL for the query.
    <p>
    Or you could potentially define a OneToOneQueryKey in your TopLink descriptor that includes the additional join criteria and call anyOfAllowingNone using this query key.
    <p>
    <p>---
    <p>James Sutherland

  • Outer join for a database view

    Dear Experts,
    Could you tell me what is the outer join and the example of this?
    Is it possible I can create an outer join view for generic extraction?
    Thanks.
    Arthur

    This is what a nested loops would look like in ABAP.  It is not a function module, but it could be made into one very easily.
    REPORT zz_temp.
    DATA: l_t_tstc    TYPE TABLE OF tstc,
          l_t_tstct   TYPE TABLE OF tstct,
          l_s_tstc    TYPE tstc,
          l_s_tstct   TYPE tstct.
    SELECT *
    INTO CORRESPONDING FIELDS OF l_s_tstc
    FROM tstc AS t.
      SELECT tt~ttext
      INTO CORRESPONDING FIELDS OF l_s_tstct
        FROM tstct AS tt
        WHERE tt~tcode = l_s_tstc-tcode
        AND tt~sprsl = sy-langu.
      ENDSELECT.
      WRITE:/ l_s_tstc-tcode,l_s_tstct-ttext.
    ENDSELECT.

  • Using one user account table across multiple databases but account used as a foreign key

    I want to use one user account table from one database and use it across a couple other databases. The problem is that I want some tables to use the primary key from the user account table as a foreign key to access the data when the user logs in. Is this
    the right way of going about it? Do I have to create a user account table in all my databases? What is the best practice to handle this problem? Thanks in advance.

    You can use Triggers or using replication. 
    more info: 
    Add Foreign Key relationship between two Databases
    SQL Server Replication
    Saeid Hasani [sqldevelop]

  • Query across multiple databases

    Hi,
    One shot question: is it possible in Oracle to write a query joining two tables from different databases ?
    I used MS SQL, and it was duable there, but I have to port app to Oracle, and I did not manage to do this on oracle.
    I use oracle 9
    Thanks.
    pesq

    1. Create an account on the remote database with permissions to select from the relevent tables.
    2. Create a database link in the local database to connect to the account (step 1.) in the remote database.
    3. Now execute you query in the local database connecting to the tables in the remote database.
    SELECT local_a.col1, local_a.col2, rmt_a.col5
    FROM local_table local_a, remote_table@<name of link> rmt_a
    WHERE local_a.key = rmt_a.key;

  • Multiple databases in a single query

    I need to query multiple databases in a single query.
    e.g.
    Database d1 contains table t1 with column id
    Database d2 contains table t2 with column id
    I need a query like
    SELECT * FROM t1, t2 WHERE t1.id = t2.id;
    is this possible in jdbc? if yes can anyone help with some sample code?
    thanks,
    Ashish Saraf

    It is not possible using the JDBC API to query tables in two or more databases using a single query. The reason is that a JDBC Connection is made to a single data source.
    However, some databases support the idea of federations or linked tables. What you do is inside the database manager link or federate a table that is present in another DBMS. Then, pose a single JDBC query to the one DBMS which will have its own table and links to the external tables.
    Another approach is to use a special JDBC driver with a built-in integration engine that will perform a query across multiple databases. In effect, the system poses separate queries to the different databases and integrates and joins the data together for you automatically on the client-side. That is much easier than doing it yourself in code, but that is also possible for simple queries.
    As part of my research program, we have released a shareware version of the UnityJDBC driver that can query multiple databases using a single SQL query. For more information, see:
    http://www.unityjdbc.com
    http://www.cs.uiowa.edu/~rlawrenc/research/projects.html
    Sincerely,
    Dr. Ramon Lawrence
    Assistant Professor
    Department of Computer Science
    University of Iowa
    [email protected]

Maybe you are looking for

  • My safari will not work

    when I was using safari I stoped and the it said" Safari quit unexpectedly" this code came up to Process:               Safari [527] Path:                  /Applications/Safari.app/Contents/MacOS/Safari Identifier:            com.apple.Safari Version

  • SUBMIT(to SAP) Button in Adobe Interactive Forms (Web Dynpro Java)

    Hi , I m using Adobe Interactive Forms with Web Dynpro Java But submit to SAP button is not working i m using NWDS 7.2 with adobe lifecycledesigner 6.0 with adobe reader 9.0 when i click submit to SAP button in interactive form nothing happens and da

  • Keynote with ios5 update

    I am really freaked out here.  It's 2am and my ipad2 is still updating photos but I got no clue whether or not I have lost all my ppt in keynote.  I was planning on showing a short clip (video) in my class tomorrow and teach a lesson already saved in

  • List PO's waiting to be released

    Hi, Is there a standard report to list the PO's waiting to be released ? If not, which tables should I look into to create this list myself in QuickViewer ? Thanks in advance for your feedback, Erik

  • Database DLL error on editing the record selection formula?

    Post Author: Aravind CA Forum: Older Products Hi All,I recently edited the record selection formula of an old report and since then the report is issuing me an "Error detected by database DLL" error.The report was running fine earlier and still conti