Help Query returns XMLType

I'm unable get XML output from the most basic of queries. I'm currently working through the Sql In Xml out document. Everytime i try to output xml i get a list (without errors) of
EMPLOYEE
<Xmltype>
<Xmltype>
<Xmltype>
<Xmltype>
<Xmltype>
for each record. Can anyone help.
Im running 10g release 2.

A couple more questions
First, is the XML stored in the table as XMLType column with a schema?
Second, in sqplus, on 10R2, I just ran the following query, try it and see if what you get.
select xmlforest(object_name as "name") from user_objects where object_type = 'TABLE' and rownum < 5;
XMLFOREST(OBJECT_NAMEAS"NAME")
<name>BIN$+1aDxmVbQIau51oiplxCAw==$0</name>
<name>BIN$+3Y2EpX4TvGY4j1SIGBAMQ==$0</name>
<name>BIN$+AugUYpGSS29uaP5DnYsZQ==$0</name>
<name>BIN$+ptFT7gqTX2GgNrndS5azw==$0</name>
Elapsed: 00:00:00.02
of course your names will vary.
Scott

Similar Messages

  • Hibernet query returns null for XMLTYPE data when I use oracle type4 driver

    Hi,
    I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
    Thanks in advance.
    regards,
    Amaresh

    Hi,
    I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
    Thanks in advance.
    regards,
    Amaresh

  • Result of function returning XMLType truncated in query

    Oracle 10.2.0.2.0
    myFunc() is a function returning XMLType
    The query:
    select myFunc() from dual;
    return XML about 2Kb
    If I try to run the following query:
    select XMLElement("Test",(myFunc())) from dual;
    then I get a pice of XML with strange symbols at the end (like this L#sП)
    in 9.2.8.0 all works properly. What I should do?

    CREATE TABLE test_data
    (loan_id VARCHAR2(12) NOT NULL,
    workparty_id NUMBER,
    property_id NUMBER,
    contact_id NUMBER,
    primary_flag NUMBER,
    gen_comment VARCHAR2(4000),
    last_updated DATE,
    user_name VARCHAR2(50),
    deleted_flag NUMBER,
    cont_role_id NUMBER,
    contact_person_id NUMBER);
    CREATE TABLE test_data2
    (contact_id NUMBER,
    name VARCHAR2(44));
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10541,12439,11445,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,6,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10542,12439,10697,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,2,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10543,12439,2070,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,10,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10544,12439,2070,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,11,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10545,12439,10527,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,19,33512);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12694,12439,11218,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12695,12439,11219,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12696,12439,11566,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11141,12439,10066,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,7,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11142,12439,11215,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,30,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11143,12439,11216,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,5,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11150,12439,10433,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,3,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12307,12439,1984,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,25,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',23792,12439,11217,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,15,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',87283,12439,14014,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,32,NULL);
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11218,'11218user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10433,'10433user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11217,'11217user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10066,'10066user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(14014,'14014user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11219,'11219user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11566,'11566user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11445,'11445user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10527,'10527user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11215,'11215user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10697,'10697user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(2070,'2070user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11216,'11216user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(1984,'1984user');
    commit;
    create or replace function myFuncXML return xmltype is
    ret xmltype;
    begin
    select
    XMLElement("WorkingParties",
    XMLAgg(
    XMLElement("Items",
    XMLForest(
    wp.workparty_id "ID",
    wp.loan_id "LoanID",
    wp.property_id "PropertyID",
    wp.contact_id "ContactID",
    wp.cont_role_id "ContRoleId",
    null "ParentContactID",
    wp.gen_comment "Description",
    wp.primary_flag "PrimaryFlag"
    ) into ret
    from test_data wp
    where
    nvl(wp.deleted_flag,0) <> 1 and
    wp.property_id = 12439
    and exists (select contact_id from test_data2 where contact_id = wp.contact_id)
    return ret;
    end;
    This sql returns - ok
    select myFuncXML from dual;
    This sql - fail
    select
    XMLElement("Test_root",
    myfuncxml
    from dual;
    if I comment line
    and exists (select contact_id from test_data2 where contact_id = wp.contact_id)
    in function - all works fine

  • XML attributes makes my query return no rows

    Hello everyone,
    I've an odd problem.
    I'm querying some XML, but the attributes in one of the tags make my query return no rows; if I remove the attributes, then the query works as expected.
    The XML is below; it's the attributes in the Report tag that cause the issues:
    <result errorCode="0">
         <return>
              <Report
                   xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&amp;rs%3AFormat=xml&amp;rc%3ASchema=True"
                   Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns="Items_x0020_status_x0020_information">
                   <Tablix1>
                        <Details_Collection>
                             <Details ItemId="914P7" Username="test" user_role="IT"
                                  first_name="Barry" last_name="Donovan" organisation=""
                                  content_format="On_Screen" modified_date="26/05/2011 13:16:49"
                                  item_status="Draft" status_date="" component_name="" demand="" />
                        </Details_Collection>
                   </Tablix1>
              </Report>
         </return>
    </result>My query is:
         select
                a.item_id
               ,a.username
               ,a.user_role
               ,a.first_name
               ,a.last_name
               ,a.supplier_id
               ,a.format
               ,a.modified_date
               ,a.item_status
               ,a.completion_date
               ,a.component_code
             from   dual
                   ,xmltable
                    ('/result/return/Report/Tablix1/Details_Collection/Details'
                       passing p_xml
                       columns
                          item_id         varchar2(1000) path '@ItemId'
                         ,username        varchar2(1000) path '@Username'
                         ,user_role       varchar2(1000) path '@user_role'
                         ,first_name      varchar2(1000) path '@first_name'
                         ,last_name       varchar2(1000) path '@last_name'
                         ,supplier_id     varchar2(1000) path '@organisation'
                         ,format          varchar2(1000) path '@content_format'
                         ,modified_date   varchar2(1000) path '@modified_date'
                         ,item_status     varchar2(1000) path '@item_status'
                         ,completion_date varchar2(1000) path '@status_date'
                         ,component_code  varchar2(1000) path '@demand'
                    ) a;I've tried stripping out the attributes in the tag, which does work, but some of the XML I'm expecting back may be quite large (many records), so that caused issues in itself. I'd rather deal with it and not mess with the XML itself if possible.
    Any help would be hugely appreciated!
    Thank you very much in advance.
    Robin
    Edited by: User_resU on Apr 12, 2012 2:50 PM

    Example:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select xmltype('<result errorCode="0">
      2     <return>
      3             <Report
      4                     xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&amp;rs%3AFormat=xml&amp;rc%3ASchema=True"
      5                     Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6                     xmlns="Items_x0020_status_x0020_information">
      7                     <Tablix1>
      8                             <Details_Collection>
      9                                     <Details ItemId="914P7" Username="test" user_role="IT"
    10                                             first_name="Barry" last_name="Donovan" organisation=""
    11                                             content_format="On_Screen" modified_date="26/05/2011 13:16:49"
    12                                             item_status="Draft" status_date="" component_name="" demand="" />
    13                             </Details_Collection>
    14                     </Tablix1>
    15             </Report>
    16     </return>
    17  </result>') as xml from dual)
    18  --
    19  -- end of test data
    20  --
    21       select
    22              a.item_id
    23             ,a.username
    24             ,a.user_role
    25             ,a.first_name
    26             ,a.last_name
    27             ,a.supplier_id
    28             ,a.format
    29             ,a.modified_date
    30             ,a.item_status
    31             ,a.completion_date
    32             ,a.component_code
    33           from   t
    34                 ,xmltable
    35                  (xmlnamespaces('Items_x0020_status_x0020_information' as "x0"),
    36                   '//x0:Report/x0:Tablix1/x0:Details_Collection/x0:Details'
    37                     passing xml
    38                     columns
    39                        item_id         varchar2(1000) path '@ItemId'
    40                       ,username        varchar2(1000) path '@Username'
    41                       ,user_role       varchar2(1000) path '@user_role'
    42                       ,first_name      varchar2(1000) path '@first_name'
    43                       ,last_name       varchar2(1000) path '@last_name'
    44                       ,supplier_id     varchar2(1000) path '@organisation'
    45                       ,format          varchar2(1000) path '@content_format'
    46                       ,modified_date   varchar2(1000) path '@modified_date'
    47                       ,item_status     varchar2(1000) path '@item_status'
    48                       ,completion_date varchar2(1000) path '@status_date'
    49                       ,component_code  varchar2(1000) path '@demand'
    50*                 ) a
    SQL> /
    ITEM_ID
    USERNAME
    USER_ROLE
    FIRST_NAME
    LAST_NAME
    SUPPLIER_ID
    FORMAT
    MODIFIED_DATE
    ITEM_STATUS
    COMPLETION_DATE
    COMPONENT_CODE
    914P7
    test
    IT
    Barry
    Donovan
    On_Screen
    26/05/2011 13:16:49
    Draft

  • Multi-row sub query returns  ORA-00904 :invalid identifier error

    I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2.
    I was using a case statement to check if there was data and then an in-line query or subquery. Once again, the idea is to have a single line on the report for each table1 record.
    I get this error with the code below. It seems the nested multi-row subquery can not see the a.cr_mas_cr_no identifier.
    ORA-00904: "a"."cr_mas_cr_no": invalid identifier
    Any help is greatly appreciated,
    Sam
    select
    a.cr_mas_cr_no "CRNO", a.cr_mas_type "TYPE", a.cr_mas_status "CR Status",
    a.cr_mas_date_logged "Logged date", a.CR_REL_REQ_APP_DATE "RTP approved",a.CR_REL_REQ_RTP_DATE "RTP Date",
    a.cr_accepted_date "Complete", a.cr_mas_submitted_by "Requester",
    select doc_user FROM crrm_cr_documents WHERE doc_cr_number =a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'BD' ) "Bus Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TD' ) "Tech Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TE' ) "User acceptance test",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 1
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 2)
    end
    "RTP #2",
    a.CR_REL_REQ_RTP_BY "Released by",
    a.CR_ACCEPTED_BY "Post RTP User Acceptance",
    a.cr_mas_title "Title", a.cr_mas_id "ID"
    from
    crrm_crmaster a
    where
    (a.CR_REL_REQ_RTP_DATE >= :P1109_BEGDATE and (a.CR_REL_REQ_RTP_DATE <= :P1109_ENDDATE) and
    (a.cr_mas_status = 'Complete' or (a.cr_mas_status = 'Release Approved'and a.CR_REL_REQ_APP_DATE < :P1109_ENDDATE))
    Message was edited by:
    slavanaway

    Iceman,
    Thanks for the reply I will try your suggestion.
    I will try and explain why I think two subqueries (an in-line query with a subquery?) are required. I will use the creation of the column RTP #1 as the example as the RTP #2 column is only different in the rownum selected.
    Looking only at the lines that fail, here is my analysis. (If I rem out the two case lines the query runs, I just don't get two columns of data I need.) I will only examine the first case as the second is changed to extract the second approval via the rownum = 2 criteria. The first statement checks there is at least one RTP approval stored for the request and then gets the user who approved the request if the test is true.
    case when
    (select count(appr_user) from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then
    The above part works fine and the correct count of approvals is returned.
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no=a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    I moved the parenthesis to the correct location. There can be multiple approvals for a given parent record. Some parent records need one, some need two approvals. If I replace
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    with
    (select appr_user from approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP' and rownum = 1)
    The correct result is returned because it returns exactly one row as rownum=1 limits the query. When rownum = 2 then the query returns null as the rownum never gets to two as the rownum column is built via the set created by the second subquery.
    The subquery builds a set of approvals for a specific "cr_no" and appr_type of "RTP". the outer query then looks at the rownum of the second query
    Here is where I got the rownum information from;
    http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
    So here is what I think is happening;
    1. Main query From and Where are processed. This should provide the "set" for the query
    2.The from subqueries for RTP #1 and RTP #2 should be able to access the a.cr_mas_cr_no field and build a set from the approvals table.
    3.The RTP #1/2 subquery (inline maybe a better description?) would then get the correct row from the from subquery.
    The error "invalid identifier" refers to the a.cr_mas_cr_no field. I assume it means it can not resolve the table alias inside the subquery.
    So maybe your grouping would help, I will try.
    Sam

  • Using index in a query return few records than full table access

    Today we have an issue with a query, when it use the ok index the returned are not all records that apply to where clause condition.
    See bellow
    explain plan for
    select * from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 136999
    SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1882720105
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | TABLE ACCESS BY INDEX ROWID| ZAN_M03 |
    |* 2 | INDEX RANGE SCAN | PK_ZAN_M03 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    2 - access("M00AF"=TO_DATE('11/01/28','YY/MM/DD') AND "M00ZA"=10 AND
    "M00AC"=50 AND "M00AD">=136906 AND "M00AD"<=137141)
    filter("M00AD"<=137141 AND "M00AD">=136906)
    Note
    - rule based optimizer used (consider using cbo)
    20 rows selected.
    The query above return only one row insted 1579 record that apply to this conditions.
    When forcing a full table acess with a hint, the query return all records that apply, the 1579 record.
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    Can you help me to identify what's happening?
    I am with Oracle 10g R2 10.2.0.4 standard edition
    the statistics are up to date
    the opitimizer_mode are rule, but altering in session level to all_rows happens the same issue.
    Nothing about corruption in the alert log.
    Thanks in advance
    Regards
    Cristiano

    Yes the query are the same and correct restriction for where clause are M00AD between 136906 and 137141.
    I've pasted, by mistake, another test query
    The corrects are:
    select M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This use pk index and return one row
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This does a full table access and return 1579 records
    I´ve been searching for wrong results bugs on my oracle support, but not found one that mentions something like our issue.
    I checked the dba_tables and dba indexes and the number of rows are different, and I think this would be the same because it's is a pk.
    Look this
    SQL> select NUM_ROWS from dba_tables where table_name = 'ZAN_M03'
    2 /
    NUM_ROWS
    228527878
    select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    SQL> select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    NUM_ROWS
    217510185
    Is normal a index for pk having much fewer rows than table? I think not, but not sure.
    Again
    Thanks in advance
    Regards
    Cristiano

  • Why Doesn't Query Return Date Values On Eval Table?

    Using Oracle 11.2.0.1 with XMLType Secure File Table named Eval.
    An interesting situation is occurring when attempting to query. A couple of things are going on.
    These queries do not have registered schemas.
    1. This query works fine
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact/ns7:defId' passing e.object_value AS "p" RETURNING CONTENT)
    AS varchar2(100)) "Definition ID"
    FROM eval e;When adding a condition in the query to get defId=52657, get all nulls - even though this record exists - see sample data below.
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=888]/ns7:defId' passing e.object_value AS "p" RETURNING CONTENT)
    AS varchar2(100)) "Definition ID"
    FROM eval e;
    <?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="1957" acmeMemberId="3df55bd8-b3a6-4ba3-85e7-e8a188b7b4ed" category="external" eval_dt="2012-02-11T23:45:10.266Z" evalId="876d4035-aaf9-4f09-ae40-43498ec4973b" xmlns="http://www.cigna.com/acme/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/acme/domains/derived/fact/2010/03" xmlns:ns3="http://www.cigna.com/acme/domains/common/2010/03">
       <derivedFacts>
          <ns2:derivedFact>
             <ns2:defId>52657</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52657:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52600</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52599</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>INT</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51400</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51400:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>integer</ns2:type>
                <ns2:value>34</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52177</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52177:3</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52075</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52075:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>M</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51391</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51391:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51473</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51473:1</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>date</ns2:type>
                <ns2:value>2011-01-01</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51474</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51474:1</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>date</ns2:type>
                <ns2:value>9999-12-31</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52151</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52151:3</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51048</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51048:5</ns2:defUrn>
             <ns2:factSource>CCDR ProfileFact</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>60380</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:60380:1</ns2:defUrn>
             <ns2:factSource>CCDR ProfileFact</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
       </derivedFacts>
    </eval>Seem to be missing something conceptually, as to why this is not working.
    2. When replacing defId with origInferred_dt and adjust for the datatype; the query returns all nulls
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;Same here, seem to be missing something conceptually...
    Ultimately hoping to get this query to correctly work:
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=52657]/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;Any assistance would be much appreciated to say the least! :)
    Regards,
    Rick Blanchard

    Hi Rick,
    Ultimately hoping to get this query to correctly work:
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=52657]/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;
    Remove the initial slash in the predicate [ns7:defId=...] :
    xmlcast(
      xmlquery(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03"; (::)
         declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03"; (::)
         $p/eval/derivedFacts/ns7:derivedFact[ns7:defId=52657]/ns7:origInferred_dt'
         passing e.object_value AS "p"
         RETURNING CONTENT
      AS TIMESTAMP WITH TIME ZONE
    ) "Original Inferred Date"

  • Query returns more than one row

    hi all,
    I am getting this error msg, single row query returns more than one row after i added this
    (select FUNC_GET_COUNTY_NAME(CCNTY1)
              FROM   proposal ) CName,  
    and the error is righ here  AND K.CONTID = Q.CONTID
    can someone help me what to do to take care of this error msg.
    SELECT DISTINCT Decode(trim(Min(J.ROUTE)),null,'Un known', Min(J.ROUTE)) rt, v.vendor vd, r.addrnum ad, v.vnamel vn,
    TRIM (r.aaddr1 || decode(trim(r.aaddr2),null,'',' - ') || r.aaddr2) ad1,
    p.billto, r.acity cy, r.astate st,r.azipcode zp,
    (select FUNC_GET_COUNTY_NAME(CCNTY1)
              FROM   proposal ) CName,   
    substr(decode(trim(r.vasst1),null, 'N/A','000/000-0000?','N/A','000/000-0000','N/A', r.vasst1),1,12) fx, 
    substr(decode(trim(r.aphone),null, 'N/A','000/000-0000?','N/A', r.aphone),1,12)ph,                     
    substr(l.letting,3,2)||'-'|| substr(l.letting,5,2)||'-'|| substr(l.letting,1,2)lt,
    l.CALL cl, l.lcontid cid, q.cprojnum sp, q.cfacssup ds,q.ccnty1 cty
    FROM VENDOR V, VENDADDR R, LETPROP L, PLANHOLD P,PROPOSAL Q, PROJECT J,PROPPROJ K
    WHERE V.VENDOR = R.VENDOR
    AND K.CONTID = Q.CONTID
    AND K.PCN = J.PCN
    AND L.LCONTID = K.CONTID         
    and l.lcontid =   '060143'
    AND P.VENDOR = V. VENDOR
    AND L.LETTING = P.LETTING
    AND L.CALL = P.CALL
    AND R.ADDRNUM = P.BILLTO
    group by V.VENDOR,R.ADDRNUM, V.VNAMEL, R.AADDR1, R.AADDR2,P.BILLTO,R.ACITY, R.ASTATE,
    R.AZIPCODE,R.VASST1,R.APHONE,L.LETTING, L.CALL,L.LCONTID,Q.CPROJNUM,Q.CFACSSUP,Q.CCNTY1 ,CCNTY1
    ORDER BY Q.CPROJNUM DESC

    (select FUNC_GET_COUNTY_NAME(CCNTY1)
    FROM proposal ) CName,You have no where clause.
    But you might not need a select statement at all. Instead of a scalar subquery, can you just call the function:
    ,FUNC_GET_COUNTY_NAME(CCNTY1)

  • Using external parameters within MS Query returning that data right into a pivot table Excel 2010

    In Excel 2010 i was able to use the external parameters within MS Query returning that data right into a pivot table.  But the parameter on the worksheet will not save in the paremeter setting of the data connection.  And if you save it and open
    it and try to refresh the pivot table Excel stops responding and you have to force the file closed.  I found out the reason to crash is that it did not keep the parameter saved.
    Can this be fixed?

    Hi,
    Just
    checking in to see if the information of Oskar was helpful. Please
    let us know if you would like further assistance.
    Jaynet Zhang
    TechNet Community Support

  • Returning XMLType to JSP

    Hello, all.
    I have a stored function that returns XMLType data to a JSP page, similar to the example in the Oracle XML DB Developer's Guide (13-4). My schema was developed with great help from this forum and is referenced here:Re: unique constraint defined in xsd
    My problem is I am getting the following error when I try to access the returned data in the jsp page:
    java.lang.ClassCastException: oracle.sql.OPAQUE
         at querymaps.jspService(querymaps.jsp:45)
    I cannot quite figure out how to get to the returned data.
    Here is the stored function and a sample of data the same select statement returns:
    CREATE OR REPLACE FUNCTION getMaps(userName varchar2)
    RETURN XMLTYPE
    AS
    xmlDoc XMLTYPE;
    BEGIN
    SELECT extract(OBJECT_VALUE, '/mapset/map') into xmlDoc
    FROM mapsetxml
    WHERE existsNode(OBJECT_VALUE,'/mapset['''|| username ||''']')=1;
    RETURN xmlDoc;
    END;
    <map>
    <mapname>Florida</mapname>
    <layer>
    <layername>Counties</layername>
    <layerid>counties</layerid>
    <service>base</service>
    <visible>1</visible>
    <ftype>polygon</ftype>
    </layer>
    <placemark>
    <placename>Florida</placename>
    <envelope>
    <minx>-186185.234572</minx>
    <miny>2709914.999735</miny>
    <maxx>596332.812876</maxx>
    <maxy>3464678.999670</maxy>
    </envelope>
    </placemark>
    </map>
    The JSP scriplet code is nearly right from the sample- I am using a dataSource connection, so I don't know if that is the problem, or not.
    <%
    Connection conn=null;
    CallableStatement stmt = null;
    String dSrcName="jdbc/localDS";
    String userName="tester";
    XMLType xmlRes = null;
    InitialContext ctxt = new InitialContext();
    DataSource ds = (DataSource) ctxt.lookup(dSrcName);
    conn = ds.getConnection();
    try {        
    stmt=conn.prepareCall("{ ? = call getmaps(?)}");
    stmt.registerOutParameter(1, OracleTypes.OPAQUE,"SYS.XMLTYPE");
    stmt.setString(2, userName);
    stmt.execute();
    xmlRes = (XMLType) stmt.getObject(1);
    if (xmlRes != null) {
    String mapString = xmlRes.getStringVal();
    out.println("The map xml for :"+userName+" is "+mapString);
    } catch (SQLException se) {
    out.println(se.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    } finally {
    stmt.close();
    conn.close();
    %>
    Thanks again.

    Given the follow
    SQL> var schemaURL varchar2(256)
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://localhost:8080/public/mapset.xsd';
      3    :schemaPath := '/public/mapset.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      6             xmlns:xdb="http://xmlns.oracle.com/xdb"
      7             version="1.0" xdb:storeVarrayAsTable="true">
      8    <!-- definition of simple types -->
      9    <xs:simpleType name="nameType">
    10      <xs:restriction base="xs:string">
    11        <xs:minLength value="1"/>
    12        <xs:maxLength value="50"/>
    13      </xs:restriction>
    14    </xs:simpleType>
    15    <xs:simpleType name="boolType">
    16      <xs:restriction base="xs:unsignedByte">
    17        <xs:minInclusive value="0"/>
    18        <xs:maxInclusive value="1"/>
    19      </xs:restriction>
    20    </xs:simpleType>
    21     <xs:simpleType name="minxType">
    22      <xs:restriction base="xs:string">
    23      </xs:restriction>
    24    </xs:simpleType>
    25     <xs:simpleType name="minyType">
    26      <xs:restriction base="xs:string">
    27      </xs:restriction>
    28    </xs:simpleType>
    29     <xs:simpleType name="maxxType">
    30      <xs:restriction base="xs:string">
    31      </xs:restriction>
    32    </xs:simpleType>
    33     <xs:simpleType name="maxyType">
    34      <xs:restriction base="xs:string">
    35      </xs:restriction>
    36    </xs:simpleType>
    37    <xs:simpleType name="usernameType">
    38      <xs:restriction base="xs:string">
    39        <xs:minLength value="7"/>
    40        <xs:maxLength value="8"/>
    41      </xs:restriction>
    42    </xs:simpleType>
    43    <xs:simpleType name="emailType">
    44      <xs:restriction base="xs:string">
    45        <xs:minLength value="19"/>
    46        <xs:maxLength value="63"/>
    47      </xs:restriction>
    48    </xs:simpleType>
    49     <!-- definition of complex types -->
    50  <xs:complexType name="envType">
    51      <xs:sequence>
    52        <xs:element name="minx"  type="minxType" minOccurs="1" xdb:SQLName="MINX" />
    53        <xs:element name="miny" type="minyType" minOccurs="1" xdb:SQLName="MINY"/>
    54        <xs:element name="maxx"  type="maxxType" minOccurs="1" xdb:SQLName="MAXX" />
    55        <xs:element name="maxy" type="maxyType" minOccurs="1" xdb:SQLName="MAXY"/>
    56      </xs:sequence>
    57    </xs:complexType>
    58   <xs:complexType name="placemarkType">
    59      <xs:sequence>
    60        <xs:element name="placename"  type="nameType" minOccurs="1" xdb:SQLName="PLACENAME"/>
    61        <xs:element name="envelope" type="envType" minOccurs="1" xdb:SQLName="ENVELOPE"/>
    62      </xs:sequence>
    63    </xs:complexType>
    64    <xs:complexType name="layerType">
    65      <xs:sequence>
    66        <xs:element name="layername"  type="nameType" minOccurs="1" xdb:SQLName="LAYERNAME" />
    67        <xs:element name="layerid"  type="nameType" minOccurs="1" xdb:SQLName="LAYERID" />
    68        <xs:element name="service" type="nameType" minOccurs="1" xdb:SQLName="SERVICE"/>
    69        <xs:element name="visible" type="boolType" xdb:SQLName="VISIBLE"/>
    70        <xs:element name="ftype" type="nameType" xdb:SQLName="FTYPE" minOccurs="1" maxOccurs="1"/>
    71      </xs:sequence>
    72    </xs:complexType>
    73     <xs:complexType name="mapType">
    74      <xs:sequence>
    75        <xs:element name="mapname"  type="nameType" minOccurs="1" xdb:SQLName="MAPNAME"/>
    76        <xs:element name="layer"  type="layerType" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="LAYER" />
    77        <xs:element name="placemark" type="placemarkType" minOccurs="1" maxOccurs="unbounded"  xdb:SQLName="PLACEMARK"/>
    78      </xs:sequence>
    79    </xs:complexType>
    80    <xs:complexType name="mapsetType" xdb:SQLType="mapset_t">
    81      <xs:sequence>
    82        <xs:element name="username"  type="usernameType" minOccurs="1" xdb:SQLName="USERNAME" />
    83       <xs:element name="map" type="mapType" minOccurs="1" maxOccurs="unbounded"  xdb:SQLName="MAP" xdb:SQLCollType="MAP_V"/>
    84       <xs:element name="startmap" type="nameType" minOccurs="1" maxOccurs="1" xdb:SQLName="STARTMAP"/>
    85       <xs:element name="startplace" type="nameType" minOccurs="1" maxOccurs="1" xdb:SQLName="STARTPLACE"/>
    86      </xs:sequence>
    87    </xs:complexType>
    88   <!--definition of main element -->
    89    <xs:element name="mapset" type="mapsetType" xdb:defaultTable="MAPSETXML">
    90      <xs:unique name="mapNameKey">
    91         <xs:selector xpath=".//map"/>
    92         <xs:field xpath="mapname"/>
    93      </xs:unique>
    94    </xs:element>
    95    </xs:schema>');
    96  begin
    97    if (dbms_xdb.existsResource(:schemaPath)) then
    98      dbms_xdb.deleteResource(:schemaPath);
    99    end if;
    100    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    101  end;
    102  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,TRUE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2    nested_table_name varchar2(32);
      3  begin
      4    select table_name
      5      into nested_table_name
      6      from user_nested_tables
      7     where table_type_name = 'MAP_V'
      8       and parent_table_name = 'MAPSETXML';
      9
    10     execute immediate 'rename "'|| nested_table_name ||'" to MAP_TABLE';
    11
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    SQL> desc MAPSETXML
    Name                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/public/mapset.xsd" Element "mapset") STORAGE Object-relational TYPE "mapset_t"
    SQL> --
    SQL> desc MAP_TABLE
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    MAPNAME                                            VARCHAR2(50 CHAR)
    LAYER                                              LAYER7525_COLL
    PLACEMARK                                          PLACEMARK7528_COLL
    SQL> --
    SQL> --
    SQL> create or replace trigger VALIDATE_MAPSET
      2  before insert or update on MAPSETXML
      3  for each row
      4  begin
      5     :new.object_value.schemaValidate();
      6  end;
      7  /
    Trigger created.
    SQL> insert into MAPSETXML values ( xmltype('<mapset>
      2  <username>tester1</username>
      3  <map>
      4  <mapname>Florida</mapname>
      5  <layer>
      6  <layername>Counties</layername>
      7  <layerid>counties</layerid>
      8  <service>base</service>
      9  <visible>1</visible>
    10  <ftype>polygon</ftype>
    11  </layer>
    12  <placemark>
    13  <placename>Florida</placename>
    14  <envelope>
    15  <minx>-186185.234572</minx>
    16  <miny>2709914.999735</miny>
    17  <maxx>596332.812876</maxx>
    18  <maxy>3464678.999670</maxy>
    19  </envelope>
    20  </placemark>
    21  </map>
    22  <startmap>test</startmap>
    23  <startplace>Tallahassee</startplace>
    24  </mapset>
    25  ').createSchemaBasedXML('http://localhost:8080/public/mapset.xsd'))
    26  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> set long 100000
    SQL> --
    SQL> select * from MAPSETXML
      2  /
    SYS_NC_ROWINFO$
    <mapset>
      <username>tester1</username>
      <map>
        <mapname>Florida</mapname>
        <layer>
          <layername>Counties</layername>
          <layerid>counties</layerid>
          <service>base</service>
          <visible>1</visible>
          <ftype>polygon</ftype>
        </layer>
    SYS_NC_ROWINFO$
        <placemark>
          <placename>Florida</placename>
          <envelope>
            <minx>-186185.234572</minx>
            <miny>2709914.999735</miny>
            <maxx>596332.812876</maxx>
            <maxy>3464678.999670</maxy>
          </envelope>
        </placemark>
      </map>
      <startmap>test</startmap>
    SYS_NC_ROWINFO$
      <startplace>Tallahassee</startplace>
    </mapset>
    SQL> CREATE OR REPLACE FUNCTION getMaps(userName varchar2)
      2  RETURN XMLTYPE
      3  AS
      4  xmlDoc XMLTYPE;
      5  BEGIN
      6    SELECT extract(OBJECT_VALUE, '/mapset/map') into xmlDoc
      7    FROM mapsetxml
      8    WHERE existsNode(OBJECT_VALUE,'/mapset['''|| username ||''']')=1;
      9    RETURN xmlDoc;
    10  END;
    11  /
    Function created.
    SQL> select getMaps('Florida') from dual;
    GETMAPS('FLORIDA')
    <map>
      <mapname>Florida</mapname>
      <layer>
        <layername>Counties</layername>
        <layerid>counties</layerid>
        <service>base</service>
        <visible>1</visible>
        <ftype>polygon</ftype>
      </layer>
      <placemark>
        <placename>Florida</placename>
    GETMAPS('FLORIDA')
        <envelope>
          <minx>-186185.234572</minx>
          <miny>2709914.999735</miny>
          <maxx>596332.812876</maxx>
          <maxy>3464678.999670</maxy>
        </envelope>
      </placemark>
    </map>
    SQL>The following Java code
    package com.oracle.st.xmldb.otn;
    import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
    import com.oracle.st.xmldb.pm.examples.GetResourceByResourceID;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OracleTypes;
    import oracle.sql.RAW;
    import oracle.xdb.XMLType;
    import oracle.xdb.dom.XDBDocument;
    public class T415572 extends BaseApplication {
        public T415572() {
        public void doSomething(String[] Args) throws Exception
          OracleCallableStatement  statement = null;
          boolean result;
          statement = (OracleCallableStatement) getConnection().prepareCall("{ ? = call getmaps(?)}");
          statement.registerOutParameter(1,OracleTypes.OPAQUE,"SYS.XMLTYPE");
          statement.setString(2,"Florida");
          result = statement.execute();
          XMLType xml = (XMLType) statement.getObject(1);
          statement.close();
          XDBDocument doc = (XDBDocument) xml.getDOM();
          doc.writeToOutputStream(System.out);
          doc.close();
          getConnection().close();
        public static void main (String[] args)
         try
           BaseApplication example = new T415572();
           example.initializeConnection();
           example.doSomething(args);
         catch (Exception e)
           e.printStackTrace();
    }results in
    C:\TEMP>
    C:\Oracle\JDeveloper\jdk\bin\javaw.exe -client -classpath C:\xdb\JDeveloper\Classes;C:\Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;C:\Oracle\product\10.2.0\db_1\LIB\xmlparserv2.jar;C:\Oracle\product\10.2.0\db_1\RDBMS\jlib\xdb.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\jakarta-slide-webdavlib-2.1.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\commons-httpclient.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\commons-logging.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\jdom-1.0.jar -Dcom.oracle.st.xmldb.pm.ConnectionParameters=C:\\xdb\\jdeveloper\\SimpleExamples\\LocalConnection.xml -Dhttp.proxyHost=www-proxy.us.oracle.com -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=192.168.0.77|localhost|192.168.1.1|*.oracle.com|*.us.oracle.com -Dhttps.proxyHost=www-proxy.us.oracle.com -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=192.168.0.77|localhost|192.168.1.1|*.oracle.com|*.us.oracle.com com.oracle.st.xmldb.otn.T415572 -mx2048M
    ConnectionProvider.establishConnection(): Connecting as SCOTT/TIGER@jdbc:oracle:oci8:@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(service_name=ORA10GR2.xp.mark.drake.oracle.com)(server=DEDICATED)))
    ConnectionProvider.establishConnection(): Database Connection Established
    <map>
      <mapname>Florida</mapname>
      <layer>
        <layername>Counties</layername>
        <layerid>counties</layerid>
        <service>base</service>
        <visible>1</visible>
        <ftype>polygon</ftype>
      </layer>
      <placemark>
        <placename>Florida</placename>
        <envelope>
          <minx>-186185.234572</minx>
          <miny>2709914.999735</miny>
          <maxx>596332.812876</maxx>
          <maxy>3464678.999670</maxy>
        </envelope>
      </placemark>
    </map>
    Process exited with exit code 0.The code also works fine when modified to work with the thin driver...
    Message was edited by:
    mdrake

  • Finder query return type..?

    I'm using a session bean ProcessBean and an entity bean AlarmBean....
    where one of functions processor() of ProcessDataBean is like......
    processor()
    println(.a..);
    println(..b.);
    correlate();
    println(.c..);
    And correlator() is like:-
    correlator()
    println(..d.);
    AlarmBeanLocal l = finder query();
    println(.e..);
    if(l != null)
    println(.m..)
    else
    println(.n..)
    Finder query returns the reference to the entity bean's local interface.......and depending on whether find is successful or not....I've to print m or n....
    Now the problem is whenever find is successful.......e, then m and then c gets printed......
    but when finder query is not successful, e and n doesn't get printed....and directly c gets printed...it means finder query is directly returning control to the previous function(processor where c is getting printed) .......
    I'm not getting whr. is the problem....
    in the condition l != null......?
    Plz. help me out...
    All the declarations in local and home interfaces and ejb-jar is correct.......and my jar file is deployed successfully.....but the output is not correct.....

    Hi Swati,
    Assuming ur finder returns a Single-object
    Single-object finder method may return a null value . If result set of query consists of a single null value, container must return null value as result of method. If resultset of a query for a single-object finder method contains more than one value (whether non-null, null, or a combination), container must throw FinderException from finder method. If result set of query contains no values, container must throw ObjectNotFoundException.
    HTH,
    Seetesh

  • CAML Query returning all items with date condition

    HI,
    I have a problem doing a query with CAML over the elements of a calendar in SharePoint 2013
    I just want to retrieve all items, which have been modified on a particular date. But below query returns all items from the Calendar.
    Any suggestion how to get specific items from the calendar. The same issue exists for start date  and end date.
      var oWebsite = clientContext.get_web();
        this.collList = oWebsite.get_lists();
        var camlQuery1 = new SP.CamlQuery();
       camlQuery1.set_viewXml(
       '<query><Where>'+
          '<Eq>'+
             '<FieldRef Name=\'Modified\'  IncludeTimeValue=\'TRUE\'/>' +
             '<Value Type=\'DateTime\'>2014-02-24T12:00:00Z</Value>'+
          '</Eq>'+
       '</Where></query>');
        this.collListItem1 = oList.getItems(camlQuery1);
        clientContext.load(collListItem1);

    Firstly try to make this change in your query and see if that helps
    camlQuery1.set_viewXml(
    '<View><Query><Where>'+
    '<Eq>'+
    '<FieldRef Name=\'Modified\' IncludeTimeValue=\'TRUE\'/>' +
    '<Value Type=\'DateTime\'>2014-02-24T12:00:00Z</Value>'+
    '</Eq>'+
    '</Where></Query></View>');
    Geetanjali Arora | My blogs |

  • Query return/wddx with white space

    i have a query return i am looking at which i will send it to
    another program but for some reason this is coming with some white
    space. i have following questions.
    if i make changes on the admin console for white space
    management do i need to reboot.
    i am trying to use cfsetting but it is still producing some
    white spaces at the beginging. when i see the source.

    The CF admin setting helps but does not completely solve
    whitespace issues. (Look at the source for these forum pages, for
    example..)
    Also, beware of people who tell you to strip the whitespace
    off after the fact by manipulating CF output as though it were a
    string.
    Put this at the top of your Application.cfm or
    Application.cfc:
    <CFSETTING EnableCFOutputOnly = "yes">
    This means that nothing makes it to the page unless it is
    inside <CFOUTPUT> tags or in WriteOutput ().
    This is good practice anyway because it encourages you to
    separate output code from logic and makes you more conscious of
    whitespace as you code.
    Finally, for XML to some programs or the <DOCTTYPE>
    declaration to IE know that the output must be immediately after
    the first <CFOUTPUT> with no whitespace of any type.
    IE:
    <CFOUTPUT><?xml version="1.0" encoding="UTF-8"?>
    works but
    <CFOUTPUT>
    <?xml version="1.0" encoding="UTF-8"?>
    doesn't.

  • Query on XMLType! URGENT!!!

    Please, what the most efficient way to query a xmltype column?
    My xml's are 250KB ~ 1.5 MB and my table have over 130.000 records.
    I have tried:
    1) interMedia -> create index [indexname] on [table] (field) indextype is ctxsys.context parameters ('section group path_section_group')
    but results a error on creating...
    2) Table Functions, but a enough memory error results...
    3) create index on xpath directly, but the repetead tag's are discarded...
    I don't know what to do...
    Please, help me!!!
    Thanks...
    Marlon

    May be this is of some help -
    "compile error in hidden module: clBExevent bulider" error in BW 3.5!

  • I need that this query return only one value

    Hi, please. I need your help. I have this query:
    SELECT c.charvalue "Comentario", max(pi.id) as "id" --into :gcpe_last_comment
    FROM twflprocessinstances pi, twfliprocessparameters c
    WHERE pi.id = c.iprocess_id
    AND c.param_id = 1002286
    AND c.charvalue IS NOT NULL
    AND pi.processdef_id = 1600
    AND to_number(pi.id) <> 3817940
    AND to_number(pi.seeparameter1) =80137377
    group by c.charvalue
    having max(pi.id)
    This query return 3 rows, but I need that this query return only one row. The row that this query should return is the row before at the max id. Thanks

    Mmmm...I don't get it.
    You might need to post some sample data and expected results.

Maybe you are looking for

  • Fi Issue

    Hello all, I have some query please solve it. The points are as follows: Whether TDS u/s 192 salary is covered in SAP or Not? 2.Under closing procedure whether daily option is available or not beside monthly and yearly? 3.Whether monthly tds certific

  • Mirror your mac to TV with AppleTV

    I'm looking for a way to mirror whats on my macbook pro on to my TV using AppleTV. I know that you can use airplay with different applications but was wondering if you can display your monitor.

  • Select more than 60 values at a query isn't possible?

    Post Author: fmonsma CA Forum: WebIntelligence Reporting I can't select more than 60 values at my query. We got id numbers. I want to select the name, adress, zipcode etc. of for example 80 id numbers. BO doesn't allow me to make this query. In SQL i

  • Dynamic Tabs in JSF using tabbedPane

    I want to create tabs from the list retreived from DB. How to do Can anyone explain

  • Knowledge Provider KPRO architecture integration with Documentum

    Hi All, As a part of KPro architecture it is understood that the SAP Content server at the bottom layer can be replaced by any third party Content server and in our case we wish to make use of Documentum content server in place of SAP content server