Updatable ResultSet for join Query

Hi all,
It is inevitable that i use a 'JOIN' operation for a particular query and i need the resultSet to be updated. Heard JDBC driver doesnt support this. Is there any workaround for this. Any help is really appreciated.
Thanks,
Abhijit

Welcome to the forum!
>
It is inevitable that i use a 'JOIN' operation for a particular query and i need the resultSet to be updated. Heard JDBC driver doesnt support this.
>
As gimbal2 mentioned this isn't supported even by the latest 11g version and driver. See 'Result Set Limitations' in Chapter 17 of the JDBC doc for confirmation and discussion.
http://docs.oracle.com/cd/E14072_01/java.112/e10589/resltset.htm#BABBCECI
>
Result Set Limitations
The following limitations are placed on queries for enhanced result sets. Failure to follow these guidelines will result in the JDBC driver choosing an alternative result set type or concurrency type.
To produce an updatable result set:
A query can select from only a single table and cannot contain any join operations.
In addition, for inserts to be feasible, the query must select all non-nullable columns and all columns that do not have a default value.
A query cannot use SELECT * .
However, there is a workaround for this.
A query must select table columns only.
It cannot select derived columns or aggregates, such as the SUM or MAX of a set of columns.
>
>
Actually my exact requirement is i have two tables, earlier i used to select the results from one table and check for the existance of the corresponding record in the second table from the output of resultset. This is causing a lot of performance issue and i thought of using a single query by joining two tables which reduces the number of records.
>
So is this a correct description of what you want to do?
1. TableA and TableB have one or more columns in common.
2. Query TableA, possibly using filter predicates (WHERE tabA.col1 ...) and identify records in TableB that match on the join columns
3. Update the TableB records from step #2.
If so then you have a couple of options.
The record-by-record approach would be to execute your current query (the one that joins the two tables) but retrieve ONLY the ROWID from TableB. Then iterate thru the result set and use a separate query to get each TableB record by using the ROWID retrieved from the first query. This is different from your original approach because the first query WILL identify the TableB records you need it just won't retrieve them (only the ROWID).
Your original performance issues were probably because you were retrieving ALL of the TableA records and then checking each one to see if there were any TableB records for it.
The BULK approach would be a slight modification of of the record-by-record approach but pushes the work to the DB server.
This approach queries TableB to retrieve ONLY those records that EXIST in the query of TableA just described. So the query is of the form
SELECT * FROM TableB b WHERE EXISTS (SELECT '1' FROM TableA a WHERE a.col1 = b.col1);  This query only uses one table for the resultset and does not contain any join operators so it can be updateable.
Test a simple query first until you get the syntax correct.

