How to achieve an outer join with existsNode() function

I have a requirement to do an outer join with existsNode() function in my where clause. At present my where clause for join is like below
WHERE A.SOME_ID= “XYZ”
AND existsNode (B.SOMEXML_FEILD , …. ) = 1
AND existsNode (C.SOMEOTHERXML_FEILD , …. ) = 1
In this case if the existsNode fails on B or C, I still want data from A to be selected. How to rewrite this query to achieve that? I kinda want to achieve an outer join

Hi,
is this what you are looking for:
SQL> with t as(select 1 id1,'A' name from dual union all
  2            select 2 ,'B' name from dual union all
  3            select 3,'C' from dual)
  4      ,x as(select 1 id2,xmltype('<a>a</a>') xcol from dual union all
  5            select 2 ,xmltype('<b>b</b>') xcol from dual)
  6  select *
  7  from t,x
  8  where t.id1=x.id2(+)
  9    and (existsNode(x.xcol,'/a')=1 or x.xcol is null);
       ID1 N        ID2 XCOL                                                   
         1 A          1 <a>a</a>                                               
         3 C                                                                   
SQL> spool off;

Similar Messages

  • Outer join with NVL function

    Hello
    I am trying to translate the following Sybase Query to Oracle . I am running the query on a 10gR1 database.
    The problem is with the NVL clause on the join I am getting a runtime exception .
    Is there a way to re-write this query without breaking the functionality.
    SELECT t1.*,
    NVL(t2.Branch_name, t3.Branch_name)
    FROM table1 t1
    LEFT OUTER JOIN
    table2 t2
    ON (t1.Account_id = t2.Account_id)
    LEFT OUTER JOIN
    table3 t3
    ON (t1.Account_id = t3.Account_id)
    LEFT OUTER JOIN
    table4 t4
    ON (NVL(t2.Branch_Name, t3.Branch_Name) = t4.cost_centre);
    Thanks

    The original query had a insert statement and it was failing with ORA-01400 even though the select query fetched 0 rows
    Insert into Branch_Master
    SELECT t1.*,
    NVL(t2.Branch_name, t3.Branch_name)
    FROM table1 t1
    LEFT OUTER JOIN
    table2 t2
    ON (t1.Account_id = t2.Account_id)
    LEFT OUTER JOIN
    table3 t3
    ON (t1.Account_id = t3.Account_id)
    LEFT OUTER JOIN
    table4 t4
    ON (NVL(t2.Branch_Name, t3.Branch_Name) = t4.cost_centre);
    ksedmp: internal or fatal error
    ORA-01400: cannot insert NULL into ("<<schema_name>>"."Branch_Master"."BRANCH_NAME")
    I have re-written the query using a Inline view . Can you please review and let me know if it is ok
    select * from
    ( SELECT t1.*,
    NVL(t2.Branch_name, t3.Branch_name) Branch_name_final
    FROM table1 t1
    LEFT OUTER JOIN
    table2 t2
    ON (t1.Account_id = t2.Account_id)
    LEFT OUTER JOIN
    table3 t3
    ON (t1.Account_id = t3.Account_id) ) IV_Temp
    LEFT OUTER JOIN Table4 on (IV_temp.Branch_name_final = T4.cost_centre ;

  • Outer Join with Where Clause in LTS

    HI all,
    I have a requirement like this in ANSI SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
    and p2.product_group = 'NEW'
    In Regular SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1, product_group p2
    WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
    In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
    p2.product_group = 'NEW' in WHERE clause of LTS.
    This doesn't seem to solve purpose.
    Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
    product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
    I am using Version 10.1.3.4.1
    Creating an Opaque view would be my last option though.

    Hello
    I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
    Try this solution which worked for me (using your example ) -
    1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
    PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID  AND  PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL' 
    2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP  table and select Join Type as Left Outer Join.
    3. Check Consistency and make sure there are no errors .
    when you run a request you should see the following query generated -
    select distinct T26908.PROD_ID as c1,
         T26908.PROD_NAME as c2,
         T26912.GROUP_NAME as c3
    from
         PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
    order by c1, c2, c3
    Hope this works for you. If it does please mark this response as 'Correct' .
    Good Luck.

  • How to use left outer joins ,right outer joins and order by clause for belo

    Hi,
    How to use left outer joins ,right outer joins and order by clause for below XML query.
    The query which is red colour returns null then its not displaying any values for columns in that tables. Tried decode, nvl function hasn't worked.
    SELECT XMLAGG ( XMLELEMENT( "P", XMLFOREST( P.process_id AS Ppid,
              (SELECT XMLAGG( XMLELEMENT( "PI", XMLFOREST( PI.question_id AS PIqid,
                                       PI.process_id AS PIpid,
    PI.innertext AS
                                       PItext, PI.itemtype AS PItype,
                                       PI.linkfrom AS PIfrom,
                                       PI.linkto AS PIto,
    PI.associated AS PIas,
                                       PI.content_id AS PIc,
                                       PI.exitpoint1_id AS PIe1,
                                       PI.exitpoint2_id AS PIe2,
                                       PI.exitpoint3_id AS PIe3,
                                       PI.followoncall AS PIfoc,
    PI.userinput AS PIui,
                                       PI.resolveidentifier AS PIri,
    PI.libquestion_idfk AS PIlqid,
                                       PI.isLocked AS PIstls,
                                       PI.PreviousAnswer AS PIPAns,
                                       PI.VisibleToAgent AS PIVAgent,
                                       PI.RetryAttempt AS PIRetry,
                                       PI.Tags AS PITag,
                                  SELECT XMLAGG( XMLELEMENT( "PO", XMLFOREST( PO.option_id AS POoid,
                                       PO.question_id AS POqid,
                                                           PO.process_id AS popid,
                                                           PO.opt_innertext AS POtext,
                                                           PO.opt_linkfrom AS POfrom,
                                                           PO.opt_linkto AS POto,
                                                           PO.libquestion_idfk AS POlqid,
                                                           PO.liboption_idfk AS POloid ) ) )
                                  FROM vw_liveProcessOption_Sim_v6 PO
                                       WHERE PI.question_id = PO.question_id (+)
                                  AND PI.process_id = PO.process_id (+)
                                  ) "A" ) ) ) AS "PO"
         FROM vw_liveProcessItem_Sim_v6 PI
              WHERE P.process_id = PI.process_id
              ) "A" ) ) ) AS "PI"
    FROM liveProcess_ec P
    WHERE (P.process_id = 450)
    Any help really appreciated.
    Thanks

    user512743 wrote:
    Hi,
    Here below is the scripts of tables, insert statements and Required output.
    CREATE TABLE VW_LIVEPROCESSOPTION_SIM_v6
    (     "OPTION_ID" NUMBER,
         "QUESTION_ID" NUMBER(10,0),
         "PROCESS_ID" NUMBER(10,0),
         "OPT_INNERTEXT" VARCHAR2(200 CHAR),
         "OPT_LINKFROM" VARCHAR2(20 CHAR),
         "OPT_LINKTO" VARCHAR2(20 CHAR),
         "LIBQUESTION_IDFK" NUMBER,
         "LIBOPTION_IDFK" NUMBER
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,2,450,'Yes',null,'5',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,3,450,'Yes',null,'5',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,5,450,'Yes',null,'6',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,6,450,'Yes',null,'7',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,8,450,'Block All',null,'9',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,9,450,'Yes',null,'10',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,11,450,'Yes',null,'12',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,12,450,'Yes',null,'13',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (1,14,450,'Yes',null,'16',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,2,450,'No',null,'3',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,3,450,'No',null,'4',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,5,450,'No',null,'8',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,6,450,'No',null,'8',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,8,450,'Standard',null,'11',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,9,450,'No',null,'11',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,11,450,'No',null,'14',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,12,450,'No',null,'14',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (2,14,450,'No',null,'15',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (3,8,450,'Disabled',null,'12',null,null);
    Insert into VW_LIVEPROCESSOPTION_SIM_v6(OPTION_ID,QUESTION_ID,PROCESS_ID,OPT_INNERTEXT,OPT_LINKFROM,OPT_LINKTO,LIBQUESTION_IDFK,LIBOPTION_IDFK) values (4,8,450,'User Defined',null,'12',null,null);
    REATE TABLE "VW_LIVEPROCESSITEM_SIM_v6"
    (     "QUESTION_ID" NUMBER(10,0),
         "PROCESS_ID" NUMBER(10,0),
         "INNERTEXT" VARCHAR2(200 CHAR),
         "ITEMTYPE" VARCHAR2(50 CHAR),
         "LINKFROM" VARCHAR2(500 CHAR),
         "LINKTO" VARCHAR2(500 CHAR),
         "ASSOCIATED" VARCHAR2(200 CHAR),
         "CONTENT_ID" NUMBER,
         "EXITPOINT1_ID" NUMBER(10,0),
         "EXITPOINT2_ID" NUMBER(10,0),
         "EXITPOINT3_ID" NUMBER(10,0),
         "RESOLVEIDENTIFIER" VARCHAR2(40 CHAR),
         "LIBQUESTION_IDFK" NUMBER(10,0),
         "FOLLOWONCALL" NUMBER(1,0),
         "USERINPUT" VARCHAR2(200 CHAR),
         "ISLOCKED" NUMBER(1,0),
         "PREVIOUSANSWER" NUMBER(1,0),
         "VISIBLETOAGENT" NUMBER(1,0),
         "RETRYATTEMPT" NUMBER(10,0),
         "TAGS" VARCHAR2(50 BYTE)
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (1,450,'CBB1015 - Router Firewall Settinngs Process','Title',null,'2',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (2,450,'Is the customers PC Firewall turned off?','Question','1','2.2,2.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (3,450,'Advise the customer to turn off the PC Firewall in order to continue. Has this been done?','Question','2.2','3.2,3.1',null,278,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (4,450,'Advise the customer the PC Firewall must be switched off before this process????','ExitPoint','3.2',null,null,null,14,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (5,450,'Is the customer able to access the internet now?','Question','3.1,2.1','5.2,5.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (6,450,'Is the customer having a problem with a specific website?','Question','5.1','6.2,6.1',null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (7,450,'1536: CBB1008 - Browser Setup and Daignostics','SubProcess','6.1',null,'1536-1-0',null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (8,450,'What is the security level on the CPE Management page?','Question','6.2,5.2','8.4,8.3,8.2,8.1',null,279,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (9,450,'Change the security level to Standard. Does this resolve the customers issue?','Question','8.1','9.2,9.1',null,280,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (10,450,'Issue Resolved','ExitPoint','9.1',null,null,null,1,6,122,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (11,450,'Change the security level to Disabled. Is the customer able to browse the internet?','Question','9.2,8.2','11.2,11.1',null,281,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (12,450,'Change the security level to Standard. Is the customer able to browse the internet now?','Question','11.1,8.3,8.4','12.2,12.1',null,283,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (13,450,'Issue Resolved','ExitPoint','12.1',null,null,null,1,6,123,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (14,450,'Ask the customer to perform a master reset. Does this resolve their issue?','Question','12.2,11.2','14.2,14.1',null,282,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (15,450,'Faulty CPE','ExitPoint','14.2',null,null,null,1,6,124,null,null,null,null,null,null,null,null,null);
    Insert into VW_LIVEPROCESSITEM_SIM_v6 (QUESTION_ID,PROCESS_ID,INNERTEXT,ITEMTYPE,LINKFROM,LINKTO,ASSOCIATED,CONTENT_ID,EXITPOINT1_ID,EXITPOINT2_ID,EXITPOINT3_ID,RESOLVEIDENTIFIER,LIBQUESTION_IDFK,FOLLOWONCALL,USERINPUT,ISLOCKED,PREVIOUSANSWER,VISIBLETOAGENT,RETRYATTEMPT,TAGS) values (16,450,'Issue Resolved','ExitPoint','14.1',null,null,null,1,6,123,null,null,null,null,null,null,null,null,null);
    CREATE TABLE "LIVEPROCESS_EC_V"
    (     "PROCESS_ID" NUMBER(10,0),
         "USER_ID" NUMBER(10,0),
         "CREATED" TIMESTAMP (6)
    Insert into LIVEPROCESS_EC (PROCESS_ID,USER_ID,CREATED) values (450,7460,to_timestamp('21-APR-08 09.34.41.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'));
    Required O/P in XML format
    <P>
    <Ppid>450</Ppid>
    <PI>
    <PIqid>1</PIqid>
    <PIpid>450</PIpid>
    <PItext>CBB1015 - Router Firewall Settinngs Process</PItext>
    <PItype>Title</PItype>
    <PIto>2</PIto>
    <PO />
    </PI>
    <PI>
    <PIqid>2</PIqid>
    <PIpid>450</PIpid>
    <PItext>Is the customers PC Firewall turned off?</PItext>
    <PItype>Question</PItype>
    <PIfrom>1</PIfrom>
    <PIto>2.2,2.1</PIto>
    <PO>
    <POoid>1</POoid>
    <POqid>2</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>5</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>2</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>3</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>3</PIqid>
    <PIpid>450</PIpid>
    <PItext>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PItext>
    <PItype>Question</PItype>
    <PIfrom>2.2</PIfrom>
    <PIto>3.2,3.1</PIto>
    <PIc>278</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>3</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>5</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>3</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>4</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>4</PIqid>
    <PIpid>450</PIpid>
    <PItext>Advise the customer the PC Firewall must be switched off before this process????</PItext>
    <PItype>ExitPoint</PItype>
    <PIfrom>3.2</PIfrom>
    <PIe1>14</PIe1>
    <PO />
    </PI>
    <PI>
    <PIqid>5</PIqid>
    <PIpid>450</PIpid>
    <PItext>Is the customer able to access the internet now?</PItext>
    <PItype>Question</PItype>
    <PIfrom>3.1,2.1</PIfrom>
    <PIto>5.2,5.1</PIto>
    <PO>
    <POoid>1</POoid>
    <POqid>5</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>6</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>5</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>8</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>6</PIqid>
    <PIpid>450</PIpid>
    <PItext>Is the customer having a problem with a specific website?</PItext>
    <PItype>Question</PItype>
    <PIfrom>5.1</PIfrom>
    <PIto>6.2,6.1</PIto>
    <PO>
    <POoid>1</POoid>
    <POqid>6</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>7</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>6</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>8</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>7</PIqid>
    <PIpid>450</PIpid>
    <PItext>1536: CBB1008 - Browser Setup and Daignostics</PItext>
    <PItype>SubProcess</PItype>
    <PIfrom>6.1</PIfrom>
    <PIas>1536-1-0</PIas>
    <PO />
    </PI>
    <PI>
    <PIqid>8</PIqid>
    <PIpid>450</PIpid>
    <PItext>What is the security level on the CPE Management page?</PItext>
    <PItype>Question</PItype>
    <PIfrom>6.2,5.2</PIfrom>
    <PIto>8.4,8.3,8.2,8.1</PIto>
    <PIc>279</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>8</POqid>
    <popid>450</popid>
    <POtext>Block All</POtext>
    <POto>9</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>8</POqid>
    <popid>450</popid>
    <POtext>Standard</POtext>
    <POto>11</POto>
    </PO>
    <PO>
    <POoid>3</POoid>
    <POqid>8</POqid>
    <popid>450</popid>
    <POtext>Disabled</POtext>
    <POto>12</POto>
    </PO>
    <PO>
    <POoid>4</POoid>
    <POqid>8</POqid>
    <popid>450</popid>
    <POtext>User Defined</POtext>
    <POto>12</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>9</PIqid>
    <PIpid>450</PIpid>
    <PItext>Change the security level to Standard. Does this resolve the customers issue?</PItext>
    <PItype>Question</PItype>
    <PIfrom>8.1</PIfrom>
    <PIto>9.2,9.1</PIto>
    <PIc>280</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>9</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>10</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>9</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>11</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>10</PIqid>
    <PIpid>450</PIpid>
    <PItext>Issue Resolved</PItext>
    <PItype>ExitPoint</PItype>
    <PIfrom>9.1</PIfrom>
    <PIe1>1</PIe1>
    <PIe2>6</PIe2>
    <PIe3>122</PIe3>
    <PO />
    </PI>
    <PI>
    <PIqid>11</PIqid>
    <PIpid>450</PIpid>
    <PItext>Change the security level to Disabled. Is the customer able to browse the internet?</PItext>
    <PItype>Question</PItype>
    <PIfrom>9.2,8.2</PIfrom>
    <PIto>11.2,11.1</PIto>
    <PIc>281</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>11</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>12</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>11</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>14</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>12</PIqid>
    <PIpid>450</PIpid>
    <PItext>Change the security level to Standard. Is the customer able to browse the internet now?</PItext>
    <PItype>Question</PItype>
    <PIfrom>11.1,8.3,8.4</PIfrom>
    <PIto>12.2,12.1</PIto>
    <PIc>283</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>12</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>13</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>12</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>14</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>13</PIqid>
    <PIpid>450</PIpid>
    <PItext>Issue Resolved</PItext>
    <PItype>ExitPoint</PItype>
    <PIfrom>12.1</PIfrom>
    <PIe1>1</PIe1>
    <PIe2>6</PIe2>
    <PIe3>123</PIe3>
    <PO />
    </PI>
    <PI>
    <PIqid>14</PIqid>
    <PIpid>450</PIpid>
    <PItext>Ask the customer to perform a master reset. Does this resolve their issue?</PItext>
    <PItype>Question</PItype>
    <PIfrom>12.2,11.2</PIfrom>
    <PIto>14.2,14.1</PIto>
    <PIc>282</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>14</POqid>
    <popid>450</popid>
    <POtext>Yes</POtext>
    <POto>16</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>14</POqid>
    <popid>450</popid>
    <POtext>No</POtext>
    <POto>15</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>15</PIqid>
    <PIpid>450</PIpid>
    <PItext>Faulty CPE</PItext>
    <PItype>ExitPoint</PItype>
    <PIfrom>14.2</PIfrom>
    <PIe1>1</PIe1>
    <PIe2>6</PIe2>
    <PIe3>124</PIe3>
    <PO />
    </PI>
    <PI>
    <PIqid>16</PIqid>
    <PIpid>450</PIpid>
    <PItext>Issue Resolved</PItext>
    <PItype>ExitPoint</PItype>
    <PIfrom>14.1</PIfrom>
    <PIe1>1</PIe1>
    <PIe2>6</PIe2>
    <PIe3>123</PIe3>
    <PO />
    </PI>
    </P>
    Thanks in advance
    Edited by: user512743 on Nov 18, 2008 4:46 AM

  • Outer Join with an 'OR'

    I have a very complicated query to construct that requires the use of 'AND', 'OR', and Outer Joins. Oracle's 9i documentation says you can't use an outer join with an 'OR'.
    Can you suggest how I may return the correct records under the following conditions. There are 3 tables to join. Table A, Table B, and Table C. Tables A & B join with an = to common fields. The problem is with Table C.
    The way the application was designed, it has to track a parent and child relationship. As such, the field to relate may exist in 1 of 2 fields. Let's see if I can draw it out for you.
    Table A - Record 1
    (ID = 1)
    Table B - Record 1
    (ID =1 [this relates to Table A.ID]
    PID = 12345
    CID = 67899
    Site = A)
    Table C - Record 1
    (PID = 12345 [this relates to Table B.PID]
    CID = 67899
    Site = A)
    Table C - Record 2
    (PID = 67899 [This relates to Table B.CID]
    CID = 12345
    Site = A)
    Now, I need to relate Table A to Table B where A.ID = B.ID AND
    ((B.PID = C.PID AND B.CID = C.CID)
    OR
    (B.CID = C.PID AND B.PID = C.CID))
    AND
    B.SITE = C.SITE
    There may or may NOT be related records in Table C. That's the problem. This is where I need the outer join to get the all the records of the 1st two joins and only those that apply from the last join.
    Your help will be greatly appreciated.

    I'd create two queries, a join from b to c in each of those manners and then UNION ALL the results together.
    drop table junk_a;
    create table junk_a (
      id number );
    drop table junk_b;
    create table junk_b (
      id number,
      pid number,
      cid number,
      site varchar2(80) );
    drop table junk_c;
    create table junk_c (
      pid  number,
      cid  number,
      site  varchar2(80) );
    insert into junk_a values (1);
    insert into junk_b values (1, 12345, 67899, 'A');
    insert into junk_c values (12345, 67899, 'A');
    insert into junk_c values (67899, 12345, 'A');
    commit;
    SELECT b.*,
           c.site AS site_c
      FROM junk_b b,
           junk_c c
    WHERE c.pid(+) = b.pid
       AND c.cid(+) = b.cid
    UNION ALL
    SELECT b.*,
           c.site AS site_c
      FROM junk_b b,
           junk_c c
    WHERE c.cid(+) = b.pid
       AND c.pid(+) = b.cid;
    SELECT a.id,
           bc.pid,
           bc.cid,
           bc.site,
           bc.site_c
      FROM junk_a  a,
    SELECT b.*,
           c.site AS site_c
      FROM junk_b b,
           junk_c c
    WHERE c.pid(+) = b.pid
       AND c.cid(+) = b.cid
    UNION ALL
    SELECT b.*,
           c.site AS site_c
      FROM junk_b b,
           junk_c c
    WHERE c.cid(+) = b.pid
       AND c.pid(+) = b.cid
           )  bc
    WHERE bc.id(+) = a.id;

  • Outer Join with the query

    I have written the below query, our requirement is, Some employees have "Transport Allowance" but not "Project Allowance". For this, I tried to use OUTER JOIN with this query. But this query takes long time and failed. The following query works fine if the employee has both "Transport Allowance" and "Project Allowance" (without outer join) Now, I also need to retrieve the employees who have "Transport Allowance" but not "Project Allowance". How can I retrieve it?
    SELECT DISTINCT papf.employee_number
    , peev.screen_entry_value Transport_Allowance
    ,peev1.screen_entry_value Project_Allowance
    FROM apps.per_all_people_f papf
    ,apps.per_all_assignments_f paaf
    ,apps.pay_element_types_x petf
    ,apps.pay_element_types_x petf1
    ,apps.pay_element_types_x petf2
    ,apps.pay_element_entries_f peef
    ,apps.pay_element_entries_f peef1
    ,apps.pay_element_entries_f peef2
    ,apps.pay_element_entry_values_x peev
    ,apps.pay_element_entry_values_x peev1
    ,apps.pay_element_entry_values_x peev2
    ,apps.pay_input_values_x pivf
    ,apps.pay_input_values_x pivf1
    ,apps.pay_input_values_x pivf2
    WHERE
    papf.person_id = paaf.person_id
    AND paaf.assignment_id = peef.assignment_id
    AND paaf.assignment_id = peef1.assignment_id
    AND paaf.business_group_id = papf.business_group_id
    --Transport Allowance
    AND peef.element_entry_id = peev.element_entry_id
    AND petf.element_Name = 'Transport Allowance'
    AND pivf.element_type_id =petf.element_type_id
    AND pivf.name = 'Allowance'
    AND peev.input_value_id= pivf.input_value_id
    --Project Allowance
    AND peef1.element_entry_id = peev1.element_entry_id
    AND petf1.element_Name = "Project Allowance'
    AND pivf1.element_type_id = petf1.element_type_id
    AND pivf1.name = 'Allowance'
    AND peev1.input_value_id = pivf1.input_value_id
    AND (SYSDATE BETWEEN peev.effective_start_date AND peev.effective_end_date)
    AND (SYSDATE BETWEEN peev1.effective_start_date AND peev1.effective_end_date)
    AND (SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date)
    ORDER BY papf.employee_number
    Thanks in advance.

    I am using sames tables with alias to retrieve the columns values from the same table.
    Here is my query.
    SELECT DISTINCT papf.employee_number
    , peev.screen_entry_value Transport_Allowance
    ,peev1.screen_entry_value Project_Allowance
    FROM apps.per_all_people_f papf
    ,apps.per_all_assignments_f paaf
    ,apps.pay_element_types_x petf
    ,apps.pay_element_types_x petf1
    ,apps.pay_element_entries_f peef
    ,apps.pay_element_entries_f peef1
    ,apps.pay_element_entry_values_x peev
    ,apps.pay_element_entry_values_x peev1
    ,apps.pay_input_values_x pivf
    ,apps.pay_input_values_x pivf1
    WHERE
    papf.person_id = paaf.person_id
    AND paaf.assignment_id = peef.assignment_id
    AND paaf.assignment_id = peef1.assignment_id
    AND paaf.business_group_id = papf.business_group_id
    --Transport Allowance
    AND peef.element_entry_id = peev.element_entry_id
    AND petf.element_Name = 'Transport Allowance'
    AND pivf.element_type_id =petf.element_type_id
    AND pivf.name = 'Allowance'
    AND peev.input_value_id= pivf.input_value_id
    --Project Allowance
    AND peef1.element_entry_id = peev1.element_entry_id
    AND petf1.element_Name = "Project Allowance'
    AND pivf1.element_type_id = petf1.element_type_id
    AND pivf1.name = 'Allowance'
    AND peev1.input_value_id = pivf1.input_value_id
    AND (SYSDATE BETWEEN peev.effective_start_date AND peev.effective_end_date)
    AND (SYSDATE BETWEEN peev1.effective_start_date AND peev1.effective_end_date)
    AND (SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date)
    ORDER BY papf.employee_number
    Thanks in advance.

  • Outer join with BETWEEN clause

    Hi All,
    I have 2 tables (A and B) which i need to join. I need all records from table A and matching records from the table B. below is the structure.
    TABLE A (total rows = 10)
    ROW_WID
    GL_DATE
    LOCATION_CODE
    TABLE B (total = 7)
    ROW_WID
    START_DATE
    END_DATE
    LOCATION_CODE
    Initially, we were asked to join based on location_code. In the table B, some of the LOCATION_CODE are missing, which is present in table A.
    We wrote below query
    SELECT A.*, B.START_DATE, B.END_DATE
    FROM A, B
    WHERE A.LOCATION_CODE = B.LOCATION_CODE (+)
    This gives 10 records, where 3 records have START_DATE and END_DATE NULL. because of outer join
    It gave all records from the A table. It worked fine. Now i need to add one more condition where A.GL_DATE between B.START_DATE and B.END_DATE
    If i write this
    SELECT A.*, B.START_DATE, B.END_DATE
    FROM A, B
    WHERE A.LOCATION_CODE = B.LOCATION_CODE (+)
    AND A.GL_DATE BETWEEN B.START_DATE and B.END_DATE
    This gives me only 7 records. IS IT POSSIBLE TO ADD OUTER JOIN with BETWEEN clause.

    Hi All,
    I'm in a similar situation,
    I have a complex query, everything is working fine, except this part (I will simplify everything, removing other stuffs because I need help only on the following condition)
    SELECT *
    from transaction t, card c
    where c.card_id = t.card_id (+)
    and t.trn_date between to_date ('01/01/2012','dd/mm/yy') and ('01/01/2013,'dd/mm/yy')
    How could i OUTER JOIN the between condition?
    I tried with
    and t.trn_date between to_date ('01/01/2012','dd/mm/yy') (+) and ('01/01/2013','dd/mm/yy') (+)
    but returns a "missing expression" error.
    Surely I'm missing some stupid thing about it, could you help me on this? (probably because I'm talking about parameters and I cannot put the outer join on a value)
    How can I rewrite the condition in order to satisfy what I'm trying to accomplish?
    Thanks in Advance,
    Alex
    Edited by: 981667 on 14-gen-2013 4.23
    Edited by: 981667 on 14-gen-2013 4.24

  • Join columns of outer join with table have no uniqueness cons

    Hi! I'm getting noizy error in alert log from time to time:
    Join columns of outer join with table <table_name> have no uniqueness constraints
    I've collected all the queries (v$sql, all_source) with montioned table, but non of them produces that error if executed.
    Any hints how to reproduce this error or where else to search that buggy sql join?
    Edited by: user545083 on 25.10.2010 6:21

    Hi
    I think this error is output via an materialized view refresh - check for mviews against the given table which fulfil the issue given in the error text.
    Thanks
    Paul

  • Problem with outer join with filter on join column

    Hi,
    In physical layer I have one dimension and two facts, and there's an outer join between the facts.
    dim_DATE ,
    fact_1 ,
    fact_2
    Joins:
    dim_DATE inner join fact_1 on dim_DATE.DATE = fact_1.DATE
    fact_1 left outer join fact_2 on fact_1.DATE = fact_2.DATE and fact_1.SOME_ID = fact_2.SOME_ID
    When I run a report with a date as a filter, OBIEE executes "optimized" physical SQL:
    select fact1.X, fact2.Y
    from
    Fact_1 left outer join on fact_1.DATE = fact_2.DATE and fact_1.SOME_ID = fact_2.SOME_ID
    where Fact_1.DATE = TO_DATE('2009-05-28' , 'YYYY-MM-DD' )
    and  Fact_2.DATE = TO_DATE('2009-05-28' , 'YYYY-MM-DD')
    The filter on Fact_2.DATE effectively replaces outer join with inner.
    Is there a way to disable this "optimization", which is actually very good for inner joins, but doesn't allow outer joins?
    Thanks in advance,
    Alex
    Edited by: AM_1 on Aug 11, 2009 8:20 AM

    If you want to perform a Fact-based partitioning with OBIEE (two fact with the same dimension), you have to :
    * create in your physical layer for each fact table the joins with the dimension
    * create in the Business Model layer ONE star schema with ONE logical fact table containing the columns of your two physical fact table
    In this way when you choose minimal one column of your fact1 and one column of your fact2, OBIEE will perform two query against each fact table/dimension, join them with an OUTER JOIN and your problem will disappear.
    Cheers
    Nico

  • How Can We Tune the Joins with "OR" Caluse ?

    Hi
    We've identified one Query in one of Our PL/SQL Stored Procedure which is taking huge time to fetch the records. I have simulated the problem as shown below. The problem Is, How can i tune the Jions with "OR" Clause. i have tried replacing them with Exists Caluse, But the Performance was not much was expected.
    CREATE TABLE TEST
    (ID NUMBER VDATE DATE );
    BEGIN
      FOR i IN 1 .. 100000 LOOP
        INSERT INTO TEST
        VALUES
          (i, TO_DATE(TRUNC(DBMS_RANDOM.VALUE(2452641, 2452641 + 364)), 'J'));
        IF MOD(i, 1000) = 0 THEN
          COMMIT;
        END IF;
      END LOOP;
    END;
    CREATE TABLE RTEST1 ( ID NUMBER, VMONTH NUMBER );
    INSERT INTO RTEST1
    SELECT ID, TO_NUMBER(TO_CHAR(VDATE,'MM'))
    FROM TEST ;
    CREATE TABLE RTEST2 ( ID NUMBER, VMONTH NUMBER );
    INSERT INTO RTEST2
    SELECT ID, TO_NUMBER(TO_CHAR(VDATE,'MM'))
    FROM TEST;
    CREATE INDEX RTEST1_IDX2 ON RTEST1(VMONTH)
    CREATE INDEX RTEST2_IDX1 ON RTEST2(VMONTH)
    ALTER TABLE RTEST1 ADD CONSTRAINT RTEST1_PK  PRIMARY KEY (ID)
    ALTER TABLE RTEST2 ADD CONSTRAINT RTEST2_PK  PRIMARY KEY (ID)
    SELECT A.ID, B.VMONTH
    FROM RTEST1 A , RTEST2 B
    WHERE A.ID = B.ID  
    AND ( (A.ID = B.VMONTH) OR ( B.ID = A.VMONTH ) )  
    BEGIN
    DBMS_STATS.gather_table_stats(ownname => 'PHASE30DEV',tabname => 'RTEST1');  
    DBMS_STATS.gather_table_stats(ownname => 'PHASE30DEV',tabname => 'RTEST2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST1_IDX1');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST2_IDX2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST1_IDX2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST2_IDX1');
    END; Pls suggest !!!!!!! How can I tune the Joins with "OR" Clause.
    Regards
    RJ

    I don't like it, but you could use a hint:
    SQL>r
      1  SELECT A.ID, B.VMONTH
      2  FROM RTEST1 A , RTEST2 B
      3  WHERE A.ID = B.ID
      4* AND ( (A.ID = B.VMONTH) OR ( B.ID = A.VMONTH ) )
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=94 Card=2 Bytes=28)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'RTEST2' (Cost=94 Card=1 Bytes=7)
       2    1     NESTED LOOPS (Cost=94 Card=2 Bytes=28)
       3    2       TABLE ACCESS (FULL) OF 'RTEST1' (Cost=20 Card=100000 Bytes=700000)
       4    2       BITMAP CONVERSION (TO ROWIDS)
       5    4         BITMAP AND
       6    5           BITMAP CONVERSION (FROM ROWIDS)
       7    6             INDEX (RANGE SCAN) OF 'RTEST2_PK' (UNIQUE)
       8    5           BITMAP OR
       9    8             BITMAP CONVERSION (FROM ROWIDS)
      10    9               INDEX (RANGE SCAN) OF 'RTEST2_IDX1' (NON-UNIQUE)
      11    8             BITMAP CONVERSION (FROM ROWIDS)
      12   11               INDEX (RANGE SCAN) OF 'RTEST2_PK' (UNIQUE)
    Statistics
              0  recursive calls
              0  db block gets
         300332  consistent gets
              0  physical reads
              0  redo size
            252  bytes sent via SQL*Net to client
            235  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed
    SQL>SELECT /*+ ordered use_hash(b) */ A.ID, B.VMONTH
      2    FROM RTEST1 A, RTEST2 B
      3   WHERE A.ID = B.ID  AND(A.ID = B.VMONTH OR B.ID = A.VMONTH)
      4  ;
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=175 Card=2 Bytes=28)
       1    0   HASH JOIN (Cost=175 Card=2 Bytes=28)
       2    1     TABLE ACCESS (FULL) OF 'RTEST1' (Cost=20 Card=100000 Bytes=700000)
       3    1     TABLE ACCESS (FULL) OF 'RTEST2' (Cost=20 Card=100000 Bytes=700000)
    Statistics
              9  recursive calls
              0  db block gets
            256  consistent gets
            156  physical reads
              0  redo size
            252  bytes sent via SQL*Net to client
            235  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed

  • Is there a tutorial on how to achieve Black/White photos with color details?

    I am newbie with learning photoshop, Is there a tutorial on how to achieve Black/White photos with color details? similiar to this photo?
    thanks

    Type exactly that "black white photos with colour details with Photoshop" when searching online and you will find many examples on how to achieve this effect.
    Examples:
    Photoshop combining color with black and white - A non-destructive method - YouTube
    How to Create Color Splash Effect | Adobe Photoshop cs5 - YouTube

  • Maximum number of tables that can be outer joined with one table in a query

    Hi All,
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    Thanks,
    Srini

    srinu2 wrote:
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    There is no limit to the number of tables you can outer join as long as you join them correctly.
    SQL> with a as
      2      (
      3      select 1 id, 2 b_key, 3 c_key from dual union all
      4      select 2 id, 1 b_key, 4 c_key from dual union all
      5      select 3 id, 3 b_key, 1 c_key from dual union all
      6      select 4 id, 4 b_key, 2 c_key from dual
      7      ),
      8      b as
      9      (
    10      select 1 id, 1 c_key2 from dual union all
    11      select 2 id, 5 c_key2 from dual union all
    12      select 3 id, 3 c_key2 from dual union all
    13      select 4 id, 2 c_key2 from dual
    14      ),
    15      c as
    16      (
    17      select 1 key1, 1 key2, '1-1' dta from dual union all
    18      select 1 key1, 2 key2, '1-2' dta from dual union all
    19      select 1 key1, 3 key2, '1-3' dta from dual union all
    20      select 1 key1, 4 key2, '1-4' dta from dual union all
    21      select 2 key1, 1 key2, '2-1' dta from dual union all
    22      select 2 key1, 2 key2, '2-2' dta from dual union all
    23      select 2 key1, 3 key2, '2-3' dta from dual union all
    24      select 2 key1, 4 key2, '2-4' dta from dual union all
    25      select 3 key1, 1 key2, '3-1' dta from dual union all
    26      select 3 key1, 2 key2, '3-2' dta from dual union all
    27      select 3 key1, 3 key2, '3-3' dta from dual union all
    28      select 3 key1, 4 key2, '3-4' dta from dual union all
    29      select 4 key1, 1 key2, '4-1' dta from dual union all
    30      select 4 key1, 2 key2, '4-2' dta from dual union all
    31      select 4 key1, 3 key2, '4-3' dta from dual union all
    32      select 4 key1, 4 key2, '4-4' dta from dual
    33      )
    34  select d.a_id, d.b_id, c.key1 as c_key1, c.key2 as c_key3, c.dta
    35  from
    36      c,
    37      (
    38      select
    39          a.id as a_id, b.id as b_id, a.c_key, b.c_key2
    40      from a, b
    41      where a.b_key = b.id
    42      ) d
    43  where d.c_key = c.key1 (+)
    44  and   d.c_key2 = c.key2 (+);
          A_ID       B_ID     C_KEY1     C_KEY3 DTA
             3          3          1          3 1-3
             4          4          2          2 2-2
             2          1          4          1 4-1
             1          2
    SQL>

  • Outer join With a constant value

    Hi all,
    In one of query i have found out that the outer join with a constant value like
    to_currency(+)='USD'
    to_currency is a column name in a table.can any one please explain this outer join condtn.
    Thanks in advance
    Senthil

    Hallo,
    if you write var (+) = constant
    var can be equal constant, and also can be null
    Compare these 2 queries
    select e.* from scott.emp e, scott.dept d
    where e.deptno = d.deptno(+)
    and d.deptno(+) = 10EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369     SMITH      CLERK      7902     17-Dez-1980     800          20
    7499     ALLEN      SALESMAN      7698     20-Feb-1981     1600     300     30
    7521     WARD      SALESMAN      7698     22-Feb-1981     1250     500     30
    7566     JONES      MANAGER      7839     2-Apr-1981     2975          20
    7654     MARTIN      SALESMAN      7698     28-Sep-1981     1250     1400     30
    7698     BLAKE      MANAGER      7839     1-Mai-1981     2850          30
    7782     CLARK      MANAGER      7839     9-Jun-1981     2450          10
    7788     SCOTT      ANALYST      7566     19-Apr-1987     3000          20
    7839     KING      PRESIDENT           17-Nov-1981     5000          10
    7844     TURNER      SALESMAN      7698     8-Sep-1981     1500     0     30
    7876     ADAMS      CLERK      7788     23-Mai-1987     1100          20
    7900     JAMES      CLERK      7698     3-Dez-1981     950          30
    7902     FORD      ANALYST      7566     3-Dez-1981     3000          20
    7934     MILLER      CLERK      7782     23-Jan-1982     1300          10
    select e.* from scott.emp e, scott.dept d
    where e.deptno = d.deptno(+)
    and d.deptno = 10 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7782     CLARK      MANAGER      7839     9-Jun-1981     2450          10
    7839     KING      PRESIDENT           17-Nov-1981     5000          10
    7934     MILLER      CLERK      7782     23-Jan-1982     1300          10
    As you can see, this (+) is very important
    Regards
    Dmytro

  • Outer join with effective date in peoplesoft query

    Hi,
    I'm trying to join two tables using outer join. Both tables are effective dated:
    Dept_Tbl: dept_id, status, effdt
    Tips_Tbl: dept_id, tips_id, effdt
    Not all records in Dept_Tbl are in Tips_Tbl. I need to get all active depts and their most recent tips_id if they have one.
    select a.dept_id, b.tips_id
    from dept_tbl a, tips_tbl b
    where a.status = 'Active'
    and a.effdt =
    (select max(a_ed.effdt) from dept_tbl a_ed
    where a.dept_id = a_ed.dept_id
    and a_ed.effdt <= SYSDATE)
    and b.dept_id(+) = a.dept_id
    and b.effdt =
    (select max(b_ed.effdt) from tips_tbl b_ed
    where b.dept_id = b_ed.dept_id
    and b.tips_id = b_ed.tips_id
    and b_ed.effdt <= SYSDATE)
    The query only returns records that are in both tables.
    Is there a way for outer join to work with effective dates?
    Thanks in advance,
    Reg

    Here is an example of one solution. Note the use of NVL on both sides of the equal sign since both sides could be NULL in the case of the outer join
    with dept_tbl as (select 1 dept_id, SYSDATE effdt FROM DUAL),
         tips_tbl as (select 1 dept_id, NULL effdt FROM DUAL)
    select a.effdt
      from dept_tbl a,
           tips_tbl b
    where b.dept_id(+) = a.dept_id
       and NVL(b.effdt, SYSDATE) = NVL((select max(b_ed.effdt)
                                          from tips_tbl b_ed
                                         where b.dept_id = b_ed.dept_id
                                           and b_ed.effdt <= SYSDATE), SYSDATE);
    EFFDT
    5/7/2007 3:25:00 PM

  • How to tack print out use with Query ?

    Hi
    I have to tack purchase order print out (print details- PO date, BP code, name, item name, Quantity and Amount . System Print Layout means from Purchase Order layout designer) use with Query
    How to tack print out use with Query (system print layout means from  Purchase Order layout designer) ?
    Regards
    Aravind M

    Hi
    I have to take purchase order print out and I created 3 templates for that purchase order in layout designer (Because as per the MIS requirement I created 3 templates, its cover more information). I have to take print out 3 templates at a time. So i try to take print use with Query.
    Regards
    Aravind M

Maybe you are looking for

  • Future Simulation Report, using OBIEE or Hyperion

    Dear All, I have a requirement to create a simulation of the future maintenance schedule, and future machine usage. We got option to use OBIEE and Hyperion. I have little experience with OBIEE and I think it can be achieve using 'what if model' and '

  • RefreshValidValues() is not working in BPM 10GR3

    refreshValidValues() stopped working after I made changes to my BPM 10GR3 presentation. Any reasons why? Is it because I added extra buttons to the ppt or is it because I added two hyperlinks to the ppt?

  • WSDL for PI 7.1 wsdl:service

    Hi ALL, i have a sender SOAP to receiver ABAP proxy scenario. i got the WSDl file from sender agreement menu Display WSDL option and gave the WSDL to the to the .Net team.. they are telling me the WSDL file has some <wsdl:service name="XI_c23f13a4efb

  • HOW TO OPEN A BBB FILE ?

    I simply want to back up my contact list should i lose my phone. I back up into a bbb file and i cannot open ?

  • Discoverer Plus - Creating URL's with Multiple Dimension values

    We are using the "Manage Links" feature in Discoverer Plus (10.1.2.2.0) to send dimension value names in a URL. As part of the "Manage Links" feature, the user is given the opportunity to choose which dimension values for the selected cells they want