SELECT query from multiple databases

Hi,
Is it possible to run a SELECT query using multiple DBs' tables, like outer joining them. One of the DBs is Sybase.
Thanks in advance

A TopLink session can span multiple databases if they can be accessed through a single connection. A single select would require the database to handle the aggregation as mentioned in the other post.
Alternatively TopLink's session broker will support making a single session present persistent types from multiple independent databases. This approach will not support a single SELECT spanning the databases though.
Doug

Similar Messages

  • Select query from 2 schema & database

    Hi,
    what privileges should i give to execute select query from 2 schema & database in oracle
    thanks

    Hi,
    not so clear, if you are looking for this
    -- for other schema access
    GRANT SELECT ON <scheman_name>.<table_name> TO <schema_name>;
    or create the synonym
    --for other database access you need to create db link                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • SELECT data from two databases

    I have two databases that I need to select data from in a
    single SELECT. Using DWs Advanced window for creating the select I
    don't see any way to select more than 1 Connection. Both databases
    have unique user and passwords but reside on the same server. Any
    idea how I can write a single SELECT to get data from both dbs. I
    assumed it would be similar to selecting data from multiple tables
    within the same db but the connection part is stumping me. Any
    ideas would be greatly appreciated.

    TouchstonePress wrote:
    > Page 48, Developing a Web Database Application . . .
    speaks about making a
    > database with two related TABLES each with the same
    PRIMARY KEY column with
    > which to identify a customer using their unique number.
    That's the basic technique for joining two tables in the same
    database.
    The original poster has tables in different databases that
    have
    different user accounts and passwords.
    Although it's possible to join two databases, you cannot do
    it unless
    you have one user account with the same privileges on both
    databases.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Select data from different database

    hi,
    may I know how to select data from different database?
    for example,
    I've 2 databases, OracleDB and OracleAR
    Connect with OracleAR in SQL*Plus
    select * from OracleDB.TableName
    does Oracle support this kind of query?
    how can I retrieve data from other database while im connecting with
    other database?

    Hi,
    Yes, it's possible. No, your syntax won't work.
    First of all you have to define a DATABASE LINK inside the DB where you are already connected (in this case OracleAR). Read docs how to do that.
    Second thing is the query. It will look like
    SELECT * from TableName@<NameOfDatabaseLink>Greetings,
    Guido

  • How an INDEX of a Table got selected when a SELECT query hits the Database

    Hi All,
    How an Index got selected when a SELECT query hits the Database Table.
    My SELECT query is as ahown below.
        SELECT ebeln ebelp matnr FROM ekpo
                       APPENDING TABLE i_ebeln
                       FOR ALL ENTRIES IN i_mara_01
                       WHERE werks = p_werks      AND
                             matnr = i_mara_01-matnr AND
                             bstyp EQ 'F'         AND
                             loekz IN (' ' , 'S') AND
                             elikz = ' '          AND
                             ebeln IN s_ebeln     AND
                             pstyp IN ('0' , '3') AND
                             knttp = ' '          AND
                             ko_prctr IN r_prctr  AND
                             retpo = ''.
    The fields in the INDEX of the Table EKPO should be in the same sequence as in the WHERE clasuse?
    Regards,
    Viji

    Hi,
    You minimize the size of the result set by using the WHERE and HAVING clauses. To increase the efficiency of these clauses, you should formulate them to fit with the database table indexes.
    Database Indexes
    Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
    The primary index is always created automatically in the R/3 System. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE. If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVING clause, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
    reference : help.sap.com
    thanx.

  • Dbms_xmlgen.newcontext query from multiple tables and ||

    I have two questions
    How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
    And how to get the || (concat) to work within my query for my output to an xml file?
    Here is my current query:
    create or replace function get_xml return clob is
    result clob;
    qryctx dbms_xmlgen.ctxHandle;
    SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
    FROM rcv.recv_accessions ra
    where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;
    result := DBMS_XMLGEN.getXML(qryCtx);
    This is what I desire:
    SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
    FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
    where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
    On this both the reference to multiple tables and the concat function cause errors.
    Thank you
    Edited by: user583094 on Mar 2, 2011 3:36 PM

    Hi,
    for the concat do I use xmlconcat?No, XMLConcat is used to concatenate XMLType fragments.
    The || operator will do fine, but you must escape any single quote inside the string :
    SELECT DBMS_XMLGEN.getxml(
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id'
    INTO result
    FROM dual;Or, use the quoting operator to define a custom string delimiter :
    SELECT DBMS_XMLGEN.getxml(
    q'{SELECT ra.prefix ||'-'|| ra.suffix ||'-'|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id
    INTO result
    FROM dual;BTW, a good practice would be to use bind variables for the query. DBMS_XMLGEN can handle them nicely :
    CREATE OR REPLACE FUNCTION get_xml
    RETURN CLOB
    IS
    qryctx   DBMS_XMLGEN.ctxHandle;
    v_out    CLOB;
    qrystr   VARCHAR2(4000) :=
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = :b_prefix
    AND ra.fiscal_yr = :b_fiscal_yr
    AND ss.raid = ra.id
    AND st.ssid = ss.id';
    BEGIN
    qryctx := DBMS_XMLGEN.newContext(qrystr);
    DBMS_XMLGEN.setBindValue(qryctx, 'b_prefix', '8');
    DBMS_XMLGEN.setBindValue(qryctx, 'b_fiscal_yr', '11');
    -- to generate empty elements if necessary :
    DBMS_XMLGEN.setNullHandling(qryctx, DBMS_XMLGEN.EMPTY_TAG);
    v_out := DBMS_XMLGEN.getXML(qryctx);
    DBMS_XMLGEN.closeContext(qryctx);
    RETURN v_out;
    END;

  • Select query on two Database views

    Hi all,
    Can i fetch the data by writing a select query on two DATABASE VIEWS
    Because i am able to fetch data by writing a selct query on ONE DATABASE VIEW and ON TRANSPARANT TABLE
    but i am not able to fetch data by writing a query on TWO DATABASE VIEWS
    Query which i am able to fetch data is
    select * from CSKS where OBJNR = COVJ-OBJNR
    Query which i am NOT able to fetch data is
    Select * from COAS where OBJNR = COVJ-OBJNR
    Here
    COVJ is a DATABASE VIEW
    CSKS is a Transparant Table
    COAS is a DATABASE VIEW
    Thanks in advance
    Regards
    Ajay

    Hi
    I tried with code and I am able to fetch data from view COAS
    DATA:it_coas TYPE STANDARD TABLE OF coas.
    SELECT * FROM coas INTO TABLE it_coas.
    IF sy-subrc IS INITIAL.
      WRITE:/ 'Sucess'.
    ENDIF.
    I think in your case COAS view does not have a value for COVJ-OBJNR.
    Regards
    Srilaxmi

  • ADF search from multiple database

    JDev 11.1.1.3
    ADF BC & ADF Faces
    I am having a requirement to build advance search functionality, wherein the result data will come from multiple databases. Let's say I have two different database DB1 and DB2. On click of 'search' button I need to query both the databases and populate the data in a single result table. what should be the approach?
    Any pointer will be appreciated.
    ~Abhijit

    You've essentially done my POJO approach using the AM as your POJO. Yes you can do it. No, it's not going to be horribly efficient. You'll also have to handle when the newly-created root AM gets closed - on second thought - I hate this approach. Me too - it's just a highly customised one-off solution suitable only as the last resort.
    At least in this way, you'll have a chance of having the DB doing the filtering.Right on - let the framework do its job like it's designed to.
    I also summarised my thoughts on this thread: Re: Oracle ADF Business Component - Various data source...
    It's still 'nice and easy' to show 'search results' from different data sources in separate disjoint (but parameterised) 'regions', with each region displaying a task flow pointing to a different database.
    The non-trivial bit is when there's a requirement to combine two data sets - especially large ones (and then make it behave like a normal collection).
    I'd mostly never go down this route unless there's an exceptionally compelling need to do so.
    On a case by case basis, i might consider:
    1. Having a 'primary' database and expose a webservice on the 'secondary' one. Then fetch of a large data set from the secondary and filter it 'in memory' to match with the primary rows...
    2. Normal/Materialised views over db links etc. -
    Jang Vijay Singh

  • ** Is it possible to give select command from multiple tables in JDBC

    Hi Friends,
    Is it possible to give the select command to select data from multiple tables directly in the 'Query SQL statement' in JDBC sender communication channel ? (Instead of Stored Procedure)
    Thanking you.
    Kind Regards,
    Jeg P.

    Hi,
    here is a sample:
    Table #1
    Header
    Name EmpId Status
    Jai 5601 0
    Karthik 5579 0
    Table #2
    Name Contactnumber
    Jai 9894268913
    Jai 04312432431
    Karthik 98984110335
    Karthik 04222643993
    select Header.Name, Header.EmpId, Item.Contactnumber from Header,Item where Header.Name = (select min(Header.Name) from Header where Header.Status = 0) and Header.Name = Item.Name
    Regards Mario

  • How to get the selection parameters from logical database into one of the t

    Hi Sap ABAP Champians,
    How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
    Please help me for this
    Thanks
    Basu

    Hi
    Thanks, that will work, but then I'll have to insert code into all my reports.
    I can see that "Application Server Control Console" is able to rerun a report.
    This must mean that the Report Server has access to the runtime parameters.
    But how?
    Cheers
    Nils Peter

  • Select records from one database and insert it into another database

    Hi
    I need to write a statement to select records from one database which is on machine 1 and insert these records on a table in another database which is on machine 2. Following is what I did:
    1. I created the following script on machine 2
    sqlplus remedy_intf/test@sptd @load_hrdata.sql
    2. I created the following sql statements in file called load_hrdata.sql:
    rem This script will perform the following steps
    rem 1. Delete previous HR data/table to start w/ clean import tables
    rem 2. Create database link to HR database, and
    rem 3. Create User Data import table taking info from HR
    rem 4. Drop HRP link before exiting
    SET COPYCOMMIT 100
    delete from remedy.remedy_feed;
    commit;
    COPY FROM nav/donnelley@hrp -
    INSERT INTO remedy.remedy_feed -
    (EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR) -
    USING SELECT EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR -
    FROM ps_rrd_intf_medium -
    where empl_status IN ('A', 'L', 'P', 'S', 'X')
    COMMIT;
    EXIT;
    However, whenever I run the statement I keep getting the following error:
    SP2-0498: missing parenthetical column list or USING keyword
    Do you have any suggestions on how I can fix this or what am I doing wrong?
    Thanks
    Ali

    This doesn't seem to relate to Adobe Reader. Please let us know the product you are using so we may redirect you or refer to the list of forums at http://forums.adobe.com/

  • Thread : select switchover_status from v$database

    hi there,
    I am not able to change my primary database switchover to standby. As before i did some r.n.d while running below command on primary db: "alter database commit to switchover to physical with session shutdown" then i checked status
    "select switchover_status from v$database";
    sql>SWITCHOVER_STATUS
    TO PRIMARY
    after that i run this command to switch again to standby db:
    sql> alter database commit to switchover to standby with session shutdown;
    Database altered.
    but still showing same status:
    SQL> select switchover_status from v$database;
    SWITCHOVER_STATUS
    TO PRIMARY
    how do i make my primary db on switchover_status to standby .any solution would be graceful.
    thanks

    bingo!!
    i create backup of controlfile:
    sql>alter database backup controlfile to trace as '/Pgh/controlfile.sql';
    and take my primary db to nomount stage run the script:
    startup nomount;
    sql@Pgh/controlfile.sql';
    database mount;
    alter database open resetlogs;
    then i checked switchover_status
    select switchover_status from v$database;
    SWITCHOVER_STATUS
    to standby

  • Workspace to parse SQL statements from multiple database schema's

    Hi ,
    When go through the following link of workspace admin user :
    Home>HTML DB Workspace Administration>Manage Services>Schema Reports>Workspace Schemas there I saw "Your workspace has the privilege to parse SQL statements using the following database schemas. Note that the terms database schema and database user can be used interchangeably.
    " at the right pane.
    So how can i make my workspace to parse SQL statements from multiple database schema's ?That must be listed there .But i have only one schema in view ? Can i make it multiple ?If then How ?
    Anybody have an idea ?
    ROSY

    Assign as many schemas to your workspace as you want using the administration app. Read about it in the doc.
    Scott

  • How to run select query from one SID to fetch record from another SID?

    I have two SID, one is AAA and another is BBB and the connection name is A1 and B1 respectively. I want to run one select query from A1 connection to fetch record B1. Can anyone help me how I can connect from one SID to another SID?

    Hi 869357,
    You can also use the copy command. (Works with limited types)
    try:
    help copyRegards,
    Turloch

Maybe you are looking for