Query with multiple outer joins

I had a doubt with whether the following kind of query is valid with multiple outer-joins. The format of the query is something like this:-
select A.col1, B.col2
from table1 A, table2 B, table3 C where
A.col3=B.col4(+) and B.col5=C.col6(+)
This would mean the follwoing with regard to outer-joins in the query.
1) fetch records with col3 in table A matching or not matching col4 in table B
2) fetch records with col5 in table B matching or not matching col6 in table C
So, this query is valid?
I hope, my question is clear.
Please, help in solving the doubt.
regards

This is valid and it works fine

Similar Messages

  • Query with FULL OUTER JOIN , help pleaseeeeeeeeeeee...

    Hi everyone,
    I'm trying to write a query for a report in Oracle SQL, but i just can't figure out how to do it.
    I'm using Oracle 10g release 1.0 database and i execute my queris in SQL* PLUS ( eventually i'm gonna use them in Oracle Report Builder ) .
    here's what i have:
    i have four tables that are used for our inventory application. lets call them INCOMMING , INCOMMING_ITEMS , OUTGOING , OUTGOING_ITEMS.
    as you may have guessed , INCOMMING_ITEMS is the detail table for INCOMMING ( joined by IID column) and also OUTGOING_ITEMS is the detail table for OUTGOING ( joined by OID column ).
    here is the structure of them :
    INCOMMING
    IID varchar2
    CDATE date
    INCOMMING_ITEM
    IID varchar2
    PART_NO number
    QTY number
    OUTGOING
    OID varchar2
    CDATE date
    OUTGOING_ITEM
    OID varchar2
    PART_NO number
    QTY number
    now , the query i want, should return part_no , cdate , sum of OUTGOING qty , sum of INCOMMING qty .
    the result of the query should be sth like this :
    part_no     cdate     O_qty     I_qty
    100     01/05/06     10     0
    100     01/05/07     20     60
    200     01/06/02     0     50
    300     01/06/02     30     40
    this means that for some dates and for some parts, i may not have INCOMMING or OUTGOING data, but if at least one of the 2 last columns has a non-zero data, i should show the row ( like the first and third rows of my example result), and if both have data for the same PART_NO and the same CDATE, both should be showed in the same row. ( like the second row in my example result)
    i tried so much and came up with several huge and also time consuming queries, but then i read abt FULL OUTER JOIN somewhere and tried using that. here is what i came up with :
    SELECT
    PART_NO , CDATE , sum(II.QTY) I_QTY , SUM (OI.QTY) O_QTY
    FROM
         (OUTGOING O INNER JOIN OUTGOING_ITEM OI USING ( OID ) )
    FULL OUTER JOIN
         (INCOMMING I INNER JOIN INCOMMING_ITEM II USING ( IID ) )
    ON ( I.CDATE = O.CDATE AND II.PART_NO = OI.PART_NO)
    WHERE
    I.CDATE = :PARAMETER1
    AND O.CDATE = :PARAMETER1
    GROUP BY
    PART_NO , CDATE
    this query is short and fast , but the results r not what i expected. i mean, although i have used FULL OUTER JOIN in the query , but the results i get r sth like this :
    part_no     cdate     O_qty     I_qty
    100     01/05/07     20     60
    300     01/06/02     30     40
    which means only the rows that has both values are returned.
    any change i make to this query would make the SQL* PLUS hang , like when i use the cartesian product of two large tables, so i guess my changes wheren't in the right direction.
    i think its possible to write this query using FULL OUTER JOIN syntax, but i just can't find it.
    Can anybody pleaseeeeeeeeeeeee help me?
    thanx in advance,
    Maryam.

    Note: I wrote this on the fly -- hope there is no syntax errors, otherwise forgive me -- but you get the idea..
    select
    fromUnionAll.cdate, fromUnionAll.part_no,
    sum(fromUnionAll.O_qty) O_qty,
    sum(fromUnionAll.I_qty) I_qty
    from
    select
    iinner.cdate, iinner.part_no, 0 O_qty, iinner.I_qty
    from
    select
    i.cdate, ii.part_no,
    /* added the case only for the extreme case when there is
    no record anywhere for the given CDATE in INCOMMING_item */
    sum( ( case when ii.qty is not null then ii.qty else 0 end) ) I_qty
    from
    incomming i,
    incomming_item ii
    where
    i.iid = ii.iid (+)
    group by i.cdate, ii.part_no
    ) iinner
    union all
    select
    oinner.cdate, oinner.part_no, oinner.O_qty, 0 I_qty
    from
    select
    o.cdate, oi.part_no,
    /* added the case only for the extreme case when there is
    no record anywhere for the given CDATE in OUTGOING_item */
    sum( ( case when oi.qty is not null then oi.qty else 0 end) ) O_qty
    from
    outgoing o,
    outgoing_item oi
    where
    o.oid = oi.oid (+)
    group by o.cdate, oi.part_no
    ) oinner
    ) fromUnionAll
    group by fromUnionAll.cdate, fromUnionAll.part_no;
    --Samson                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query of query with left outer join

    Hi,
    I cannot use joins in query of query, I try the old method using the ( + ) but no luck "Query Of Queries syntax error. Encountered ( + )."
    Here is an example of my query code:
    select p.part_id, s.supplier_name, s.second_name
    from part p, supplier s
    where p.supplier_id = s.supplier_id ( + )
    and  p.second_id = s.second_id ( + );
    PART SUPPLIER_NAME  SECOND_NAME
    P1   Supplier#1     A
    P2   Supplier#2
    P3
    P4
    How can I do the same in query of query syntax?
    Thanks!

    I found a solution:
    http://www.bealearts.co.uk/blog/2007/06/20/how-to-do-an-outer-join-in-query-of-queries/
    I am not sure about my second condition. i create the join query for the empty columns.
    select part.part_id, supplier.supplier_name, supplier.second_name
    from part, supplier
    where part.supplier_id = supplier.supplier_id
    and  supplier.second_id is null
    union
    select part.part_id, supplier.supplier_name, supplier.second_name
    from part, supplier
    where part.supplier_id = supplier.supplier_id
    and  part.second_id = supplier.second_id
    union
    select part.part_id, joinQuery.supplier_name, joinQuery.second_name
    from part, joinQuery
    where part.supplier_id not in (#ValueList(supplier.supplier_id)#)
    Can anyone check and let me know if this is correct?
    My final result have one less row from parts table.
    Thanks

  • Select List or Radio Buttons query with multiple tables join

    Hello,
    I'm having a problem creating a select list or a radio group item.
    I need to display the emp_first_name in the select list but have the return value of the order_id in the select list or radio buttons item.
    The tables are as follow:
    emp_table
    emp_id
    emp_first_name
    emp_last_name
    etc...
    orders_table
    order_id
    order_name
    emp_id
    etc...
    I need to display the emp_name from emp_table in the select list but return the order_id from the orders_table as the return value.
    How can I do this?
    Any help would be greatly appreciated.
    Thanks.
    Regards,
    NJ

    Hi NJ,
    Try:
    select e.emp_first_name d,
    o.order_id r
    from orders_table o
    inner join emp_table e on o.emp_id = e.emp_id
    order by 1You may have an issue with an emp_id being used for more than one order and, therefore, the employee's name appearing more than once in the list?
    Andy

  • BaseTableName blank when calling GetSchema on a query with multiple tables

    I am using ODP.NET 11.2.0.3.0 and when calling GetSchemaTable on a DataReader that contains a join the returned SchemaTable has the BaseTableName and BaseColumnName fields blank - this is different than what I see with the Oracle OLE DB Provider and with how SQL Server's native provider works. I can't find any discussion of this - is this on purpose or is it a bug? why does the available schema information vary so drastically between a single table query and a query with multiple tables joined?
    Thanks,
    Bryan Hinton

    Hi Bryan,
    I am also facing the same issue. Did u find any work around or any suggestions will be well appreciated.
    Thanks,
    Naresh.

  • Oracle hangs on query with multiple joins

    To test the sotftware from the LMS-vendor that are out partners we use virtual machines where we install Windows 2003 servers and Oracle XE
    While we were testing the software I've found that a particular query with multiple unions causes the CPU of the virtual machine totally claimed by oracle
    The query causes oracle to hang.
    I've found that the subcomponents of the query all return 0 rows (and response all immediately) combined into a query with at least 2 unions the query hangs the system
    I'm not familiar with with Database Management at all
    I've read something about SGA and PGA that could be the issue and tried to increase the target for both but it doesn't seem to do anything
    Some characterics
    Target Current
    Maximum System Global Area (SGA) Size: 380 MB 380 MB
    Program Global Area (PGA) Aggregate Target: 360 MB 38 MB
    Current Configuration: (SGA + PGA): 740 MB 418 MB
    Tablespaces Percent Used Allocated (MB) Used (MB) Datafiles
    SYSAUX 98.21% 460.00 451.75 1
    SYSTEM 73.09% 510.00 372.75 1
    DATA 99.13% 440.00 436.19 1
    UNDO 6.48% 160.00 10.38 1
    USERS 1.63% 100.00 1.63 1
    sort_area_size 65536
    shared_pool_reserved_size 5452595 TRUE size in bytes of reserved area of shared pool
    shared_pool_size 0 TRUE size in bytes of shared pool
    What other parameters are important? How could I get a good picture to see what's really going on?
    Some pointers, help would be appreciated.
    Regards,
    Remco

    Below is the base-query that is causing the problems
    SELECT /* Public - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no order_number, e.id person_id, format_name(e.fname , e.lname , @@005) learner_name , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description item_desc, substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_company c ON e.company_id = c.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Public - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Public - Unassigned learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , null person_id, null , null company_id, null , ent.id entidd, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,'' org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,'' learner_first_name ,'' learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND r.student_id is null AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND @@003 is null
    UNION
    SELECT /* Private - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Private - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.locale_id = @@005 AND orderList.list_id = 'sysli000000000000129' LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003)) ORDER BY 34,35,28,29,31,30,33,32

  • Multiple Outer join in ORACLE 8.1.6

    Hi ,
    Can anybody suggest me how can i use multiple outer join on one table. I'm using ORACLE 8.1.6.
    I know this version of oracle doesnt support this. But is there anmy other wa\y I can achieve this.
    Thanks amd Regards
    Deependra

    Tricky question - but I went through this about 3 months ago, and found a good thread on here that explains it pretty well.
    check out Re: Outer join a table with two diff table
    You basically will have to create an inline view with one outer join in there, and then a second outer join on the outside. Read through the posts in that thread and it should help!

  • How to have a condition with the outer join

    Hi, I'd like to know if, inside a report, there's a way to create a condition which include in some way an outer join.
    So, I have 2 custom folders:
    Tickets with 2 fields: Ticket_id, Inventory_item_id, category_id and iptv_sumptom
    Hierarchy with 4 fields: Symptom, Inv_item_id, Category_id and Group
    These 2 folders are joined in this way
    Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)
    Now, from the report I have a parameter based on the field Group to restrict dataset of the tickets.
    ...but when I choose a group and I run the report, the conditions inside the plsql query generated is like this
    WHERE (Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)) AND Hierarchy.Group = 'A'
    where the last condition is WITHOUT outer join !
    I need to have also the outer join on the Hierarchy.Group: AND Hierarchy.Group (+) = 'A', but from the Administrator I don't want to add another join with (+) for the Group. From Plus I didn't find any way to write (+).....
    Anybody knows another method or workaround to have also a filter (the condition Hierarchy.Group = 'A') with an outer join ?
    Thanks in advance
    Alex

    Hi,
    A workaround can be either use new objects or modify the existing ones to avoid the outer join.
    In order to do that you can add a dummy record to each custom folder and then join by it.
    For example if you will add to the
    Tickets will be:
    select Ticket_id, Inventory_item_id, category_id, iptv_sumptom
    from......
    union all
    select -1,-1,-1,'Some value' from dual
    And hierarchy will be:
    select Symptom, Inv_item_id, Category_id ,Group
    from......
    union all
    select 'Some value',-1,-1,'Some value' from dual
    Now you can create a full join between them without the need to outer join.
    Hope it will help
    Tamir

  • Set READ UNCOMMITED for a query with a table join (Ver 12.5. and 15.5)

    Hi all,
    this is an example of how to set the READ UNCOMMITED isolation level for a simple query:
    select col_a from mytable at isolation 0
    What about a query with an equi-join?
    Is it:
    select col_a
    from mytable t1, mytable t2
    at isolation 0
    I am sorry for the simple question, I did not find a auitable example in the documentation.
    Best Regards
    Arthur

    Yeah, the docs aren't very good at providing a robust set of examples so you've gotta:
    1 - review the command syntax and then
    2 - try a few examples until you find the format that works
    1 - From the ASE 15.5 Commands reference manual we find the following syntax:
    =========================
    select ::=
              select [all | distinct]
              [top unsigned_integer]
              select_list
              [into_clause]
              [from_clause]
              [where_clause]
              [group_by_clause]
              [having_clause]
              [order_by_clause]
              [compute_clause]
              [read_only_clause]
              [isolation_clause]
              [browse_clause]
              [plan_clause]
    =========================
    This shows us that the isolation clause is attached at the 'end' of the query as a query-level specifier (along with the 'group by', 'order by' and 'having' clauses).
    From this syntax I'd say your proposed query looks correct so ...
    2 - Try running your example to see if you get a syntax error ("When in doubt, try it out!"), eg:
    =========================
    select s.name,c.name
    from sysobjects s, syscolumns c
    where s.id = c.id
    at isolation 0
    go
    name
    sysobjects
    sysobjects
    sysobjects
    ... snip ...
    =========================

  • Update Statement with left outer join

    hi,
    i have to update a column in table "a" from table "b" and both of them joined with left outer join
    How can I do this
    Thanks in Advance

    Please consider the following when you post a question. This would help us help you better
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Doubt in Firing Query with multiple opportunities UUID/IDs

    HI Folks!
    I might have simple doubt but please help me on this!
    1. I have a custom BO with association to opportunities.
    [DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade {
    [AlternativeKey] [Label("Trade Id")] element tradeid : BusinessTransactionDocumentID;
    node RelatedOpportunities [0,n]{
                                  element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
                                  element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
                                   association RelatedOpportunity[0,1] to Opportunity;
    2. I have success fully used association and i am able to view create all the opportunities related to my custom Bo.
    ISSUE : I want a facet where i just want DISPLAY the activities and sales document assigned in the RELATED OPPORTUNITIES ( N opportunities )
    How do i query with Multiple opportunities ID and fetch the activities against it?
    Btw I want to use query in UI Designer... I have created an  advanced list pane and there i want the result list
    I hope i am clear!
    Thanks in adavance...
    Regards
    Dhruvin

    Hi Ludger,
    I have successfully displayed Related Opportunities associated with trade.( i am able to create , delete also )
    Issue : I am not able to "Display" ( i don't need to edit or create ) all the activities created against all the opportunities in a different tab.
    I tried to approaches :
    1: Query : Created a Query on Activity BO and tried to pass multiple related opportunities ( but seems not possible , please tell me any possibility to pass range of opportunity via transformation or anything? )
    2 : binding : I have a Node Related Opportunity so just tried to bind it with BO model but problem is it is displaying all the activities of first opportunity of the list...
    i think why because :
    In Data model I have created a table bind with Related Opportunities...
    now that node is 1 to N , association to opportunity 0 to 1 , hence i think it fetches only 1 opportunities activity
    should i create like below ( Or is it possible)
    Node Reltdoppts[0,1]
    association [0,N] to opportunity BO ?
    Although i strongly feel SAP should provied us two things :
    1. We need to pass range of opportunities in a query.
    2. We need to just write some absl code where i can fill the table and display it
    and also is there any possibility to create a report or something to display activities as we just want to display the activities!
    P.S : I have been getting a lot of bashing from client because some of the product restriction in cloud! i hope and wish SAP give developers free hand to develop right now its like our hands are tied to many things

  • Web service with multiple out parameters

    Hi Developers,
    I have been playing around with som web services in the developer studio.
    I can create a webservice from a normal ejb.
    But i can only get one out parameter, which is the return parameter of the ejb.
    I tried to make an object to use as return parameter, but then i couldn't use the method for the web service.
    Can anyone tell me how to make a web service with multiple out parameters?
    Br Rasmus

    Hi Developers,
    I have the same question, is it possible to have multiple outgoing parameters?
    When not, does SAP Netweaver knows a IN-OUT parameter? Because I found on the internet that it is possible to have a IN-OUT parameter. But that was with the BEA Weblogic 8.x.
    When not, is then the only solution to return a object? With in this object all the parameters you want.
    Or otherwise is there a other workaround?
    Thanks in advance,
    Marinus Geuze

  • APD using Query with multiple structures as a data source

    All,
    I want to set up an automatic process which executes a query and exports it to a shared drive as a csv file. I have tried various options , when I try to use APD to set up the extract, I get an error and this is because the query that I am trying to use has Strucutres in both rows and columns. Hence, I am unable to use this option. I tried RSCRM_BAPI, It works well, but there is an issue with scheduling this in Process chain. I created an event and scheduled this as a job to trigger after "event" as per SAP instructions, but the job does not exist and it is not possible to trigger it through the Process chain unless the variables are hard coded in the query which I do not want to do.
    Can any one tell me if there is a way to deal with APD using Query with multiple structures?
    Would really appreciate if some one can give me the right solution...
    Thanks

    Hi Tanu ,
    APD is an option but its not very good with large amount of data or hiearachies or if you have attributes in you query structure .
    One more option for this requirement is use of report program using function module RRW3_GET_QUERY_VIEW_DATA .
    This will work fine with multiple structure etc .
    There are some overheads with this FM  ex: if amount of data is too much then program will give dump .Solution for that is we call the FM in LOOP by diving amount of data need to be fetched .ex:  we can read data quarter wise.
    For using this function module what you can do is write an ABAP program (At SE38 ) .which will call this FM and then write the output into a flat file which you can save at application server (AL11) .From there other system can read it .
    To automate this whole process you can further add all the report programs into a process chain (RSPC) which can be schedule as per requirement .
    To pass input parameters you can use variants that will pass the values to the report .
    Check thi link for sample code :
    [http://www.tricktresor.de/content/index.php?navID=696&aID=496]
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

  • Sql query with multiple joins to same table

    I have to write a query for a client to display business officers' names and title along with the business name
    The table looks like this
    AcctNumber
    OfficerTitle
    OfficerName
    RecKey
    90% of the businesses have exactly 4 officer records, although some have less and some have more.
    There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
    An individual account can have 30 or 40 records on the other table.
    The client wants to display 1 record per account.
    Initially I wrote a query to join the table to itself:
    Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber
    This returned tons of duplicate rows for each account ( number of records * number of records, I think)
    So added
    And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
    This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
    But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
    I tried select distinct on the other table and the query runs for ever and never returns anything
    I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
    Any suggestions would be appreciated

    Welcome to the forum!
    user13319842 wrote:
    I have to write a query for a client to display business officers' names and title along with the business name
    The table looks like this
    AcctNumber
    OfficerTitle
    OfficerName
    RecKey
    90% of the businesses have exactly 4 officer records, although some have less and some have more.
    There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
    An individual account can have 30 or 40 records on the other table.
    The client wants to display 1 record per account.As someone has already mentioned, you should post CREATE TABLE and INSERT statements for both tables (relevant columns only). You don't have to post a lot of sample data. For example, you need to pick 1 out of 30 or 40 rows (max) for the same account, but it's almost certainly enough if you post only 3 or 4 rows (max) for an account.
    Also, post the results you want from the sample data that you post, and explain how you get those resutls from that data.
    Always say which version of Oracle you're using. This sounds like a PIVOT problem, and a new SELECT .... PIVOT feature was introduced in Oracle 11.1. If you're using Oracle 11, you don't want to have to learn the old way to do pivots. On the other hand, if you have Oracle 10, a solution that uses a new feature that you don't have won't help you.
    Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data, the results you want from that data, an explanation, and your Oracle version.
    Initially I wrote a query to join the table to itself:
    Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber Be careful, and post the exact code that you're running. The statement above can't be what you ran, because it doesn't have a FROM clause.
    This returned tons of duplicate rows for each account ( number of records * number of records, I think)
    So added
    And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
    This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
    But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
    I tried select distinct on the other table and the query runs for ever and never returns anything
    I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
    Any suggestions would be appreciatedDisplaying 1 column from n rows as n columns on 1 row is called Pivoting . See the following link fro several ways to do pivots:
    SQL and PL/SQL FAQ
    Pivoting requires that you know exactly how many columns will be in the result set. If that number depends on the data in the table, then you might prefer to use String Aggregation , where the output consists of a huge string column, that contains the concatenation of the data from n rows. This big string can be formatted so that it looks like multiple columns. For different string aggregation techniques, see:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    The following thread discusses some options for pivoting a variable number of columns:
    Re: Report count and sum from many rows into many columns

  • Performance tuning of sql query with multiple joins

    My query takes at least half an hour to execute and the number of records returned are approx 1 lakh records.
    Structure of tables are:
    tblSession : ID,option1,option2,option3,option4,option5,option6,option7,option8,option9.
    tblOption : ID, labelID
    tblLabelDetail  : ID, LABELID, text
    optionID 1 to optionID9 are Foreign keys to table tblOption.ID
    My query is as below : 
    select 
    session.ID 
    ,session.tstamp
    ,session.score
    ,session.hid1
    ,session.hID2
    ,session.hID3
    ,session.collectionID
    ,session.consumerID
    ,session.langID
    ,cons_cust.text1 as    customCons_text1, 
    cons_cust.text2 as customCons_text2, 
    cons_cust.text3 as customCons_text3,
    cons_cust.text4 as customCons_text4,
    cons_cust.text5 as customCons_text5,
    cons_cust.text6 as customCons_text6,
    cons_cust.text7 as customCons_text7,
    cons_cust.text8 as customCons_text8,
    cons_cust.text9 as customCons_text9,
    ld_cons1.text as customCons_option1GUID, 
    ld_cons2.text as customCons_option2GUID, 
    ld_cons3.text as customCons_option3GUID, 
    ld_cons4.text as customCons_option4GUID ,
    ld_cons5.text as customCons_option5GUID, 
    ld_cons6.text as customCons_option6GUID, 
    ld_cons7.text as customCons_option7GUID, 
    ld_cons8.text as customCons_option8GUID, 
    ld_cons9.text as customCons_option9GUID,
    --session
    session_cust.text1 as  session_cust_text1, 
    session_cust.text2 as session_cust_text2, 
    session_cust.text3 as session_cust_text3,
    session_cust.text4 as session_cust_text4,
    session_cust.text5 as session_cust_text5,
    session_cust.text6 as session_cust_text6,
    session_cust.text7 as session_cust_text7,
    session_cust.text8 as session_cust_text8,
    session_cust.text9 as session_cust_text9,
    ld_sess1.text as session_cust_option1GUID, 
    ld_sess2.text as session_cust_option2GUID, 
    ld_sess3.text as session_cust_option3GUID, 
    ld_sess4.text as session_cust_option4GUID, 
    ld_sess5.text as session_cust_option5GUID, 
    ld_sess6.text as session_cust_option6GUID, 
    ld_sess7.text as session_cust_option7GUID, 
    ld_sess8.text as session_cust_option8GUID, 
    ld_sess9.text as session_cust_option9GUID, 
    session_cust.tStamp1,
    session_cust.tStamp2
    from mvSession session with (noexpand)
    inner join tblCollection c on c.ID=session.collectionID AND c.templateID = 405
    left join tblConsumer cons on cons.ID=session.consumerID and cons.sessionYM between 601 and 1412 and cons.sID=105
    left join vCustomConsumer cons_cust on cons_cust.sessionYM between 601 and 1412 and cons_cust.sID=105 and cons_cust.ID=cons.ID
    left join tbloption o_cons1 on o_cons1.id = cons_cust.option1 and  o_cons1.sid = 105
    left join tblLabelDetail ld_cons1 on ld_cons1.labelID = o_cons1.labelID and ld_cons1.langId = 1 and ld_cons1.eid = 107 
    left join tbloption o_cons2 on o_cons2.id = cons_cust.option2 and  o_cons2.sid = 105
    left join tblLabelDetail ld_cons2 on ld_cons2.labelID = o_cons2.labelID and ld_cons2.langId = 1 and ld_cons2.eid = 107 
    left join tbloption o_cons3 on o_cons3.id = cons_cust.option3 and  o_cons3.sid = 105
    left join tblLabelDetail ld_cons3 on ld_cons3.labelID = o_cons1.labelID and ld_cons3.langId = 1 and ld_cons3.eid = 107 
    left join tbloption o_cons4 on o_cons4.id = cons_cust.option4 and  o_cons4.sid = 105
    left join tblLabelDetail ld_cons4 on ld_cons4.labelID = o_cons4.labelID and ld_cons4.langId = 1 and ld_cons4.eid = 107 
    left join tbloption o_cons5 on o_cons5.id = cons_cust.option5 and  o_cons5.sid = 105
    left join tblLabelDetail ld_cons5 on ld_cons5.labelID = o_cons5.labelID and ld_cons5.langId = 1 and ld_cons5.eid = 107 
    left join tbloption o_cons6 on o_cons6.id = cons_cust.option6 and  o_cons6.sid = 105
    left join tblLabelDetail ld_cons6 on ld_cons6.labelID = o_cons6.labelID and ld_cons6.langId = 1 and ld_cons6.eid = 107 
    left join tbloption o_cons7 on o_cons7.id = cons_cust.option7 and  o_cons7.sid = 105
    left join tblLabelDetail ld_cons7 on ld_cons7.labelID = o_cons7.labelID and ld_cons7.langId = 1 and ld_cons7.eid = 107 
    left join tbloption o_cons8 on o_cons8.id = cons_cust.option8 and  o_cons8.sid = 105
    left join tblLabelDetail ld_cons8 on ld_cons8.labelID = o_cons8.labelID and ld_cons8.langId = 1 and ld_cons8.eid = 107 
    left join tbloption o_cons9 on o_cons9.id = cons_cust.option9 and  o_cons9.sid = 105
    left join tblLabelDetail ld_cons9 on ld_cons9.labelID = o_cons9.labelID and ld_cons9.langId = 1 and ld_cons9.eid = 107 
    left join vCustomSession session_cust on session_cust.sessionYM between 601 and 1412 and session_cust.sID=105 and session_cust.ID=session.ID
    left join tbloption o_sess1 on o_sess1.id = session_cust.option1 and  o_sess1.sid = 105
    left join tblLabelDetail ld_sess1 on ld_sess1.labelID = o_sess1.labelID and ld_sess1.langId = 1 and ld_sess1.eid = 107 
    left join tbloption o_sess2 on o_sess2.id = session_cust.option2 and  o_sess2.sid = 105
    left join tblLabelDetail ld_sess2 on ld_sess2.labelID = o_sess2.labelID and ld_sess2.langId = 1 and ld_sess2.eid = 107 
    left join tbloption o_sess3 on o_sess2.id = session_cust.option3 and  o_sess3.sid = 105
    left join tblLabelDetail ld_sess3 on ld_sess3.labelID = o_sess2.labelID and ld_sess3.langId = 1 and ld_sess3.eid = 107 
    left join tbloption o_sess4 on o_sess4.id = session_cust.option4 and  o_sess4.sid = 105
    left join tblLabelDetail ld_sess4 on ld_sess4.labelID = o_sess4.labelID and ld_sess4.langId = 1 and ld_sess4.eid = 107 
    left join tbloption o_sess5 on o_sess5.id = session_cust.option5 and  o_sess5.sid = 105
    left join tblLabelDetail ld_sess5 on ld_sess5.labelID = o_sess5.labelID and ld_sess5.langId = 1 and ld_sess5.eid = 107 
    left join tbloption o_sess6 on o_sess6.id = session_cust.option6 and  o_sess6.sid = 105
    left join tblLabelDetail ld_sess6 on ld_sess6.labelID = o_sess6.labelID and ld_sess6.langId = 1 and ld_sess6.eid = 107 
    left join tbloption o_sess7 on o_sess7.id = session_cust.option7 and  o_sess7.sid = 105
    left join tblLabelDetail ld_sess7 on ld_sess7.labelID = o_sess7.labelID and ld_sess7.langId = 1 and ld_sess7.eid = 107 
    left join tbloption o_sess8 on o_sess8.id = session_cust.option8 and  o_sess8.sid = 105
    left join tblLabelDetail ld_sess8 on ld_sess8.labelID = o_sess8.labelID and ld_sess8.langId = 1 and ld_sess8.eid = 107 
    left join tbloption o_sess9 on o_sess9.id = session_cust.option9 and  o_sess9.sid = 105
    left join tblLabelDetail ld_sess9 on ld_sess9.labelID = o_sess9.labelID and ld_sess9.langId = 1 and ld_sess9.eid = 107 
    where session.sID=105  and session.tStamp >= 'Sep  1 2014 12:00AM' and session.tStamp < 'Dec 12 2014 12:00AM'   
    order by session.tStamp, session.ID
    Is there a way , where i can simplify the joins with tbloption and tblLabelDetail and get my o/p in optimal time.
    Regards 

    I have headed towards another approach ie. using unpivot and then pivot.
    First i am converting option1-option9 into column , then doing  PIVOT to get back the same record . But issue is that when i am doing pivoting i am getting NULL values.
    My query is :
    select * into #t1  from
    select ID
    , option1
    , option2
    , option3
    , option4
    , option5
    , option6
    , option7
    , option8
    , option9
    from vCustomConsumer
    where sid=105
    and sessionYM = 1412 
    ) SourceTable
    UNPIVOT
       optionID FOR Col IN
        (option1 
    ,option2
    ,option3 
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9 )
    ) AS unpvt
    select t.ID,t.optionID,t.col,cast(ld.text as varchar(max)) as text into #t2
    from #t1 t
    left outer join tbloption o on o.ID =  t.optionID
    left outer join tblLabelDetail ld on ld.labelID = o.labelID and ld.langID=1 
    order by ID,col
    select ID,option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    from
    select ID,optionID,col,text
    from #t2
    )up
    pivot 
    min(text)for col in 
    (option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    )as pvt
    In my last query where i am using pivot, i am getting NULL values. When i check the data in temp table #t2 , it exists perfectly . But when pivoting i dont understand why it is returning most of the NULL values. I am getting data for only one column in single
    row.
    Below are some rows from result set finally obtained after pivoting :
    ID
    option1
    option2
    option3
    option4
    option5
    option6
    option7
    option8
    option9
    62949026
    NULL
    0 to 200 seconds
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966000
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966032
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    63090372
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    63090375
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    Thanks,

Maybe you are looking for

  • I use Yahoo and certain features have stopped working. What do I do?

    Any option in my inbox that has a drop-down arrow stopped working. I can't move emails, I can't reply to all when I get emails sent to many others, etc. I contacted yahoo and they said this is not a yahoo issue, that it must be with my browser. I thi

  • How to fix everything when power goes out during install? [SOLVED]

    last night I was installing kde and during the install process the power went out. I tried uninstalling kde, but pacman said dependencies were missing (I need dependencies to remove stuff?), so I tried reinstalling the kde group and that seems to hav

  • Alert by mail or Alert by RWB alert inbox....

    Hi If  I am in setting -> configuration->Smtp forwarding as XML  in order to set up a mail for XI Alert error did that mean that won´t receive alert in the RWB alert Inbox ? Can I implement both of functionalities (alert by mail and alert in rwb aler

  • Aperture Not Recognizing iPhone Jpegs

    Has anyone else had a problem with Aperture having issues with jpegs from iPhones while having no problems with jpegs out of other cameras? The problem is characterized by selected jpegs turning back and displaying a triangle with exclamation mark an

  • Apple TV in Verbindung mit Airport Time capsule verwenden?

    Ich möchte gern meine Daten, Musik und Filme auf dem Airport Time Capsule speichern und mit dem Apple TV abrufen. Geht das? Es ist nervig erst den PC zu starten zu müssen um einen Film aus der Datenbank bei iTunes zu sehen. Es muss dich auch einfache