Xpath union operator (|)

I am having trouble using the xpath union operator (|).
The selectNodes method of the oracle.xml.parser.v2.XMLNode is throwing an exception when I use any xPath expression with a pipe such as the one below. Does the Oracle Parser support this type of xPath operator?
Thanks,
Michael
//test/me[@id=3|@id=5]
<test>
<me id="5">you</me>
<me id="3">be</me>
</test>

I discovered that this XPath returns the expected result:
//test/me[@id=3]|//test/me[@id=5]

Similar Messages

  • While doing union operation, i am getting the following eror.

    While doing union operation, i am getting the following eror.
    Solution for the following error
    "Numbers of columns and their data types must be consistent across all criteria and Result Columns"

    Hi...phani..thanks for the response..
    Report 1: TopN values... working fine
    Report2: >TopN values working fine.
    when i union the 2 the result is: all records, and i got it.
    ReQ: i have to add the remaining Records of >N at the end of the report, represents Others: xxxx
    My ReQ:
    Col1 Col2 Col3 # of Srs %Of Srs
    ABC Complaint Operation 200 40%
    CDF ACD Part Availability 100 20%
    Others 300 40%
    suppose for first column in result tab,
    Formula tab: case when saw_4>10 then 'Others' else saw_0 end.
    when i put the above condition in Result columns i am getting the error.
    Error: Numbers of columns and their data types must be consistent across all criteria and Result Columns

  • Writing query using UNION Operator

    Question -
    (1)
    Write an SQL Statement to list the following items: Customer ID, Customer Name, number of invoices, sum of total for invoices. Ensure that all customers are returned in the result set.
    Answer for the above is written as below by one person. That seams to be correct. Is there another way of writing this same query.;
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c,(select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice
    group by customer_id) i
    where c.CUSTOMER_ID = i.customer_id (+)
    (2)
    My other question is How to write the above answer (or what you sugest) using UNION operator ?
    Any ideas please
    Message was edited by:
    user483578

    In fact the outer join means you use the union of two result sets - usual join result
    and the rows from the outer table for which there is not any row in the inner table.
    SQL> select d.deptno, e.ename from emp e, dept d
      2  where d.deptno = e.deptno(+)
      3  order by 1,2
      4  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.
    SQL> select d.deptno,e.ename from emp e, dept d
      2  where d.deptno = e.deptno
      3  union
      4  select deptno, null
      5  from dept d where not exists (select null from emp e where e.deptno = d.deptno)
      6  order by 1,2
      7  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.In your example something like (NOT tested !)
    with i as (select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice group by customer_id)
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c, i
    where c.CUSTOMER_ID = i.customer_id
    union
    select c.CUSTOMER_ID,c.NAME,null,null
    from gee_customer c
    where not exists (select null from i where c.CUSTOMER_ID = i.customer_id)
    Rgds.

  • Using union operator in discoverer

    Hi All,
    I have a sql statement which is to be implemented in discoverer:
    (select ........where user_entered_date='YYYY/MM/DD' )
    UNION
    (select ........where user_entered_date='YYYY/MM/DD'
    AND (select ........where user_entered_date='YYYY/MM/DD' ))
    Problem:
    a) There are nested select statements which require parameters to be entered by the user.
    b) How would I implement the union operator in the above scenario?
    I would really appreciate it if someone could give a work around.
    Regards,
    Nav

    Hi,
    Unfortunately, we can not have a SQL query with Union in Discoverer directly.
    You should create a view based on the complete query and then create folder using the view.
    You can provide a parameter at the report level.
    For eg :
    View query : select as_of_date from table_name
    Report : Add a paremeter for as_of_date
    Hope this Helps!
    Yogini

  • UNION operator in ejb 3.0

    Hi All,
    I have to use UNION operator in my ejb ql. My underlying database is MySQL.
    My ejb ql is
    SELECT s from eee s where s.name like 'XXX'
    UNION
    SELECT t from eee t where t.default_id = 'XXX'
    union is on the same entitybean.
    In my eee entity bean I have tried
    @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
    Ejb ql doesnot return the expected results.
    Could someone please help me out with UNION operator in ejb 3.0
    Thanks

    you should have little problems, but just how little is container specific. I successfully run JEE 1.4 stuff on JBoss 5.1 for example without having to make any configuration changes. Heck, I mix that technology with EJB 3 tech, even having shared container managed transactions.
    BTW: you mean JEE5, not J2SE 1.5. Big difference in what they represent.

  • Creating table or View using UNION Operator ???????

    Hi all
    please need some help ,i have created aquery using UNION operator
    (i.e
    select A,to_number(null),C from table1
    Union
    select A,B,To_number(null) from table2)
    it gives the output correctly and i need to make this output as View ot table
    eacg time i use
    Create or replace view v_1 ...........
    it gives me this error :: unknown command "UNION" - rest of line ignored.
    can any one pls tell me what to do
    Thanks

    Hi,
    I found there is no error in your sql
    create view x_v
    as
    select a from x
    union
    select to_number(null) from y;
    this works fine.
    in your sql check your right or left peranthesis
    regards
    Ripudaman

  • ROWNUM in UNION operator

    All,
    I have a requirement in SQL that I have to number each row. Hence I thought of using ROWNUM. But the sql query I'm using uses UNION operator. Hence I used like this
    select a,b,rownum as 'field1' from table1
    union
    select c,d,1 as 'field1' from table2
    Will the above query solve my purpose?
    thanks
    sen

    jeneesh wrote:
    This will probably kill the purpose of UNION - which is to take only the DISTINCT rows..
    If DISTINCT is not intended, it is better to choose UNION ALLYes, you are correct about use of UNION. Probably, OP would have wanted to use Union ALL perhaps, but might have forgotten about suppressing of duplicates and sorting and ended up using Union.
    But, in accordance with the original query used by OP, my suggestion of row number would not affect the output, I guess, would it?
    Perhaps, if OP would have provided us with some base sample data and the Output desired from it, it would have been of greater help.

  • Union operator between tables

    Hi everyone
    I need to merge the data from two omogenous tables (be aware: two tables not two data services; the tables are populated by the user). I specifically need to do this client-side.
    When I try to connect the out port of a table to the union operator, the input ports of the operator are grayed out.
    I assume the union operator can be used only to merge data from data services: has anyone faced this issue before?
    Thanks
    Points will be awarded
    VT

    Hi Vincenzo,
    this is where you reach some limitations in the Visual Composer.
    The union operator is made to work on data services, not on tables.
    The only ways to solve this are either to use another tool (WebDynpro) or to make use of a data service that would perform the necessary operation for you (creating a specific RFC or Web Service).
    Rgds,
    Karim

  • All queries in an SQL statement containing a UNION  operator must have an equal number of expressions in their target lists.

    Cant Add  OCRD.CardName,CRD7.ECCNo to this  query.Please Help.
    declare @FDate as datetime
    declare @TDate as datetime
    declare @Location as VARCHAR (30)
    /* SELECT FROM [dbo].[OLCT] S0 WHERE */ SET  @Location = /* S0.Location*/ '[%0]'
    /* SELECT FROM [dbo].[OINM] S1 WHERE */ SET  @FDate = /* S1.TaxDate*/ '[%1]'
    /* SELECT FROM [dbo].[OINM] S2 WHERE */ SET  @TDate = /* S2.TaxDate*/ '[%2]'
    SELECT
      'Sales'Document,OBTN.DistNumber
      ,NNM1.SeriesName,OINV.DocNum,OCRD.CardName,CRD7.ECCNo,OINV.DocDate,OITM.SWW [HSN Number],INV1.ItemCode,INV1.Dscription,(ITL1.Quantity*-1) [Quantity]
      ,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
      ,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
      ,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
      ,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
      ,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
      ,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
    FROM
      INV1
    INNER JOIN
      OINV ON INV1.DocEntry=OINV.DocEntry
    INNER JOIN
    OCRD ON OINV.CardCode = OCRD.CardCode
    INNER JOIN
    CRD7  ON OCRD.CardCode = CRD7.CardCode
    INNER JOIN
      OITM ON INV1.ItemCode=OITM.ItemCode
    INNER JOIN
      OITL ON INV1.BaseType=OITL.ApplyType AND INV1.BaseEntry=OITL.ApplyEntry AND INV1.BaseLine=OITL.ApplyLine
    INNER JOIN
      ITL1 ON OITL.LogEntry=ITL1.LogEntry
    INNER JOIN
      OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
    INNER JOIN
      [@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
    LEFT JOIN
      NNM1 ON OINV.Series=NNM1.Series
    WHERE INV1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
      AND OINV.DocDate BETWEEN @FDate AND @TDate
    UNION ALL
    SELECT
      'Sales Return'Document,OBTN.DistNumber
      ,NNM1.SeriesName,ORIN.DocNum,ORIN.DocDate,OITM.SWW [HSN Number],RIN1.ItemCode,RIN1.Dscription,(ITL1.Quantity*-1) [Quantity]
      ,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
      ,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
      ,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
      ,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
      ,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
      ,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
    FROM
      RIN1
    INNER JOIN
      ORIN ON RIN1.DocEntry=ORIN.DocEntry
    INNER JOIN
      OITM ON RIN1.ItemCode=OITM.ItemCode
    INNER JOIN
      OITL ON RIN1.BaseType=OITL.ApplyType AND RIN1.BaseEntry=OITL.ApplyEntry AND RIN1.BaseLine=OITL.ApplyLine
    INNER JOIN
      ITL1 ON OITL.LogEntry=ITL1.LogEntry
    INNER JOIN
      OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
    INNER JOIN
      [@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
    LEFT JOIN
      NNM1 ON ORIN.Series=NNM1.Series
    WHERE RIN1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
      AND ORIN.DocDate BETWEEN @FDate AND @TDate

    Nagarajan,
    I've altered the query into this.Think that it is working.Thanks man
    declare @FDate as datetime
    declare @TDate as datetime
    declare @Location as VARCHAR (30)
    /* SELECT FROM [dbo].[OLCT] S0 WHERE */ SET  @Location = /* S0.Location*/ '[%0]'
    /* SELECT FROM [dbo].[OINM] S1 WHERE */ SET  @FDate = /* S1.TaxDate*/ '[%1]'
    /* SELECT FROM [dbo].[OINM] S2 WHERE */ SET  @TDate = /* S2.TaxDate*/ '[%2]'
    SELECT
      'Sales'Document,OBTN.DistNumber
      ,NNM1.SeriesName,OINV.DocNum,OCRD.CardName,CRD7.ECCNo,OINV.DocDate,OITM.SWW [HSN Number],INV1.ItemCode,INV1.Dscription,(ITL1.Quantity*-1) [Quantity]
      ,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
      ,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
      ,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
      ,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
      ,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
      ,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
    FROM
      INV1
    INNER JOIN
      OINV ON INV1.DocEntry=OINV.DocEntry
    INNER JOIN
      OITM ON INV1.ItemCode=OITM.ItemCode
    INNER JOIN
      OCRD ON OINV.CardCode = OCRD.CardCode
    INNER JOIN
    CRD7  ON OCRD.CardCode = CRD7.CardCode
    INNER JOIN
      OITL ON INV1.BaseType=OITL.ApplyType AND INV1.BaseEntry=OITL.ApplyEntry AND INV1.BaseLine=OITL.ApplyLine
    INNER JOIN
      ITL1 ON OITL.LogEntry=ITL1.LogEntry
    INNER JOIN
      OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
    INNER JOIN
      [@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
    LEFT JOIN
      NNM1 ON OINV.Series=NNM1.Series
    WHERE INV1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
      AND OINV.DocDate BETWEEN @FDate AND @TDate
    UNION ALL
    SELECT
      'Sales Return'Document,OBTN.DistNumber
      ,NNM1.SeriesName,ORIN.DocNum,OCRD.CardName,CRD7.ECCNo,ORIN.DocDate,OITM.SWW [HSN Number],RIN1.ItemCode,RIN1.Dscription,(ITL1.Quantity*-1) [Quantity]
      ,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
      ,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
      ,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
      ,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
      ,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
      ,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
    FROM
      RIN1
    INNER JOIN
      ORIN ON RIN1.DocEntry=ORIN.DocEntry
    INNER JOIN
      OCRD ON ORIN.CardCode = OCRD.CardCode
    INNER JOIN
    CRD7  ON OCRD.CardCode = CRD7.CardCode
    INNER JOIN
      OITM ON RIN1.ItemCode=OITM.ItemCode
    INNER JOIN
      OITL ON RIN1.BaseType=OITL.ApplyType AND RIN1.BaseEntry=OITL.ApplyEntry AND RIN1.BaseLine=OITL.ApplyLine
    INNER JOIN
      ITL1 ON OITL.LogEntry=ITL1.LogEntry
    INNER JOIN
      OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
    INNER JOIN
      [@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
    LEFT JOIN
      NNM1 ON ORIN.Series=NNM1.Series
    WHERE RIN1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
      AND ORIN.DocDate BETWEEN @FDate AND @TDate

  • UNION operator with BULK COLLECT for a collection type

    Hi all,
    I created a table type as below:
    create or replace type coltest is table of number;
    Below are 3 PL/SQL blocks that populate data into variables of the above mentioned table type:
    BLOCK 1:
    DECLARE
    col1 coltest := coltest(1, 2, 3, 4, 5, 11);
    col2 coltest := coltest(6, 7, 8, 9, 10);
    col3 coltest := coltest();
    BEGIN
    SELECT * BULK COLLECT
    INTO col1
    FROM (SELECT *
    FROM TABLE(CAST(col1 AS coltest))
    UNION ALL
    SELECT * FROM TABLE(CAST(col2 AS coltest)));
    dbms_output.put_line('col1');
    dbms_output.put_line('col1.count: ' || col1.COUNT);
    FOR i IN 1 .. col1.COUNT
    LOOP
    dbms_output.put_line(col1(i));
    END LOOP;
    END;
    OUPUT:
    col1
    col1.count: 5
    6
    7
    8
    9
    10
    BLOCK 2:
    DECLARE
    col1 coltest := coltest(1, 2, 3, 4, 5, 11);
    col2 coltest := coltest(6, 7, 8, 9, 10);
    col3 coltest := coltest();
    BEGIN
    SELECT * BULK COLLECT
    INTO col2
    FROM (SELECT *
    FROM TABLE(CAST(col1 AS coltest))
    UNION ALL
    SELECT * FROM TABLE(CAST(col2 AS coltest)));
    dbms_output.put_line('col2');
    dbms_output.put_line('col2.count: ' || col2.COUNT);
    FOR i IN 1 .. col2.COUNT
    LOOP
    dbms_output.put_line(col2(i));
    END LOOP;
    END;
    OUTPUT:
    col2
    col2.count: 6
    1
    2
    3
    4
    5
    11
    BLOCK 3:
    DECLARE
    col1 coltest := coltest(1, 2, 3, 4, 5, 11);
    col2 coltest := coltest(6, 7, 8, 9, 10);
    col3 coltest := coltest();
    BEGIN
    SELECT * BULK COLLECT
    INTO col3
    FROM (SELECT *
    FROM TABLE(CAST(col1 AS coltest))
    UNION ALL
    SELECT * FROM TABLE(CAST(col2 AS coltest)));
    dbms_output.put_line('col3');
    dbms_output.put_line('col3.count: ' || col3.COUNT);
    FOR i IN 1 .. col3.COUNT
    LOOP
    dbms_output.put_line(col3(i));
    END LOOP;
    END;
    OUTPUT:
    col3
    col3.count: 11
    1
    2
    3
    4
    5
    11
    6
    7
    8
    9
    10
    Can anyone please explain the output of BLOCK 1 and 2? Why doesn't bulk collect into col1 and col2 return 11 as count?

    Consider the following code from your block.
    select *
      bulk collect into col1
      from (
             select *
               from table(cast(col1 as coltest))
              union
                all
             select *
               from table(cast(col2 as coltest))
           ); Now my assumption would be like this.
    PL/SQL engine would recognize the SQL part and will be sending it to SQL Engine for processing. Before doing that it will try to initialize the SQL collection variable COL1. Now when SQL Engine process the SELECT, COL1 would be empty already. And thats the reason you don't get the as 5 and not 11.

  • Xpath and operator EX

    In our scenario we have one inbound interface and two possible outbound interfaces. The only way to decide which outbound interface should be selected is the existence of a node in the inbound message. In the condition editor of the interface determination there is only the operator EX available, meaning node exists. I can use this to select one of the outbound interfaces, but I would need a "NEX" operator to select the other outbound interface in case the node doesn't exist in the inbound message.
    Does anyone have a solution to this problem?
    Kind regards,
    John.

    Check the last-but-one example from this wiki:
    [http://wiki.sdn.sap.com/wiki/display/XI/XpathConditioninReceiverDetermination|http://wiki.sdn.sap.com/wiki/display/XI/XpathConditioninReceiverDetermination]
    Regards,
    Abhishek.

  • Prioritizing a set by using union operator

    My requirement is to print data whose log_in_id starts with a and end with y first, then to print data starting with a and b.
    select * from userid where log_in_id like 'a%y' union select * from userid where log_in_id like 'a%' or log_in_id like 'b%'

    Why go through the table twice? I would do something like:
    SQL> SELECT log_in_id
      2  FROM (SELECT 'bob' log_in_id FROM dual
      3        UNION ALL
      4        SELECT 'bill' from dual
      5        UNION ALL
      6        SELECT 'ally' from dual
      7        UNION ALL
      8        SELECT 'abby' from dual
      9        UNION ALL
    10        SELECT 'allen' from dual
    11        UNION ALL
    12        SELECT 'albert' from dual)
    13  ORDER BY CASE WHEN log_in_id LIKE 'a%y' THEN 1 ELSE 2 END,
    14           log_in_id;
    LOG_IN
    abby
    ally
    albert
    allen
    bill
    bobHTH
    John

  • With using the Union oper. query

    Hi Team
    I have table like A and B
    A table Structure
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    B table Structure
    C1-----C2
    R11----R8
    my output is like below
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    R11----R8----------null
    i can use the Union all condition i don't want to use the
    union all condition who? plz help
    select c1,c2,c3
    union
    select c1,c2;

    870003 wrote:
    Hi Team
    I have table like A and B
    A table Structure
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    B table Structure
    C1-----C2
    R11----R8
    my output is like below
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    R11----R8----------null
    i can use the Union all condition i don't want to use the
    union all condition who? plz helpWhy don't you want to use union all, because that is exactly what you are trying to achieve?

  • Need help on Union operator

    Im using oracle8, I want to write a query something like this,
    SELECT x,y,z from (subquery)
    UNION
    SELECT x,y,z from (subquery)
    UNION
    SELECT x,y,z from (subquery)
    But the subquery is that long that I cannot repeat it in every select statement. So i want to define an alias for the subquery, and use it in every select statement. I want to do all this in just SQL, not PL/SQL, since I'll be using this query in cogos. Any sugesstions?

    Not that it's any help to you, but Oracle 9i has provided the WITH clause, which allows us to alias sub-queries just like you want to do. It also executes the sub-query just the once, so there are some good performance gains, even for correlated sub-queries.
    Cheers, APC

  • Union Operator

    I'm new to oracle and would like to make a view from two tables
    BOOK
    ÍSBN----TITLE----IN_STOCK----PRICE----AUTHOR_ID----TYPE_ID----SUPPLIER_ID
    AUTHOR
    ID---NAME---DATE_OF_BIRTH
    now i want to make a column which give out the Author Name and the Amount of books the Author has written.
    then on the last row i'd like to add the word Total then the total Author(number) and total books(number)
    eg
    Author_Name Amount_book
    Jon 3
    dave 1
    Sara 1
    Total 3 4
    How do i do this?

    select decode(authors.name,null, 'Total authors : ' || count(authors.name) over (), authors.name) Name, count(books.isbn) total_books
    from authors, books
    where authors.id = books.author_id
    group by rollup(authors.name);
    NAME                 TOTAL_BOOKS
    Jonathan Lewis                 1
    Tom kyte                       2
    Total authors : 2              3

Maybe you are looking for

  • I can´t open a numbers document.

    Hello, I have a problem. I created a numbers document one month ago. Yesterday I wanted to open it again and the mac says, I need a new version. So I updated the version. But still I can´t open it because anytime I want to open the document it says,

  • WRE54G Rev 1 -- D-Link 524 Router

    Hi, I have a Wireless D-Link 524 Router (newest firmware) and I am trying to expand the range of my network using a LinkSys WRE54G Rev. 1 expander. First off will the WRE54G work with a D-Link router?  On the box it says will work with "most" wireles

  • Version 999 Project System Plan Data Issue

    I am using transaction CJ9B to copy the Project System related plan data i.e. plan data at the WBS element level from Version 10F, period 1 to 12  in year 2010 to version 999, period 1 to 12 in year 2010. The transaction CJ9B runs successfully in the

  • Central Performance History from satellite systems

    Hi, I'm investigating Central Performance History at the moment but am having problems getting the statistics from the satellite systems from Solution Manager. I have our Solution Manager system setup as the CCMS CEN. I monitor about 10 SAP instances

  • Install vm on shared storage

    Hi, I am trying to install a virtual machine on a NetApp box. I have created a storage repository with ovs-makerepo and if I do a "df -h" I can see the new storage is attached. Now I would like to create a virtual machine by using vm manager and not