How to read repeated tag values using sql query

Database version
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Question
How to get repeated tag values?
<TXLife>
<TXLifeRequest>
<TransRefGUID>10bc80e7d60e59b0:a134d0:10d7c4674ad:-7ffd</TransRefGUID>
<TransType tc="1203">OLI_TRANS_TRNHLD</TransType>
<TransExeDate>2011-02-27</TransExeDate>
<TransExeTime>15:06:35</TransExeTime>
<InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
<InquiryView>
<InquiryViewCode>PLANUPDATE_CHBM_1203A</InquiryViewCode>
</InquiryView>
<OLifE>
<SourceInfo>
<SourceInfoName>CHBM Admin Tool</SourceInfoName>
</SourceInfo>
<Activity id="Activity1" HoldingID="Holding1">
<UserCode>User123</UserCode>
<LastUpdate>2011-02-27</LastUpdate>
<ActivityCode>CHBM10001</ActivityCode>
<OLifEExtension VendorCode="0098" ExtensionCode="Activity">
<ActivityExtension>
<SubActivityCode>CHBM20002</SubActivityCode>
<LastUpdateTime>15:06:35</LastUpdateTime>
</ActivityExtension>
</OLifEExtension>
</Activity>
<Holding id="Holding1">
<HoldingTypeCode tc="6">Group Master Contract</HoldingTypeCode>
<Purpose tc="36">Business Protection and Preservation</Purpose>
<Policy>
<CarrierAdminSystem>CHBM</CarrierAdminSystem>
<PolNumber>CHB0001234</PolNumber>
<OLifEExtension VendorCode="0098" ExtensionCode="Policy">
<PolicyExtension>
<BillingDetail>
<PaymentMode tc="3">Quarterly</PaymentMode>
<BillingOrder tc="1009800002">Employee ID</BillingOrder>
</BillingDetail>
<SalaryAllotment>12354333</SalaryAllotment>
</PolicyExtension>
</OLifEExtension>
</Policy>
<Attachment id="Attach1">
<DateCreated>2011-02-27</DateCreated>
<UserCode>System</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Event 4</Description>
<AttachmentData>Event Log</AttachmentData>
<AttachmentType tc="1009800001">Transaction Log</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>2</Sequence>
<CreationTime>16:05:45</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
<Attachment id="Attach2">
<DateCreated>2011-02-27</DateCreated>
<UserCode>System</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Event 3</Description>
<AttachmentData>Event Log</AttachmentData>
<AttachmentType tc="1009800001">Transaction Log</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>1</Sequence>
<CreationTime>16:01:54</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
<Attachment id="Attach3">
<DateCreated>2011-02-27</DateCreated>
<UserCode>P62350</UserCode>
<AttachmentBasicType tc="1">Text</AttachmentBasicType>
<Description>Note 2</Description>
<AttachmentData>Enter notes on changes or edits to plan</AttachmentData>
<AttachmentType tc="14">Note</AttachmentType>
<AttachmentLocation tc="1">Inline</AttachmentLocation>
<OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
<AttachmentExtension>
<Sequence>2</Sequence>
<CreationTime>16:02:23</CreationTime>
</AttachmentExtension>
</OLifEExtension>
</Attachment>
</Holding>
</OLifE>
</TXLifeRequest>
</TXLife>
Expected output shoulb be like this
Description AttachmentType AttachmentData
Event 4 Transaction Log Event Log
Event 3 Transaction Log Event Log
Note 2 Note Enter notes on changes or edits to plan
Please help me any one on this
Edited by: LRAJESH on Apr 20, 2011 8:27 AM

SELECT
t2. Description des,
t2.AttachmentType attty,
t2.DateCreated DateCreated,
t2.UserCode UserCode,
t1.Planid Planid,
t2.createdtime,
t1.Ausercode Ausercode
FROM (
SELECT xData doc
FROM dual
) temp_table,
XMLTable ( '/TXLife/TXLifeRequest/OLifE' passing doc
COLUMNS
Planid varchar2(20) path 'Holding/Policy/PolNumber',
AttachmentType xmltype path 'Holding//Attachment' ,
Ausercode varchar2(20) path 'Activity/UserCode'
) t1,
XMLTable
'/Attachment'
passing t1.AttachmentType
columns
Description varchar2(1000) path 'Description',
AttachmentType varchar2(1000) path 'AttachmentType/@tc',
DateCreated varchar2(20) path 'DateCreated',
createdtime varchar2(20) path 'OLifEExtension/AttachmentExtension/CreationTime',
UserCode varchar2(200) path 'UserCode'
) t2

