Xmlsequence with where clause or with join condition...

Hi
I have a XML as like below:
<File>
<FileDetails>
<Student>
<RegNo>1001</RegNo>
<Name>Joseph</Name>
<ResultDetails>
<Subjects>
<SNo>1</SNo>
<SubjectName>ENGLISH</SubjectName>
<Marks>80</Marks>
</Subjects>
<Subjects>
<SNo>2</SNo>
<SubjectName>MATHS</SubjectName>
<Marks>78</Marks>
</Subjects>
</ResultDetails>
</Student>
<Student>
<RegNo>1002</RegNo>
<Name>Vincent</Name>
<ResultDetails>
<Subjects>
<SNo>1</SNo>
<SubjectName>ENGLISH</SubjectName>
<Marks>62</Marks>
</Subjects>
<Subjects>
<SNo>2</SNo>
<SubjectName>MATHS</SubjectName>
<Marks>73</Marks>
</Subjects>
</ResultDetails>
</Student>
</FileDetails>
</File>
This XML file has been inserted into a table gtt_xmlfile on column "XML_DATA" of datatype "CLOB(4000)".
Now i have executed the below query:
select     
     extract(value(d),'//RegNo/text()').getStringVal(),
     extract(value(d),'//Name/text()').getStringVal(),
     extract(value(d),'//SNo/text()').getStringVal(),
     extract(value(d),'//SubjectName/text()').getStringVal(),
     extract(value(d),'//Marks/text()').getStringVal()
from gtt_xmlfile x,
table(xmlsequence(extract(pk_xml.clob_to_xmltype(x.xml_data),'//File/FileDetails/Student'))) d;
And i got the below output:
REGNO     NAME     SNO     SUBJECTNAME     MARKS
1001     Joseph     12     ENGLISHMATHS     8078
1002     Vincent     12     ENGLISHMATHS     6273
After i have executed the below query:
select     
     extract(value(d),'//RegNo/text()').getStringVal() RegNo,
     extract(value(d),'//Name/text()').getStringVal() Name,
     extract(value(e),'//SNo/text()').getStringVal() SNo,
     extract(value(e),'//SubjectName/text()').getStringVal() SubjectName,
     extract(value(e),'//Marks/text()').getStringVal() Marks
from gtt_xmlfile x,
table(xmlsequence(extract(pk_xml.clob_to_xmltype(x.xml_data),'//File/FileDetails/Student'))) d,
table(xmlsequence(extract(pk_xml.clob_to_xmltype(x.xml_data),'//File/FileDetails/Student/ResultDetails/Subjects'))) e
i get the below output: (Cartesian product)
REGNO     NAME     SNO     SUBJECTNAME     MARKS
1001     Joseph     1     ENGLISH     80
1001     Joseph     2     MATHS     78
1001     Joseph     1     ENGLISH     62
1001     Joseph     2     MATHS     73
1002     Vincent     1     ENGLISH     80
1002     Vincent     2     MATHS     78
1002     Vincent     1     ENGLISH     62
1002     Vincent     2     MATHS     73
But my required output should be like below:
REGNO     NAME     SNO     SUBJECTNAME     MARKS
1001     Joseph     1     ENGLISH     80
1001     Joseph     2     MATHS     78
1002     Vincent     1     ENGLISH     62
1002     Vincent     2     MATHS     73
How can i achieve that using a join condition??
Any help would be much appreciated...
Best Regards
Muthu

No
The above doesn't help me. Because, if the same set repeats, it gives an error:
XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence.
Note: Same set means, on the below sample, the student set repeats twice. In this case, that gives me error as mentioned above
<File>
<FileDetails>
<Student>
<RegNo>1001</RegNo>
<Name>Joseph</Name>
<ResultDetails>
<Subjects>
<SNo>1</SNo>
<SubjectName>ENGLISH</SubjectName>
<Marks>80</Marks>
</Subjects>
<Subjects>
<SNo>2</SNo>
<SubjectName>MATHS</SubjectName>
<Marks>78</Marks>
</Subjects>
</ResultDetails>
</Student>
<Student>
<RegNo>1002</RegNo>
<Name>Vincent</Name>
<ResultDetails>
<Subjects>
<SNo>1</SNo>
<SubjectName>ENGLISH</SubjectName>
<Marks>62</Marks>
</Subjects>
<Subjects>
<SNo>2</SNo>
<SubjectName>MATHS</SubjectName>
<Marks>73</Marks>
</Subjects>
</ResultDetails>
</Student>
</FileDetails>
</File>