Similar Messages

  • How to disable update notifications for Power Query?

    Is there a way to disable the notification of available updates for Power Query? Command line switch on install, anything?
    Thanks!

    it was included in the Power Query version released in September 2014. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft Power Query for Excel DisableUpdateNotification dword 1 will disable the update notification.
    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually
    answer your question). This can be beneficial to other community members reading the thread.
    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or MVPs.
    Twitter:
    @alexverboon | Blog: Anything About IT

  • Query rewrite don't work wor aggregate query but work for join query

    Dear experts,
    Let me know what's wrong for
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    I have two MATERIALIZED VIEW:
    A) -- Only join
    CREATE MATERIALIZED VIEW "SCOTT"."TST_MV"
    ENABLE QUERY REWRITE AS
    SELECT "T57410"."MEMBER_KEY" "MEMBER_KEY",
    "T57410"."ANCESTOR_KEY" "ANCESTOR_KEY",
    "T57410"."DISTANCE" "DISTANCE",
    "T57410"."IS_LEAF" "IS_LEAF",
    "T57460"."DEPARTMENTID" "DEPARTMENTID",
    "T57460"."NAME" "NAME","T57460"."PARENT"
    "PARENT","T57460"."SHORTNAME" "SHORTNAME",
    "T57460"."SKIMOID" "SKIMOID"
    FROM "BI_OIV_HIER" "T57410",
    "BI_DEPARTMENTS" "T57460"
    WHERE "T57410"."ANCESTOR_KEY"="T57460"."DEPARTMENTID";
    B) -- Join with aggregation
    CREATE MATERIALIZED VIEW "SCOTT"."TST_MV2"
    ("C41", "C42", "C43",
    "C44", "C45", "C46",
    "C47", "C48", "C49",
    "C50", "C51", "C52",
    "C53", "C54", "C55",
    "C56", "C57", "C58",
    "C59", "C60", "C61",
    "INCIDENTTYPE")
    ENABLE QUERY REWRITE
    AS SELECT COUNT(T56454.TOTAL) AS c41,
    T56840.CATEGORYID AS c42,
    T56840.PARENT AS c43,
    T56908.DOCSTATEID AS c44,
    T56908.PARENT AS c45,
    T56947.EXPIREDID AS c46,
    T56947.PARENT AS c47,
    T56986.ISSUESTATEID AS c48,
    T56986.PARENT AS c49,
    T57025.LOCATIONID AS c50,
    T57025.PARENT AS c51,
    T57064.NEWID AS c52,
    T57064.PARENT AS c53,
    T57103.PARENT AS c54,
    T57103.RESOLUTIONID AS c55,
    T57142.PARENT AS c56,
    T57142.RESPONSIBLEID AS c57,
    T57181.PARENT AS c58,
    T57181.SOURCEID AS c59,
    T57460.DEPARTMENTID AS c60,
    T57460.PARENT AS c61,
    T56454.INCIDENTTYPE
    FROM BI_OIV_HIER T57410
    BI_DEPARTMENTS T57460
    BI_SOURCE_HIER T57176
    SOURCE T57181
    BI_RESPONSIBLE_HIER T57137
    RESPONSIBLE T57142
    BI_RESOLUTIONS_HIER T57098
    RESOLUTIONS T57103
    BI_NEW_HIER T57059
    NEW T57064
    BI_LOCATIONS_HIER T57020
    LOCATIONS T57025
    BI_ISSUESTATES_HIER T56981
    ISSUESTATES T56986
    BI_EXPIRED_HIER T56942
    EXPIRED T56947
    BI_DOCSTATES_HIER T56903
    DOCSTATES T56908
    BI_CATEGORY_HIER T56835
    CATEGORY T56840
    INCIDENTS T56454
    WHERE ( T56454.RESOLUTION = T57098.MEMBER_KEY
    AND T56454.CATEGORY = T56835.MEMBER_KEY
    AND T56454.DOCSTATE = T56903.MEMBER_KEY
    AND T56454.EXPIRED = T56942.MEMBER_KEY
    AND T56454.ISSUESTATE = T56981.MEMBER_KEY
    AND T56454.LOCATION = T57020.MEMBER_KEY
    AND T56454.NEW = T57059.MEMBER_KEY
    AND T56454.RESPONSIBLE = T57137.MEMBER_KEY
    AND T56454.SOURCE = T57176.MEMBER_KEY
    AND T56454.DEPARTMENTID = T57410.MEMBER_KEY
    AND T56835.ANCESTOR_KEY = T56840.CATEGORYID
    AND T56903.ANCESTOR_KEY = T56908.DOCSTATEID
    AND T56942.ANCESTOR_KEY = T56947.EXPIREDID
    AND T56981.ANCESTOR_KEY = T56986.ISSUESTATEID
    AND T57020.ANCESTOR_KEY = T57025.LOCATIONID
    AND T57059.ANCESTOR_KEY = T57064.NEWID
    AND T57098.ANCESTOR_KEY = T57103.RESOLUTIONID
    AND T57137.ANCESTOR_KEY = T57142.RESPONSIBLEID
    AND T57176.ANCESTOR_KEY = T57181.SOURCEID
    AND T57410.ANCESTOR_KEY = T57460.DEPARTMENTID
    GROUP BY T56840.CATEGORYID,
    T56840.PARENT,
    T56908.DOCSTATEID,
    T56908.PARENT,
    T56947.EXPIREDID,
    T56947.PARENT,
    T56986.ISSUESTATEID,
    T56986.PARENT,
    T57025.LOCATIONID,
    T57025.PARENT,
    T57064.NEWID,
    T57064.PARENT,
    T57103.PARENT,
    T57103.RESOLUTIONID,
    T57142.PARENT,
    T57142.RESPONSIBLEID,
    T57181.PARENT,
    T57181.SOURCEID,
    T57460.DEPARTMENTID,
    T57460.PARENT,
    T56454.INCIDENTTYPE;
    So, optimizer uses query rewrite in
    select * from TST_MV
    and don't use query rewrite in
    select * from TST_MV2
    within one session.
    select * from TST_MV should be read as underlying select for TST_MV:
    SELECT "T57410"."MEMBER_KEY" "MEMBER_KEY",
    "T57410"."ANCESTOR_KEY" "ANCESTOR_KEY",
    "T57410"."DISTANCE" "DISTANCE",
    "T57410"."IS_LEAF" "IS_LEAF",
    "T57460"."DEPARTMENTID" "DEPARTMENTID",
    "T57460"."NAME" "NAME","T57460"."PARENT"
    "PARENT","T57460"."SHORTNAME" "SHORTNAME",
    "T57460"."SKIMOID" "SKIMOID"
    FROM "BI_OIV_HIER" "T57410",
    "BI_DEPARTMENTS" "T57460"
    WHERE "T57410"."ANCESTOR_KEY"="T57460"."DEPARTMENTID";
    So, select * from TST_MV2 should be read by similar way as underlying select to TST_MV2
    DBMS_STATS.GATHER_TABLE_STAT is done for each table and MV.
    Please help to investigate the issue.
    Why TST_MV2 don't used for query rewrite ?
    Kind regards.

    Hi Carlos
    It looks like you have more than one question in your posting. Would I be right in saying that you have an issue with how long Discoverer takes when compared with SQL, and a second issue with regards to MVs not being used? I will add some comments on both. If one of these is not an issue please inform.
    Issue 1:
    Have you compared the explain plan from Discoverer with SQL? You may need to use a tool like TOAD to see it.
    Also, is Discoverer doing anything complicated with the data after it comes back? By complicated I mean do you have a large number of Page Items and / or Group Sorted items? SQL wouldn't have this overhead you see.
    Because SQL would create a table, have you tried creating a table in Discoverer and seeing how long it takes?
    Finally, what version of the database are you using?
    Issue 2:
    Your initial statement was that query rewrite works with several MV but not with others, yet in the body of the report you only show explain plans that do use the MV. Could you therefore go into some more detail regarding this situation.
    Best wishes
    Michael

  • Update rewrite for the query below

    UPDATE LAB_ST_SMRY LLS
    SET (ST_CODE, ST_NAME, ST_DESC,IMAGE, ST_ID, ID, DIS_TYPE, ZIP_TYPE,
    ACTE_IND, USER, UPDATE_DATE)
    = (SELECT LLT.ST_CODE, LLT.ST_NAME, LLT.ST_DESC, LLT.IMAGE, LLT.ST_ID, LLT.ID,
    LLT.ASSOC_DISC,1,1, 'LabWork', SYSDATE
    FROM LAB_ST_TEMP LLT
    INNER JOIN LAB_TEMP LT
    ON LLT.ST_CODE=LT.ST_CODE
    WHERE LLT.ST_ID=LLS.ST_ID
    GROUP BY LLT.ST_CODE, LLT.ST_NAME, LLT.ST_DESC, LLT.IMAGE, LLT.ST_ID, LLT.ID,LLT.ASSOC_DISC
    i am getting error that cannot update st_code to null.
    I have 15 records in LAB_ST_SMRY
    I have 20 records in LAB_ST_TEMP
    when i am 8 records when i run the inner sql.
    but when i run whole sql with the update statement i am getting error.
    how can i re write this sql so that i will not get error

    A merge statement would work
    MERGE INTO lab_st_smry lls
    USING (SELECT llt.st_code
                 ,llt.st_name
                 ,llt.st_desc
                 ,llt.image
                 ,llt.st_id
                 ,llt.id
                 ,llt.assoc_disc
             FROM lab_st_temp llt
             INNER JOIN lab_temp lt ON lt.st_code = llt.st_code) lu
       ON (lu.st_id = lls.st_id)
       WHEN MATCHED THEN
         UPDATE
            SET st_code = lu.st_code
               ,st_name = lu.st_name
               ,st_desc = lu.st_desc
               ,image = lu.image
               ,id = lu.id
               ,dis_type = lu.assoc_disc
               ,zip_type = 1
               ,acte_ind = 1
               ,user = 'LabWork'
               ,update_date = sysdate;You could also add a WHERE clause to what you have now to insure you don't try to update any rows that don't exist in the other table
    UPDATE LAB_ST_SMRY LLS
    SET (ST_CODE, ST_NAME, ST_DESC,IMAGE, ST_ID, ID, DIS_TYPE, ZIP_TYPE,
    ACTE_IND, USER, UPDATE_DATE)
    = (SELECT LLT.ST_CODE, LLT.ST_NAME, LLT.ST_DESC, LLT.IMAGE, LLT.ST_ID, LLT.ID,
    LLT.ASSOC_DISC,1,1, 'LabWork', SYSDATE
    FROM LAB_ST_TEMP LLT
    INNER JOIN LAB_TEMP LT
    ON LLT.ST_CODE=LT.ST_CODE
    WHERE LLT.ST_ID=LLS.ST_ID
    GROUP BY LLT.ST_CODE, LLT.ST_NAME, LLT.ST_DESC, LLT.IMAGE, LLT.ST_ID, LLT.ID,LLT.ASSOC_DISC
    ) WHERE st_id IN
        (SELECT llt.st_id FROM lab_st_temp llt JOIN lab_temp lt ON llt.st_code = lt.st_code)Edited by: kendenny on Jan 27, 2011 9:50 AM

  • Select resultset in join query

    I have a SQL query:
    SELECT * FROM Job_Request_Record, Requester_Record WHERE Job_Request_Record.Job_Requester_ID=Requester_Reco rd.Requester_ID; if i want to call an attribute from Job_Request_Record table e.g. rs.getString("ID")is it valid? or anything else. please help.
    Also, is it possible to have a create view table in ms access 2003?

    I have a SQL query:
    SELECT * FROM Job_Request_Record, Requester_Record
    WHERE
    Job_Request_Record.Job_Requester_ID=Requester_Reco
    rd.Requester_ID; if i want to call an attribute from
    Job_Request_Record table e.g. rs.getString("ID")is it
    valid? or anything else. please help.
    Also, is it possible to have a create view table in ms
    access 2003?You can call rs.getString("ID") provided you have a column name as "ID". But I would advise you to write query without * as it is very ambiguous. You can write
    select a.column1,b.column2 from a,b where a.column=b.column

  • No Resultset for query containing multiple tables

    Hi, I am new to Oracle and I have a problem concerning the Oracle datasource/query I am using.
    I am using Websphere Application Server v5.1 Test environment, which connects to an Oracle 10g database and a DB2 database.
    So basically, I have 2 datasources in my webservice application, one for each database. I have tested both datasources from the admin console of the server and both return no errors. Both datasources are loaded on startup of the application and again, there are no errors.
    The problem basically is that I have no resultset elements ( rs.next() is false ) when I have a query that queries multiple tables.
    Eg. Case1: Select * From table1
    Case2: Select * From table1, table2
    Case3: Select * From table1 t1 INNER JOIN table2 t2 on t1.column = t2.column
    Case1: Contains resultset
    Case2 and Case3: NO resultset
    When these queries (case 2 and case3) are run from within the webservice application, there is no resultset; only case1 returns a resultset. However, if I run the same queries above from within Oracle SQL developer, there is a resultset containing the matching records. This problem only happens when using the Oracle datasource; the same problem does not happen for the DB2 datasource.
    Basically, I do not have any resultset for a valid query and there aren't any errors as well.
    Any ideas as to why this happens?
    Thanks for any help.
    Edited by: user11220677 on Jun 3, 2009 3:08 AM

    Finally got to the bottom of this. Turns out that the problem has nothing to do with the Oracle datasource in the webservice application, as what I have initiially thought.
    The cause of the problem seems to be related to an import problem/issue in the Oracle SQL developer. Everytime I open Oracle SQL developer, one table (table2 in my example from previous post) is missing its data, so I import the data using the application's import wizard. Once the import is done, I use SQL developer's query interface to verify the data is there, and there are records returned - which made me think the database table was updated successfully. The problem was, I still do not have results when the query is run from the webservice containing the datasource.
    We used another SQL command editor to verify if the said table was really updated in the database and to our surprise, it was still empty (even after the import from Oracle SQL developer). That explains why I am not able to retrieve anything from the webservice.
    We just imported the data using another SQL command editor and the issue is now fixed.
    Thanks anyway.

  • Use ResultSet in a query - join??

    Hello there,
    I would like to ask if it is possible to use the ResultSet from a query in another query. For example my result set contains some indexes and I want to select the rows from the database whose index is not in the result set. Can I do a join somehow?
    I find ResultSet very restrictive otherwise
    please help
    thanx ;)

    No, you can't use a ResultSet, but you should be able to modify your original query to do whatever it is you need to do. You can do joins in SQL.

  • Can we implement the custom sql query in CR for joining the two tables

    Hi All,
    Is there anyway to implement the custom sql query in CR for joining the two tables?
    My requirement here is I need to write sql logics for joining the two tables...
    Thanks,
    Gana

    In the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
    Log on to your data source if necessary.
    Under your data source, double-click the Add Command node.
    In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
    For example:
    SELECT
        Customer.`Customer ID`,
        Customer.`Customer Name`,
        Customer.`Last Year's Sales`,
        Customer.`Region`,
        Customer.`Country`,
        Orders.`Order Amount`,
        Orders.`Customer ID`,
        Orders.`Order Date`
    FROM
        Customer Customer INNER JOIN Orders Orders ON
            Customer.`Customer ID` = Orders.`Customer ID`
    WHERE
        (Customer.`Country` = 'USA' OR
        Customer.`Country` = 'Canada') AND
        Customer.`Last Year's Sales` < 10000.
    ORDER BY
        Customer.`Country` ASC,
        Customer.`Region` ASC
    Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
    Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
    For more information about creating parameters, see To create a parameter for a command object.
    Click OK.
    You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
    Note:
    To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
    By default, your command is called Command. You can change its alias by selecting it and pressing F2.

  • Join query for three tables

    Hi i have got this query that is a join of two tables but i need join for three tables i need the extended query
    select aauthlname aauthlnam aauthfname aauthfnam aisbn btitle
      from ( bsauthors as a inner join bsbook as b on aisbn = bisbn )
      into corresponding fields of table books
      where aauthlname like authorlname or aauthfname like authorfname
      order by aauthlname aauthfname a~isbn.

    Hi pavan
    Plz try the following querry for joins on three tables :
    " Customize it to ur requirements and tablenames
    Parameters : b type mara-matnr.
    select xmatnr xmtart xmatkl ywerks ylgort zmaktx
    into corresponding fields of table itab
         from (  ( mara as x inner join mard as y on xmatnr = ymatnr )
    inner join makt as z on xmatnr = zmatnr ) where x~matnr = a and
    y~werks
    = b .
    Plz see that there is atleast one field common between the three tables u want to use.
    Regards
    Pankaj

  • SQL Joins for Order Query

    If someone could help me figure out what joins I need to do to handle the following, I would be greatly appreciative.
    Our Oracle Order Order Header has flex fields that are used to track a special address by it's code which is stored in Attribute 13 on OE_ORDER_HEADERS_ALL table. We use a site usage code called ADMIN_BY to set up a site in the customers table so we can place the address we are linking here. So for instance, if the order had AB-XXXXXX in it's attribute 13 field, I want to look for this same code in the customer site usage table and find the address in HZ_LOCATIONS table or null if attribute 13 does not have data. My only problem is taking care of the NULL case for all previous orders that did not contain this information.
    This is my sql query whcih works if we have a valid entry in attribute 13. This is also set up for a specific order number for testing only.
    SELECT DISTINCT
    ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, AR.HZ_LOCATIONS.LOCATION_ID, AR.HZ_PARTY_SITES.LOCATION_ID AS LOC_ID,
    AR.HZ_PARTY_SITES.PARTY_SITE_ID, AR.HZ_PARTY_SITES.PARTY_ID, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
    ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
    AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AS P_SITE_ID, AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID,
    AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AS CUST_ACCT_S_ID, AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
    FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_ACCT_SITES_ALL, AR.HZ_CUST_SITE_USES_ALL
    WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID AND
    AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID AND
    AR.HZ_PARTY_SITES.PARTY_SITE_ID = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
    AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
    ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13 = AR.HZ_CUST_SITE_USES_ALL.LOCATION AND
    (ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER = TO_NUMBER('5074920')) AND (AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE = 'ADMIN_BY')
    I tried this code to no avail.
    SELECT DISTINCT
    ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, AR.HZ_LOCATIONS.LOCATION_ID, AR.HZ_PARTY_SITES.LOCATION_ID AS LOC_ID,
    AR.HZ_PARTY_SITES.PARTY_SITE_ID, AR.HZ_PARTY_SITES.PARTY_ID, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
    ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
    AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AS P_SITE_ID, AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID,
    AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AS CUST_ACCT_S_ID, AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
    FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, AR.HZ_CUST_ACCT_SITES_ALL, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_SITE_USES_ALL,
    ONT.OE_ORDER_HEADERS_ALL OE_ORDER_HEADERS_ALL_1
    WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID AND
    AR.HZ_PARTY_SITES.PARTY_SITE_ID = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
    AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID AND
    AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
    AR.HZ_CUST_SITE_USES_ALL.LOCATION (+) = OE_ORDER_HEADERS_ALL_1.ATTRIBUTE13 AND
    (ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER = TO_NUMBER('5074920')) AND
    (AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE (+) = 'ADMIN_BY')
    Any assistance would be greatly appreciated.

    Thanks for the reply Rob.
    Your input did help me return values for my query but I got 5 returned rows where I'm trying to return a single line. I modified my sql query with your recommendations.
    SELECT DISTINCT
    ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
    ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
    AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
    FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, AR.HZ_CUST_ACCT_SITES_ALL, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_SITE_USES_ALL,
    ONT.OE_ORDER_HEADERS_ALL OE_ORDER_HEADERS_ALL_1
    WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID (+) AND
    AR.HZ_PARTY_SITES.PARTY_SITE_ID (+) = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
    AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID (+) AND
    AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID (+) = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
    AR.HZ_CUST_SITE_USES_ALL.LOCATION (+) = OE_ORDER_HEADERS_ALL_1.ATTRIBUTE13 AND
    (ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER (+) = TO_NUMBER('5074417')) AND
    (AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE (+) = 'ADMIN_BY')
    Here is the results for 2 different Order Numbers
    For the first order which has a null value in attribute 13, here is the results
    NULL     NULL     NULL     NULL     1042nd AVIATION CO.     ADMIN_BY
    NULL     NULL     NULL     NULL     437 APS OUTBOUND FREIGHT     ADMIN_BY
    NULL     NULL     NULL     NULL     DCMC DETROIT - GRAND RAPIDS     ADMIN_BY
    NULL     NULL     NULL     NULL     FB5621     ADMIN_BY
    NULL     NULL     NULL     NULL     NULL     NULL
    For the next order which does have a value in attribute 13,
    5075315     3069     AB-S2303B     IB-S2303B     437 APS OUTBOUND FREIGHT     ADMIN_BY
    5075315     3069     AB-S2303B     IB-S2303B     DCMC DETROIT - GRAND RAPIDS     ADMIN_BY
    5075315     3069     AB-S2303B     IB-S2303B     FB5621     ADMIN_BY
    NULL     NULL     NULL     NULL     1042nd AVIATION CO.     ADMIN_BY
    NULL     NULL     NULL     NULL     NULL     NULL
    What I need is for them both to return a single line. The second order should have read...
    5075315     3069     DCMC DETROIT - GRAND RAPIDS     ADMIN_BY     AB-S2303B     IB-S2303B
    while the first order didn't even list the Order number.
    Any thoughts?

  • Forming generic sql query   for joining multiple sap tables in ABAp

    Hi,
    I am new to this abap field ,facing an issue onsap-jco project . I have used RFC_READ_TABLE  FM ,Customized this FM but facing an issue how to write generic  open SQl select statement  for joining multiple tables  using RFC_READ_TABLE .Kindly help on this issue.
    Thanks.

    something like this? If your tuples are not single columns, then you'll have to use dynamic sql to achieve the same result.with
    table_1 as
    (select '|Xyz|Abc|Def|' tuple from dual
    table_2 as
    (select '|Data1|Data21|Data31|Data41|Data51|' tuple from dual union all
    select '|Data2|Data22|Data32|Data42|Data52|' tuple from dual union all
    select '|Data3|Data23|Data33|Data43|Data53|' tuple from dual union all
    select '|Data4|Data24|Data34|Data44|Data54|' tuple from dual union all
    select '|Data5|Data25|Data35|Data45|Data55|' tuple from dual
    select case the_row when 1
                        then tuple
                        else '|---|---|' || substr(tuple,instr(tuple,'|',1,3) + 1)
           end tuple
      from (select substr(a.tuple,instr(a.tuple,'|',:one_one),instr(a.tuple,'|',:one_one + 1)) ||
                   substr(a.tuple,instr(a.tuple,'|',1,:one_two) + 1,instr(a.tuple,'|',1,:one_two + 1) - instr(a.tuple,'|',1,:one_two)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_one) + 1,instr(b.tuple,'|',1,:two_one + 1) - instr(b.tuple,'|',1,:two_one)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_two) + 1,instr(b.tuple,'|',1,:two_two + 1) - instr(b.tuple,'|',1,:two_two)) tuple,
                   rownum the_row
              from table_1 a,table_2 b
    order by the_rowRegards
    Etbin
    Message was edited by:Etbin
    user596003

  • HT201210 I am trying to update Ios7 for iPhone 4 but there is an unknown error occurred like (-23). My Laptop OS is Windows 8. Now how can i solved this query.

    Dear Sir/Madam
    I am trying to update Ios7 for iPhone 4 but there is an unknown error occurred like (-23). My Laptop OS is Windows 08.ios 7 update which can updated and remaining  30minutes are left out. Than after error which can be show as i have mentioned above.
    How can i resolved this error? So please help me.
    Thanks & Regards,
    Vatsal Desai

    Error 20, 21, 23, 26, 28, 29, 34, 36, 37, 40
    These errors typically occur when security software interferes with the restore and update process. Use the steps to troubleshoot security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service.
    Also, check your hosts file to verify that it's not blocking iTunes from communicating with the update server. See the steps under the heading "Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store." If you have software used to perform unauthorized modifications to the iOS device, uninstall this software prior to editing the hosts file to prevent that software from automatically modifying the hosts file again on restart.
    all of this from
    iTunes: Specific update-and-restore error messages and advanced troubleshooting

  • Deciphering column names in a join query using jdbc

    hi all....
    I am making a database adapter for a generic report generater. This adapter would be forming queries involing various tables. There are two ways of doing it . I fire an sql on parent table to get the keys and then go to child table for each one of them or i form a join query to get desired result.
    i want to go with the later approach where my query would be forming a join. The problem comes when table involved in this join has columns with the same name. for eg if a column "NOTE" is there in table A as well as table B on which i have a join. Resultset returns me with two "NOTE" columns and i cannot recognize which one belongs to which table.
    all API calls including getString("Note") seems to be referring to the first occurence of "Note" column.
    Also getTableName() and getSchemaName() APIs on resultsetMetadata doesnt return in anything in case of joins.
    Any pointers would be most appreciated.
    cheers
    vivek

    thanks for suggesting this solution ... though i had thought of the same onece .... unfortunately i cannot implement something like this coz out of the result set i have to instantiate an object hierarchy depending on the schema ....
    this also puts me in a doubt whether i can use join in my case.
    for eg ... .
    lets say we have a customer talbe and and address table which has one to many relationship .... one contact can have multiple addresses.
    Assuming a contanct "Joe Bloggs" having 3 addresses ...a query like following
    select contact.firstname contactfirstname , address.streetname addressstreetname from contact , address where contact.contactid = address.contactid
    this would return me 3 rows and i can also recognize various columns with their aliases ..
    but i would lose an important fact that i have to create one java object for contact class and 3 instances for addresses which i have to return finally.
    this means that i would like to return an object hierarchy with one contact object and 3 address object underneath it linked with contactid.
    Any other suggestions after reading the complete requirement are most welcome ...sorry for not puting the entire thing at first.
    i guess the only soln left is to visit contact and address table separately. :(

  • Problem getting results with no unique key in a joined query

    I created a descriptor to do a joined query, which generated a query in log as:
    Select t0.empID,t1.empID, t1.phone from Emp t0, Phone t1
    where t0.empId=t1.empId and t0.empId=1001
    When I run it, I got the result as:
    1001,1001,9999999
    1001,1001,9999999
    The correct result should be (I copy and paste the query from log into SQL-Plus):
    1001,1001,9999999
    1001,1001,1234455
    I suspect this is caused by Toplink caching objects by primary key. I wonder if anybody has a solution for this.
    My descriptor is created using WorkBench. Emp is the primary table, Phone as additional table linked by foreignKey empId.
    The join is implemented by modifying the descriptor as the following:
    ExpressionBuilder builder = new ExpressionBuilder();
    descriptor.getQueryManage()
    .setMultipleTableJoinExpression(
    builder.getField("EMP.EMPID").equal(
    builder.getField("EMP.EMPID")));
    descriptor.disableCacheHits();
    I'd really appreciate your help.

    I am implementing a people search function. The batch reading is quite expensive if toplink does a read query for every person. A customized query requires only one database access, the other way may requires hundreds.
    I don't want to use the cache either in this case because the database is also accessed by legacy system which cann't notify toplink any updates.
    I opened a TAR on this and the solution I got is to use ReportQuery rathen than ReadAllQuery. The only problem here is that now I have to map the query result to my class manually.

  • Result Set Update error for Timestamp

    Hi,
    I am using Oracle 9i DB with JBDC 2.0. I want to update a record present in a Resultset. Two fields are updated from this resultset. One is string and other is timestamp. Both these fields are present in select clause of the statement. The string field is updated (String.updateString(<field name>, value)) properly in to DB (Resultset.updateRow()). But if i include timestamp field for update (Resultset.updateTimestamp(<field name>, value)), it gives me error on this line.
    Error message is as given below
    java.sql.SQLException: Internal Error: Unable to construct a Datum from the specified input
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1130)
    at oracle.sql.SQLUtil.makeDatum(SQLUtil.java:1100)
    at oracle.sql.SQLUtil.makeOracleDatum(SQLUtil.java:1583)
    at oracle.jdbc.driver.UpdatableResultSet.updateObject(UpdatableResultSet.java:1615)
    at oracle.jdbc.driver.UpdatableResultSet.updateTimestamp(UpdatableResultSet.java:1492)
    at oracle.jdbc.driver.OracleResultSet.updateTimestamp(OracleResultSet.java:2881)
    If the timestamp update line is commeted then code work fine. Resultset.updateDate() is also working, but not Resultset.updateTimestamp();
    Regards,
    Jayesh

    Kshitiz & Jayesh,
    Well, it works for me.
    I ran Jayesh's "TestTimestamp" class (slightly modified) on a Windows XP machine with JDK 1.4.2_07 using "ojdbc14.jar" as the JDBC driver.
    I created (and populated) the EMP table, as per Jayesh's instructions, on a Oracle 9.2.0.4 database running on SUN [sparc] Solaris 9.
    Here is my code:
    import java.sql.*;
    public class TestTimestamp {
      public static void main(String[] args) {
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          conn = DriverManager.getConnection("jdbc:oracle:thin:@host:1521:orcl",
                                             "scott",
                                             "tiger");
          // connection.setAutoCommit(false);
          ps = conn.prepareStatement("select EMPID,NAME,JOINDATE,JOINTS from EMP",
                                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                                     ResultSet.CONCUR_UPDATABLE);
          rs = ps.executeQuery();
          System.out.println("EMDID NAME JOIN DATE JOIN TS");
          while (rs.next()) {
            System.out.print(rs.getInt("EMPID"));
            System.out.print(" " + rs.getString("NAME"));
            System.out.print(" " + rs.getDate("JOINDATE"));
            System.out.println(" " + rs.getTimestamp("JOINTS"));
            rs.updateTimestamp("JOINTS",
                               new Timestamp(System.currentTimeMillis())); //THIS WILL CREATE PROBLEM
          rs.last();
        catch (Exception e) {
          e.printStackTrace(System.err);
        finally {
          if (rs != null) {
            try {
              rs.close();
            catch (SQLException sqlEx) {
              System.err.println("Failed to close 'Resultset'");
              sqlEx.printStackTrace(System.err);
          if (ps != null) {
            try {
              ps.close();
            catch (SQLException sqlEx) {
              System.err.println("Failed to close 'PreparedStatement'");
              sqlEx.printStackTrace(System.err);
          if (conn != null) {
            try {
              conn.close();
            catch (SQLException sqlEx) {
              System.err.println("Failed to close 'Connection'");
              sqlEx.printStackTrace(System.err);
    }And here is my output:
    EMDID NAME JOIN DATE JOIN TS
    6001 Jayesh 2021-12-03 2021-12-03 09:00:00.0
    6002 Krupa 2021-12-03 2021-12-03 09:00:00.0
    6003 Vinod 2021-12-03 2021-12-03 09:00:00.0
    6004 Dylan 2021-12-03 2021-12-03 09:00:00.0Good Luck,
    Avi.

Maybe you are looking for

  • IMessages issues on Macbook pro

    Hi, my MAC used to let me use imessage from my computer, but one day it unexpectedly quit. I tried to go back in and set it up, but it does not list my phone under my families apple id.It also says that the outgoing messages would be coming from a di

  • Ess / Mss Error while manager tries to open the workitem in UWL.....

    Hi Experts,     As I am trying to apply the Loan details in ESS / MSS, Workflow is triggerred and workitem is received in the Manager's UWL. But when the Manager tries to open the Workitem it is going for dump. "As follows".... "    The initial excep

  • Ipod service module

    How can I repair the ipod service module?? Everytime I connect the ipod a message pops up stating that the ipod service module has encoutered a problem and needs to close. What can I do about this problem??? HELP???

  • ORACLE RAC 11.0.2.0.3 install in SOLARIS x64 11.1(or 11/11) issue

    hello all, i got issue when i install grid(11.0.2.0.3 for solaris x64 version), after install software and the run "root.sh" and got the follow error message: /u01/app/11.2.0/grid/bin/srvctl start nodeapps -n solrac1 ... failed FirstNode configuratio

  • CPU load growing slowly at exact pace

    Hi all, I'm experiencing a weird thing since migrating from 10.5 server to 10.6 server: The CPU load grows slowly but steadily after each restart. After two days the server gives bad response, resulting in beachballs coming and going on both the serv