Similar Messages

  • How to read empty tag value.

    Suppose there is a tag name with values ,
    <Name>Raj</Name>
    I am able to read the tag value 'Raj' ..
    But if the tag is like
    <Name /> I am getting null pointer exception while reading the tags value..
    I have put the reading part in a try catch block .Is there any other efficient way to do it.

    try {
            BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder = factory.newDocumentBuilder();
             Document doc = builder.parse(inputSource);
             NodeList list = doc.getElementsByTagName("*");
             for (int i=0; i<list.getLength(); i++) {
               Element element = (Element)list.item(i);
               NodeList fstNm = element.getChildNodes();
    *//  Here is where i get null point exception because of tag being*
        *like <test/> ,whereas other tags have vakue like <test>value </test>*
               String check_null;
               try {
                check_null = (((Node) fstNm.item(0)).getNodeValue());
               catch(Exception ex) {
                   check_null="";
               //System.out.println(element.getNodeName() + ":"  + ((Node) fstNm.item(0)).getNodeValue());
               //if((((Node) fstNm.item(0)).getNodeValue()) != null)
               hm.put(element.getNodeName(),check_null);
               //System.out.println(element.getNodeName() + ":"+ (((Node) fstNm.item(0)).getNodeValue()));
           catch (Exception ex) {
               System.out.println("Exception in PostPaidInfo Parsing") ;;
               System.err.println(ex.toString());
               return 1;
         }I have just caught the exception ,I want to know is there any other way . The null pointer exception arises not because of string being null , But because of the internal parsing.
    Edited by: CulbOy on Apr 29, 2010 12:13 PM

  • How to read the tag values sent by PCo to MII transaction

    Hi everybody,
    I have an Agent created inside PCo and its listening to a data server. I have also created a notification object which triggers my MII Transaction (after certain condition is getting fulfilled).
    Now, I want to pass certain values from PCo to MII using the notification object. For this I have tried 2 options:
    1. I defined one input parameter in transaction of type 'XML'. But this did not work. When I used 'Tracer' to check the received values, it showed empty.
    2. Since XML variable did not work, I tried with 'String' variable. It worked but the entire input data was in 'String' format.
    Actually I used XML_Saver to save the string and given filename as '.xml'. When I opened that xml file, it was looking like this:
    <<unable to write XML here>>
    Considering the above 2nd option, how can I extract the particular 'Tag' values from XML string. Since the string is not in the format of 'Rowset/Row/Row', I cannot specifically assign/map those tag values to any other variable inside MII transaction.
    ===========

    Hi, I was trying to post the xml string. It was not possible yesterday (because, SDN editor has converted xml part into some irregular string).
    Now, I am trying to post the string by removing the special characters. Please try to understand it.
    Now, my question is how to retrieve the CDATA value 5599999999 using xpath. Please help.
    NotificationMessage
    Body
    Values
    Expression1 type xsd string
    CDATA 5599999999
      /Expression1
      /Values
      /Body
      Faults /
      /NotificationMessage

  • How to capture a parameter value in SQL QUERY of scale marker using GO URL

    Hi,
    Can any one please tell me how to capture the parameter value from go url inside Where clause of Scale Marker.
    I am trying to sift the position of scale marker based on SQL Query.
    Thanks-Bhaskar Gouda.
    Edited by: 961171 on Sep 25, 2012 12:33 AM

    Since this is a synchronous interface, where source is a soap(proxy) call and target is JDBC in the first mapping both of them are request scenarios.
    Source Structure:
    RootNode
        Request             1...unbounded
           No_of_Days   1.1 String
    Target Structure:
    RootNode
       Statement
         TableName
             Action mapped to SQL_QUERY
            Access -  SELECT DISTINCT AL.EC_NO,DP.DATE_TO_FORMAL FROM T_APPLICATION_LIST AL,(SELECT DE.EC_NO AS "EC_NO", DE.PACKAGE_NO AS "PACKAGE_NO",PC.DATE_TO_FORMAL AS "DATE_TO_FORMAL" FROM DAICYO_ECNO DE,PACKAGECTL PC WHERE DE.PACKAGE_NO = PC.PACKAGE_NO AND PC.DATE_TO_FORMAL > (TRUNC(SYSDATE) - to_number('$No_Of_DAYS$'))) DP WHERE AL.EC_NO IN  (SELECT EC_NO FROM DAICYO_ECNO WHERE PACKAGE_NO IN (SELECT PACKAGE_NO FROM PACKAGECTL WHERE DATE_TO_FORMAL > (TRUNC(SYSDATE) - to_number('$No_Of_DAYS$')))) AND (AL.FAMILY = ''  or  '' is null and AL.FAMILY is not null ) and DP.EC_NO = AL.EC_NO ORDER BY DATE_TO_FORMAL
         Key
          No_Of_Days   1..1 String
    In Return I am expecting a JDBC response from the Oracle Database as:
    Source Structure:
    RootNode
      STATEMENT_response   1...unbounded
         row                               0...undbounded
           EC_NO                        1..1   String
    Target Structure:
    RootNode
      RESPONSE
        row
         EC_NO                     1..1     String

  • Deafaul Value using SQL query

    Hi
    I'm trying to make a default value using Computations;
    when I create computation,
    I select
    Computation item: PXX_TEST
    computation type: SQL query
    computation Point: I tried all
    Computation: select X FROM Y WHERE X= '1'
    This is the way to get Default Value ??
    I need to display the value when the page is open
    Thanks
    MM

    MM,
    You can use the default value attribute of the item to set a value if the item's source produces a null. A computation (before/after header) can work too, but it's possible that the item source and Source Used attribute (Always/Only) are interfering with your computation so you might want to try setting Source Used to 'Only...' if you have a computation setting the item.
    Scott

  • How to sum a column value using CAML Query?

    Hi All,
    I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
    Thanks in advance!

    Hi Sam,
    it looks like you can use your current view based agregation, otherwise it is not possible(
    http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
    use the below link and create a view element as described and see if that works for you
    Aggregations Element
    http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
    Another reference
    Query Element
    http://msdn.microsoft.com/en-us/library/ms471093.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How to read varbinary data type using sql server

    Hello,
         I'm converted a text file data into varbinary format, and stored in DB table. Now I need to read
    Varbinary column and store in Temp table
    in sql server.
     can some one help on this.
    Regards,
    Praven
    Regards, Praveen

    I understand this question is related to your previous thread and I believe what Erland suggested is the best way to implement this.
    https://social.msdn.microsoft.com/Forums/en-US/a96a8952-0378-4238-9d9d-85b053182174/send-direct-text-file-as-a-input-parameter-to-sp?forum=transactsql
    I believe when the user uploads the data its getting uploaded onto the Application Server, You could then open the file and import the files into SQL server(all using application code) and do the manipulations. I believe this is the better way of handling
    this.
    Also what is the expected file size and what is the kind of data you are expecting?
    Satheesh
    My Blog | How to ask questions in technical forum

  • Viewing blob datatype value using sql query

    How can i view the text stored in a column of data type blob.
    Thanks.

    using pl/sql developer sql window i want to see the result.Is there any way of converting blob type to varchar type

  • How to numberformat when using sql:query alogn with c:forEach JSTL tags

    Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
    Here is my jsp code
    <sql:query..../>
    <c:forEach var="row" items="${queryResults.rows}">
    <tr>
    <td><c:out value="${row.COL1}" /></td>
    <td><c:out value="${row.COL2}" /></td>
    </tr>
    </c:forEach>
    Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
    how can i format them to 1,000 , 10,1000 , 100,000 etc

    It is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
    I presume you discovered the JSTL <fmt:formatNumber> tag?

  • How to hide repeated details using SQL Query?

    How to hide repeated details using SQL Query?
    For Ex:
    ------------------------+
    DEPTNO| ENAME | JOB |
    ------|-------| --------|
    10 | JAMES | MANAGER |
    10 | BLAKE | CLERK |
    10 | FORD | SALESMAN|
    20 | SCOTT | MANAGER |
    20 | ADAMS | CLERK |
    20 | KING | SALESMAN|
    ------------------------+
    How we can display the above details in the following way?
    ------------------------+
    DEPTNO| ENAME | JOB |
    ------|-------| --------|
    10 | JAMES | MANAGER |
    | BLAKE | CLERK |
    | FORD | SALESMAN|
    20 | SCOTT | MANAGER |
    | ADAMS | CLERK |
    | KING | SALESMAN|
    ------------------------+
    Thanks Advance

    Hi,
    you can use BREAK ON DEPTNO in SQL*Plus or use LAG.
    SQL> ed
    Wrote file afiedt.buf
      1  select nullif(department_id
      2                , lag(department_id) over (partition by department_id order by last_name)
      3         ) dept_id
      4  , last_name, job_id
      5*  from employees where department_id in (30,50) and rownum <=10
    SQL> /
       DEPT_ID LAST_NAME                 JOB_ID
            30 Baida                     PU_CLERK
               Colmenares                PU_CLERK
               Himuro                    PU_CLERK
               Khoo                      PU_CLERK
               Raphaely                  PU_MAN
               Tobias                    PU_CLERK
            50 Fripp                     ST_MAN
               Kaufling                  ST_MAN
               Vollman                   ST_MAN
               Weiss                     ST_MAN
    10 rows selected.

  • How to show the VALUE as the Column Header using SQL query?

    Hi
    I have a requirement to show the picked value as the column header using SQL query.
    Example:
    ======
    SELECT EMPNO FROM EMP
    WHERE EMPNO=7934;
    Result Should be:
    7934
    7934

    I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
    SQL> set verify on
    SQL> def e =  7934
    old: SELECT empno "&&e"  FROM emp  WHERE empno = &&e
    new: SELECT empno "7934"  FROM emp  WHERE empno = 7934
    SQL> SELECT empno "7934"  FROM emp  WHERE empno = 7934
          7934
          7934
    1 row selected.

  • Default form value using sql with bind variable

    I wish to create a form based upon a table with a foreign key. I wish to add a field to the form that is an uneditable text field with a default value using sql of 'select name from other_table where other_table_id = ?' where ? is a bind variable defined by a hidden field which is the value of the foreign key identified at runtime. How can this be done?
    null

    I don't think that will work. I have multiple people accessing the Portal at the same time with the same login (or lack of as public will be the most common user). I could set it easily enough as the value is passed to the form by a link object, so I could add it to the before page plsql block and set the value. But I am uncertain how it will behave in a multi-user mutlitasking environment.
    Maybe I should describe what I am looking to accomplish. I want to create a display above a form that will list static details from other tables (i.e. when editing a user's phone number, which is in one table, you want the user to see the person's name, which is in another table, and the form is based upon the phone table) ...
    Just as I am thinking about it, I thought of an idea. I could put some specific code in the before displaying page plsql section to query the database and use htp to output the information for data not in the table the form is based upon. I will try this and see how it works. It would have been nice to have just created a field that is not editable and had a default value, but this should work as well.
    Let me know if you see any problem with this or if you have any better suggestions.
    Thanks for the fast response.

  • How can I validate a date using sql

    How can I validate a date using sql or pl/sql
    select to_date('01/01/2009','mm/dd/yyyy') from dual this is a good date
    but how can I check for a bad date
    select to_date('0a/01/2009','mm/dd/yyyy') from dual
    Howard

    William Robertson wrote:
    It'll be complicated in pure SQL, as you'll have to parse out day, month and year and then validate the day against the month and year bearing in mind the rules for leap years. It would be simpler to write a PL/SQL function and call that.Nah, not that complicated, you just need to generate a calender to validate against.
    SQL> ed
    Wrote file afiedt.buf
      1  with yrs as (select rownum-1 as yr from dual connect by rownum <= 100)
      2      ,mnth as (select rownum as mn, case when rownum in (4,6,9,11) then 30
      3                            when rownum = 2 then 28
      4                       else 31
      5                       end as dy
      6                from dual
      7                connect by rownum <= 12)
      8      ,cent as (select (rownum-1) as cen from dual connect by rownum <= 21)
      9      ,cal as (select cen, yr, mn,
    10                      case when ((yr = 0 and mod(cen,400) = 0)
    11                             or (mod(yr,4) = 0 and yr > 0))
    12                            and mn = 2 then dy+1
    13                      else dy
    14                      end as dy
    15               from cent, yrs, mnth)
    16  --
    17      ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    18  --
    19  select case when cal.cen is null then 'Invalid Date'
    20              when not regexp_like(dt,'^[0-9]{1,2}[\/.-_][0-9]{1,2}[\/.-_][0-9]{4}$') then 'Invalid Date'
    21         else dt
    22         end as dt
    23  from dt left outer join
    24               cal on (to_number(regexp_substr(dt,'[0-9]+')) between 1 and cal.dy
    25                   and to_number(regexp_substr(dt,'[0-9]+',1,2)) = cal.mn
    26                   and floor(to_number(regexp_substr(dt,'[0-9]+',1,3))/100) = cal.cen
    27*                  and to_number(substr(regexp_substr(dt,'[0-9]+',1,3),-2)) = cal.yr)
    SQL> /
    Enter value for date_dd_mm_yyyy: a1/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select 'a1/02/2008' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 01/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '01/02/2008' as dt from dual)
    DT
    01/02/2008
    SQL> /
    Enter value for date_dd_mm_yyyy: 29/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '29/02/2008' as dt from dual)
    DT
    29/02/2008
    SQL> /
    Enter value for date_dd_mm_yyyy: 30/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '30/02/2008' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 29/02/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '29/02/2009' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 28/02/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '28/02/2009' as dt from dual)
    DT
    28/02/2009
    SQL> /
    Enter value for date_dd_mm_yyyy: 0a/01/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '0a/01/2009' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 00/01/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '00/01/2009' as dt from dual)
    DT
    Invalid Date
    SQL>

  • Retreving Hexadecimal Values from a table using SQL query.

    Hi,
    I'm looking for a query to retreive Hexadecimal values contained in a column using SQL query.
    The column contains the values of all types, alphanumeric, numeric and hexadecimal.
    I need to retreive only hexadecimal values.
    any help to me in this regard will be appreciated.
    Thanks

    Presumably, you can be sure that any valid hex value is indeed MEANT to BE a hex value. For example the value 'ACE' is meant to be a hexadecimal value and not the word.

  • How to get tax break up of TDS using SQL query ?

    Hi all,
    We are developing a TDS report using SQL query
    Report will contain VendorCode,Date(ap inv date),Vendor name,
    Bill value,TDS Amount,
    Bill Value – 100.000,
    TDS (2%) - 2.000,
    TDS Surcharge(10% on TDS) - 0.2,
    TDS Cess(2%(TDS+TDS Surcharge)) - 0.044,
    TDS HeCess(1%(TDS+TDS Surcharge)) - 0.022.
    We have developed this report which displays upto
    VendorCode,Date(ap inv date),Vendor name,
    Bill value,TDS Amount.
    How to show tax break up of TDS in SQL query ?
    Thanks,
    With regards,
    Jeyakanthan.

    Hi gauraw,
    Thank for your reply.
    I modified the query , pasted the query
    as below in query generator,
    Select T0.DocNum,T0.DocDate,T0.CardCode as 'Ledger',T1.TaxbleAmnt As 'Bill value',T1.WTAmnt as 'TDSAmt',(TDSAmt * 0.1) as 'TDS_Surch',
    (((TDSAmt0.1) + TDSAmt)0.02)  as 'TDSCess',
    (((TDSAmt0.1) + TDSAmt)0.01)  as 'TDSHCess'
    FROM OPCH T0  INNER JOIN PCH5 T1 ON T0.DocEntry = T1.AbsEntry
    WHERE (T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]')
    on clicking execute its showing error message invalid column
    name 'TDSAmt'.
    With regards,
    Jeyakanthan

Maybe you are looking for