Similar Messages

  • 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.

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • Hierarchical query with where clause

    Hi,
    How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
    When I try with the following query,
    select id, level from relation
    where session_id = 79977
    connect by prior id = root_id start with id = 5042;
    It gets duplicate values.
    I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
    Thanks in Advance.
    Regards,
    -Parmy

    Hi Sridhar Murthy an others,
    Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
    Any way thanks for your reply,
    It's working for me.
    With happiness,
    -Parmy

  • Populate list by executing query with where clause

    Hi,
    I m populating my list from database table using following command.
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("learning", new HashMap());
    EntityManager em = emf.createEntityManager();
    String query = "select d from Dept d";
    List list = em.createQuery(query).getResultList();
    My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string.
    String query = "select d from Dept d where d.dept_name='ANYNAME'";
    Moreover I cant select even indivisual columns by using following line
    String query = "select d.dept_code,d.dept_name from Dept d";
    It looks like that my query is getting all rows from table as Object.
    What to do to
    1. put some where clause
    2. get some particular colums instead of all columns
    3. apply some table joins in query
    plz help.

    Hi Alex,
    I misunderstood your question. You had mentioned "My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string. "
    I thought you might not have permissions to modify the code in the class, and that's why I suggested that you could write new classes.
    1) write new classes,? means if I need just two columns from a table >(instead of all columns), do I need to write new class with just two >columns (getters and setters)?You can write a SQL statement anyway you want , there are no restrictions in JDBC , so if you need just 2 columns you can write a custom query for that.
    "select column1 as a, column2 as be from table_name where column3 = xyz" etc.
    2) Is not anyway to write SQL statement like
    select dept_code,dept_name from dept where dept_name='anything'The above SQL is correct, it should work.
    3) Stored procedures? can I get some example(code) to get an idea >how to implement complex queries with where clause and joinings >using stored procedures?Stored procedures are specific to the database you are using, Oracle has a particular syntax for store procdures.
    You can call stored procedures from JDBC also, search on Google for
    "Calling stored procedures from JDBC"
    4) I m using hibernate. can I get any example of using hibernate own >query?Tutorial on Hibernate Query Language:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Insert with Where Clause

    Hi,
    Can we write Insert with 'Where' clause? I'm looking for something similar to the below one (which is giving me an error)
    insert into PS_AUDIT_OUT (AUDIT_ID, EMPLID, RECNAME, FIELDNAME, MATCHVAL, ERRORMSG)
    Values ('1','10000139','NAMES','FIRST_NAME',';','')
    Where AUDIT_ID IN
    (  select AUDIT_ID from PS_AUDIT_FLD where AUDIT_ID ='1' and RECNAME ='NAMES'
    AND FIELDNAME = 'FIRST_NAME' AND MATCHVAL = ';' );
    Thanks
    Durai

    It is not clear what are you trying to do, but it looks like:
    insert
      into PS_AUDIT_OUT(
                        AUDIT_ID,
                        EMPLID,
                        RECNAME,
                        FIELDNAME,
                        MATCHVAL,
                        ERRORMSG
    select  '1',
            '10000139',
            'NAMES',
            'FIRST_NAME',
      from  PS_AUDIT_FLD
      where AUDIT_ID = '1'
        and RECNAME ='NAMES'
        and FIELDNAME = 'FIRST_NAME'
        and MATCHVAL = ';'
    SY.

  • Where can I find join conditions in the ALL_IV_XFORM views?

    OWB 10.2
    where can I find join conditions in the ALL_IV_XFORM views? And if they cannot be found there, where are they to be found?
    Regards,
    Jaap.

    Hi Jaap,
    ALL_IV_XFORM views are called Mapping Model Views . These are available at repostory owner user.
    ALL_IV_XFORM_MAPS
    ALL_IV_XFORM_MAP_COMPONENTS
    ALL_IV_XFORM_MAP_PARAMETERS
    ALL_IV_XFORM_MAP_PROPERTIES
    ALL_IV_XFORM_MAP_DETAILS
    Connect repository user and execute below statement
    SELECT VIEW_NAME FROM ALL_VIEWS WHERE VIEW_name like 'ALL_%';
    Regards,
    Venkat

  • Outer join with where clause in the universe

    Hi,
    I have two tables such as:
    Patient Table (P)                          Territory Table (T)
    P. Alignment ID --------------------------   T.Alignment ID
    P. Patient ID                                    T. Region
    Two tables are joined on alignment ID, follow is how the data looks like
    When i run the query only on Patient Table  i get the following
    e.g.
    Select P.Patient ID, P.Alignment ID
    from Patient Table (P)
    Where P.Data_date=P.Latest data date
    ----Note that there is a Where clause here always & i get the following result
    P.Patient ID         P.Alignment ID      
        1                            1a
        2                             2a
        3                            3a
        4                            Null
        5                            Null
    Now when i join two tables on Alignment ID
    e.g.
    Select P.Patient ID, P.Alignment ID,T.Region
    from Patient Table (P)
    LEFT OUTER  JOIN Territory Table (T)
    ON P. Alignment ID =  T.Alignment ID
    Where P.Data_date=P.Latest data date
    AND T.Data_date=T.Latest data date
    Following is the result:
    P.Patient ID         P.Alignment ID      
        1                            1a
        2                            2a
        3                            3a
    Even with the left outer join it is not brining in the Null values , it seems that because of the WHERE clause the LEFT OUTER is working as a INNER join.
    How can i get the Null rows with my join to the territory table ?
    Please Advise,
    Thanks,
    Sheikh

    its not letting me atatched the excel extract but the data is simple as i shown above e.g.
    Patient Table (P)                          Territory Table (T)
    P. Alignment ID --------------------------   T.Alignment ID
    P. Patient ID                                    T. Region
    Two tables are joined on alignment ID, follow is how the data looks like
    When i run the query only on Patient Table  i get the following
    e.g.
    Select P.Patient ID, P.Alignment ID
    from Patient Table (P)
    Where P.Data_date='01-OCT-2014'
    ----Note that there is a Where clause here always & i get the following result
    P.Patient ID         P.Alignment ID      
        1                            1a
        2                             2a
        3                            3a
        4                            Null
        5                            Null
    Now when i join two tables on Alignment ID
    e.g.
    Select P.Patient ID, P.Alignment ID,T.Region
    from Patient Table (P)
    LEFT OUTER  JOIN Territory Table (T)
    ON P. Alignment ID =  T.Alignment ID
    Where P.Data_date='01-OCT-2014'
    AND T.Data_date='01-OCT-2014'
    Following is the result:
    P.Patient ID         P.Alignment ID      
        1                            1a
        2                            2a
        3                            3a
    Now the whole issue is that the condition in the WHERE clause is making it act like a inner join and iw ant the NULL rows to appear
    Sheikh

  • Urgent: Performance problem with where clause using IN and an OR condition

    Select statement is:
    select fl.feed_line_id
    from ap_expense_feed_lines_all fl
    where ((:1 is not null and
    fl.feed_line_id in (select distinct r2.object_id
    from xxdl_pcard_wf_routing_lists r2,
         per_people_f hr2
    where upper(hr2.full_name) like upper(:1||'%')
              and hr2.person_id = r2.person_id
    and r2.fyi_list is null
              and r2.sequence_number <> 0))
    or
    (:1 is null))
    If I modify the statement to remove the "or (:1 is null))" part at the bottom of the where clause, it returns in .16 seconds. If I modify the statement to only contain the "(:1 is null))" part of the where clause, it returns in .02 seconds. With the whole statement above, it returns in 477 seconds. Anyone have any suggestions?
    Explain plan for the whole statement is:
    (1) SELECT STATEMENT CHOOSE
    Est. Rows: 10,960 Cost: 212
    FILTER
    (2) TABLE ACCESS FULL AP.AP_EXPENSE_FEED_LINES_ALL [Analyzed]
    (2) Blocks: 8,610 Est. Rows: 10,960 of 209,260 Cost: 212
    Tablespace: APD
    (6) TABLE ACCESS BY INDEX ROWID HR.PER_ALL_PEOPLE_F [Analyzed]
    (6) Blocks: 4,580 Est. Rows: 1 of 85,500 Cost: 2
    Tablespace: HRD
    (5) NESTED LOOPS
    Est. Rows: 1 Cost: 4
    (3) TABLE ACCESS FULL XXDL.XXDL_PCARD_WF_ROUTING_LISTS [Analyzed]
    (3) Blocks: 19 Est. Rows: 1 of 1,303 Cost: 2
    Tablespace: XXDLD
    (4) UNIQUE INDEX RANGE SCAN HR.PER_PEOPLE_F_PK [Analyzed]
    Est. Rows: 1 Cost: 1
    Thanks in advance,
    Peter

    Thanks for the reply, but I have already checked what you are suggesting and I am pretty sure those are not causing the problem. The hr2.full_name column has an upper index and the (4) line of the explain plan shows that index being used. In addition, that part of the query executes on its own quickly.
    Because the sql is not displayed in an indented format on this page it is a little hard to understand the structure so I am going to restate what is happening.
    My sql is:
    select a_column
    from a_table
    where ((:1 is not null) and a_column in (sub-select statement)
    or
    (:1 is null))
    The :1 bind variable is set to a varchar2 entered on the screen of an application.
    If I execute either part of the sql without the OR condition, performance is good.
    If the :1 bind variable is null with the whole sql statement (so all rows or a_table are returned), performance is still good.
    If the :1 bind variable is a not-null value with the whole sql statement, performance stinks.
    As an example:
    where (('wa' is not null) and a_column in (sub-select statement)) -- fast
    where (('wa' is null)) -- fast
    where (('' is not null) and a_column in (sub-select statement) -- fast
    or
    ('' is null))
    where (('wa' is not null) and a_column in (sub-select statement) -- slow
    or
    ('wa' is null))

  • [SQL] Where clause problem with subqueries

    Hi,
    I'm writing a query for an apex application where i have a field (P47_UNNR) for filtering. In my where clause I try to do this:
    ... AND qo.pk_id IN
    CASE
    WHEN :P47_UNNR IS NULL
    THEN
    (SELECT pk_id FROM quote_orders)
    ELSE
    (SELECT QOR.FK_QUOTE_ORDER_ID
    FROM QUOTE_ORDER_RIDS QOR
    JOIN
    RIDS RID
    ON RID.PK_ID = QOR.FK_RID_ID
    WHERE RID.NAME LIKE :P47_UNNR)
    END
    But it gives an error "ORA-01427: single-row subquery returns more than one row"
    I have tried multiple ways to get around this problem but don't seem to be able to do this. Does anyone have a suggestion on how to solve this?

    Hi Niels,
    First try with separating the query.
    First try with:
    CASE
    WHEN :P47_UNNR IS NULL
    THEN
    (SELECT pk_id FROM quote_orders)
    END;check SELECT pk_id FROM quote_orders this query returning only one values or not???
    Then try with
    CASE
    WHEN :P47_UNNR IS NULL
    THEN
    (SELECT pk_id FROM quote_orders)
    ELSE
    (SELECT QOR.FK_QUOTE_ORDER_ID
    FROM QUOTE_ORDER_RIDS QOR
    JOIN
    RIDS RID
    ON RID.PK_ID = QOR.FK_RID_ID
    WHERE RID.NAME LIKE :P47_UNNR)
    ENDCheck this
    SELECT QOR.FK_QUOTE_ORDER_ID
    FROM QUOTE_ORDER_RIDS QOR
    JOIN
    RIDS RID
    ON RID.PK_ID = QOR.FK_RID_ID
    WHERE RID.NAME LIKE :P47_UNNRquery returning one values or not??
    If those returns more than one value , the check whether there is any duplication value's present, remove that duplicate value from your table.
    if you cant remove just add rownum =1 condition in your where clause.
    Cheers,
    San

  • Issue in select query with where clause

    Hi guys,
    I'm facing an issue while using select query with the where clause. When I'm selecting all the data from the table it returns the correct result. But when I'm using the where clause to get the specific rows from the table it returns no rows. But the data I'm trying to fetch using the where condition exists in the table.
    Here is my query which causing the issue,
    select * from mytable where myfield = 'myvalue'
    But if I use the following query it returns the result correctly.
    select * from mytable
    Also the myfield value 'myvalue' exists in the table.
    I have tried by running this query in both SQL Developer and SQL Plus. I have tried this query in mssql as well. It works perfectly and returns correct result sets for both the queries I have mentioned above. I'm unable to predict the issue as I'm new to ORACLE. Please help.
    Thanks,
    Ram.

    Hi Ram,
    I experienced an issue similar to this with a varchar2 field. Some of our records had a hidden newline character at the end of them, which was making queries like the one below fail:
    select * from employees
    where email = '[email protected]'The best way I found to detect this was to use
    select 'XX'||email||'XX' from employeesTo make sure that there were no newlines. But that is just a guess. If you could provide some example table data and the outputs of your selects, it would be helpful.
    Jeff

  • Summary column with where clause

    Hi all,
    I'm using Oracle Report Builder 10GR2. I have the following issue: In one of the query i have the following result :
    Suppliers     0
    Suppliers     1408
    Total in  BGN     1408
    Customers      6024
    Customers      11779.32
    Customers      
    Total in  BGN     11779.32
    Taxes      0
    Taxes      0
    Total in  BGN     0
    Cash      1363.85
    Cash      691
    Cash      991.23
    Cash      688
    Total in  BGN     2355.08I want to make a sum for these columns where corresponds to description " Total in BGN" . Maybe it is a simple task... Do i have a chance to select from a query in a Report Builder?
    If yes, pls specify? Or maybe there is a chance to add a where clause for summary column. But keep in mind that this is one of the queries in the report builder and i have to add summary with this conditions. I cannot change the existing query but probably add a new one.
    Any ideas?
    DB Version: 11g
    Thanks in advance,
    Bahchevanov.
    Edited by: bahchevanov on Sep 29, 2012 2:21 AM

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Case with where clause - ORA-00920: Invalid relational operator

    Hi All, when I try to run the query below, I get the following error...
    ORA-00920: invalid relational operator
    00920. 00000 -  "invalid relational operator"
    *Cause:   
    *Action:
    Error at Line: 16 Column: 5
    Does anyone know what's wrong with my query? thanks in advance.
    SELECT concat (year,period)
    FROM DD_ACTUALS_FACT
    WHERE CASE Period
    WHEN 'JAN' THEN '01'
    WHEN 'FEB' THEN '02'
    WHEN 'MAR' THEN '03'
    WHEN 'APR' THEN '04'
    WHEN 'MAY' THEN '05'
    WHEN 'JUN' THEN '06'
    WHEN 'JUL' THEN '07'
    WHEN 'AUG' THEN '08'
    WHEN 'SEP' THEN '09'
    WHEN 'OCT' THEN '10'
    WHEN 'NOV' THEN '11'
    WHEN 'DEC' THEN '12'
    END as "MonthNo"
    ORDER BY CONCAT (year,"MonthNo") DESC

    The problem is the as "MonthNo" - you can't give an "AS" alias to an expression in a where clause.
    You have not actually given any condition, just a set of translations from period into a number.
    You also haven't said what you're trying to do.
    Perhaps you want:
    SELECT concat (year,period)
    FROM DD_ACTUALS_FACT
    WHERE something
    ORDER BY CONCAT (year, CASE Period
    WHEN 'JAN' THEN '01'
    WHEN 'FEB' THEN '02'
    WHEN 'MAR' THEN '03'
    WHEN 'APR' THEN '04'
    WHEN 'MAY' THEN '05'
    WHEN 'JUN' THEN '06'
    WHEN 'JUL' THEN '07'
    WHEN 'AUG' THEN '08'
    WHEN 'SEP' THEN '09'
    WHEN 'OCT' THEN '10'
    WHEN 'NOV' THEN '11'
    WHEN 'DEC' THEN '12'
    END  ) DESC

  • Readonly table with where clause value from previous page

    Hi
    I am using jdeveloper 10.1.3.
    I have a globalhome page where the user enteres a reference number. i have a backing bean for the globalhome page that runs a method to run an sql that seraches for this reference number, if the reference number exsits the user is directed to a detail page.
    this detail page should display details of this reference number.
    i have set up a read only table to display this data based on a view object with a bind varaible in the where clause.
    however i am unsure how to set this bind varaible value to the reference entered in the first globalhome page.
    please can anyone advise how to do this.
    regards

    Hi,
    You can follow following steps to achieve this
    1) Write a custom method in your Application module like
    public void executeMyVO(String bindVarValue)
    MyVOImpl vo= getMyVo();
    vo.setNamedWhereClauseParam(<bind variable name decalred in VO>,bindVarValue);
    vo.execute();
    2) Expose the above method to client. (Right click AM-->Client-->Shift method from left to right)
    3) In the pagedef of globalhome page, create a method action for the aboce created custom method
    4) execute the method action from your backing bean after you run an sql that seraches for this reference number.
    Hope this help.
    Vikram

Maybe you are looking for

  • ITunes program removal?

    I recently down loaded quick time to view a video and wow guess what came bundled in with it? iTunes software! At first I figured no problem, I won't use it anyway. Recently I decided to remove programs I hadn't used in about 30 days just to keep thi

  • Run time error when trying to import bookmarks from firefox

    When trying to import bookmarks from Firefox to Safari I get the following error message: "Run Time Error. This application has requested the Runtime  to terminate it in an unusual way." Safari does not function anymore and I have to close it. Can so

  • Desktop software has stopped working

    See error message below: 10:54:15.775|FATAL|1|Exception|0|Fatal Error System.TypeInitializationException: The type initializer for 'System.Windows.Media.FontFamily' Upon launch of 6.0, the error occurs with this note: Blackberry Desktop Software has

  • How do I make a draft print with Epson xp 215

    Hello all, I am trying to print in 'draft mode' with my Epson xp 215 and I can't find this option under 'Media Quality'. Does the printer misses this option or is it something with the apple software. For the rest it works really fine. Thanks...

  • Spotlight and documents

    Hello, I have a question regarding spotlight. Every time I search a pdf file and open the file from the spotlight window afterwards, my search entry is displayed inside the pdf file as well. This is annoying because the preview zooms into the text (I