Display the name of the tag as the column name and the value in the tag as a row of data from the input string.

Hi Forum members,

I am looking for a query display the name of the tag as the column name and the value in the tag as a row of data.

I have to print the values within the tag to a file by choosing the value of the flags. the sequence of the tags will vary each time, as the tag name will change dynamically.

So here is the example of input data and the expected output. The string in the text column must be separated as the column names and values.

Input data
Select 1 as seqno,' < > 0210A 50 4f < / 4f > < 5f20 > TEST CARD 16 < / 5f20 > < 5f2a > < / 5f2a > < 82 > 1 c 00 < / 82 > ' double text


Output:

Seqno 4f 5f20 5f2a 82
0210A 50 16 1 00 TEST CARD 1

Please help me by providing your entries on this.

We use the version of Oracle 11.2.

Note: This is not the XML string

Thank you

Shree

with

data in the form of

(select 1 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2a><82>00 1' text of all the double union)

Select 2 as seqno,'XYZ<4F>0210 A 50<5f20>TEST CARD 16<5f2a><82>00 1' text of all the double union

Select 3 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2A><82>1 00XYZ ' text of all the double union

Select option 4 as seqno,'<4F>0210 A 50<5F20>TEST CARD 16<5f2A><82>1 00XYZ' double text

)

Select d.seqno, x.*

d the data,

XMLTable ('/ root')

by the way xmltransform (xmltype ('': replace (replace (text,'<><>'),)))

XmlType (q'~http://www.w3.org/1999/XSL/Transform "version ="1.0"> ")

                                                 

                                                   

                                                     

                                                   

                                                 

                                                 

                                                   

                                                     

                                                   

                                                 

~'

)

)

path of columns '4f' varchar2 (10) "tag4f."

path of "5f20' varchar2 (30)"tag5f20. "

path of '5f2a' varchar2 (10) "tag5f2a."

path of varchar2 (10) "82" "tag82.

) x


SEQNO 4f 5f20 5f2a 82
1 0210A 50 16 TEST CARD - 1 00
2 0210A 50 16 TEST CARD - 1 00
3 0210A 50 16 TEST CARD - 1 00
4 0210A 50 16 TEST CARD - 1 00

with

data in the form of

(select 1 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2a><82>00 1' text of all the double union)

Select 2 as seqno,'XYZ<4F>0210 A 50<5f20>TEST CARD 16<5f2a><82>00 1' text of all the double union

Select 3 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2A><82>1 00XYZ ' text of all the double union

Select option 4 as seqno,'<4F>0210 A 50<5F20>TEST CARD 16<5f2A><82>1 00XYZ' double text

),

Chopper (seqno, Key, value, String) as

(select seqno,

regexp_substr (text,'<(.+?)>', 1, 1, null, 1),

regexp_substr (Text,'>(.*?))

regexp_substr (text,'<.+?>. *? ) (.*) $', 1, 1, null, 1). » <>'

from the data

Union of all the

Select seqno,

regexp_substr (String,'<(.+?)>', 1, 1, null, 1),

regexp_substr (String,'>(.*?))

regexp_substr (String,'<.+?>. *? ) (.*) $', 1, 1, null, 1)

Chopper

where regexp_substr (string,'<(.*?)>', 1, 1, null, 1) is not null

)

Select '4f', seqno, '5f2a', '82', '5f20.

of (seqno, lower (key) select key, value)

Chopper

)

Pivot (max (value) for key in ('4f' as '4f', '5f20' as '5f20', '5f2a' as '5f2a', "82" as "82"))

Concerning

Etbin

Tags: Database

Similar Questions

  • SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    Hello

    You can use REGEXP_SUBSTR Oracle/PLSQL: REGEXP_SUBSTR function

    Select the function double REGEXP_SUBSTR('PUBLIC RELATION REPRESENTATIVE ','[^]+',1,2);

    Do you have any value of the column as no 2nd string?

  • When I try to open e-mail files a small box opens with the setting or the input string was not good format

    original title: windows live suit

    When I try to open e-mail files a small box opens with the setting or the input string was not good format

    Windows Live Solution Center
    http://windowslivehelp.com/

  • date format picture ends before converting all of the input string

    In the following query, I get the error: ORA-01830: date format picture ends before converting all of the input string

    Select sum (e.gl_fig) in the rm_gl e where e.as_on_dt < = trunc (to_date('31-Nov-2011'), 'Q')-1

    Hello

    Moreover, how many days are there in November? It IS 30 or 31?

    Please change from 31-Nov-2011 to November 30, 2011, then it works.

    select sum(e.gl_fig) from rm_gl e where e.as_on_dt <= trunc(to_date('30-Nov-2011', 'DD-MON-YYYY'),'Q')- 1
    
  • How to display the Html string into the field

    Hi guys. IM using Eclipse with jre 4.5.

    I need display text html (example"

    a text
    other tags... ")

    This text, I have to a String. I've read a lot of forums about this but never found.

    Can someone help me?

    Im trying using the browser, but it is not good... It hide my application and display the content (or a link such as "Google.com").

    I have to show this text in the field, with other areas.

    Help me please.

    Best regards, Peter.

    Thanks for the answer. But browserfield not supportede on 4.5. Is support for 5.0 +.

    While I do? (

  • How to display the previous strings of questions / answers on the support of FF?

    I read this answer, but it's not really answering the question.

    "If you're connected, you see a section of my Contributions in the filter bar at the top that goes to:
    https://support.mozilla.org/questions?filter=my-contributions".

    I do not see the bar 'filter' or 'my answers' after I connect. I just saw 'Ask a question' "my log in name" and some other stuff right cela and below.

    So after I log in, how to watch the channels of my previous questions and answers to them, including those?

  • Display the exact string of the file as a hexadecimal display data

    I'll send control messages via a serial port, which are built in a series of bytes.  Currently, I have all these messages in an excel file which is 8 columns of 224 lines.  The messages are the exact hex display, I need for my program works.  To check my installation, I tested a few messages by manually typing in messages using a string constant and the value display hexadecimal and everything works well.  How can I get the strings in my file to be recognized as they use hexadecimal display.

    Thanks for your suggestions.

    So if I understand, you read an ASCII representation to hexadecimal format of the command strings.

    You must convert ASCII bytes, then the chain, in this way:

    The entrance on the left string must be read from your file, of course.

    Notice that the representation of the integer constant must be U8.

    You don't need the Trim function spaces if you are sure that the string does not contain additional characters beyond the last hexagonal number.

  • Cannot display the page XML cannot display the input XML using the stylesheet XSL, how to fix?

    How can I fix this error code:

    The XML page cannot be displayed

    Cannot view XML input using XSL style sheet. Fix the error and then click the Refresh button, or try again later.

    System error:-2146697211. Error during processing of resources "file:///C:/Documents and Settings/a/desktop/SMART.xslt.

    The operating system is Windows XP Home Edition.  I use browsers IE 8, Safari and Mozilla Firefox.
    I'd never see this error until I installed HDDScan (http://hddscan.com/), a diagnostic utility, to check my hard drive.   The test is a S.M.A.R.T. analysis and produces this error message when you use this software.
    A web site indicates that installing Microsoft. NET Framework can solve this problem.  I already have this class in Add Remove Programs: Microsoft .NET Framework 1.1, Microsoft .NET Framework 2.0 Service Pack 2, Microsoft. NET Framework 3.0 Service Pack 2, Microsoft .NET Framework 3.5 SP1, Microsoft. NET Framework 4 Client Profile.
    Is the problem, a missing software program or a corrupted file?  What is Microsoft. NET Framework?  I use selective with most of the disabled items in the services (except hide all Microsoft) and start more disabled under Startup.  Is there something that needs to be checked to activate a service or start to correct this error message?
    How to solve system 2146697211 errors: cannot display page XML cannot display the XML input using the XSL stylesheet?

    Hello

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. Please post your question in the MSDN forum. You can follow the link for your question.

    http://social.msdn.Microsoft.com/forums/en-us/iewebdevelopment/threads

    Hope the helps of information.

  • Display the text string on the Capture window

    Hello

    To capture is used difference two camcorders. What I have is a display of text pasted on the capture window. I do daily catches and what is new. Don't know how the text string is found on the capture window. Capture saves the film along with the display of text. I need to remove this information in order to have a full, clean with only the material captured.

    Attached a picture showing the information that needs to be removed.

    I use Adobe Creative Suite CS6 with Premiere Pro CS6 on a HP with Windows 7 pro 64-bit z800.

    Thank you!

    capture-00022.jpg

    vlcsnap-00022.jpg

    Well.

    I played on several bands and this one has its own text. It is burned in. This is most unexpected.

    Other assets play very well, as expected.

    Thanks for the idea!

    Now, I know.

  • How to display the parameter string registered by DBMS_XMLINDEX?

    This is probably a stupid question, but I can't seem to find any function to display the setting of a parameter string that was recorded by DBMX_XMLINDEX. REGISTERPARAMETER.

    For example,.

    If I have:
    BEGIN
    DBMX_XMLINDEX.REGISTERPARAMETER('indexParam', 'xxxxxxxx');
    END;
    /
    How to display the value of 'indexParam' after creation?
    SQL> set long 1000
    SQL>
    SQL> select paramstr
      2  from xdb.xdb$xidx_param_t
      3  where param_name = 'MYINDEXPARAM'
      4  ;
    
    PARAMSTR
    --------------------------------------------------------------------------------
    PATH TABLE po_ptab
        PATH ID INDEX po_pidx
        ORDER KEY INDEX po_oidx
        VALUE INDEX po_vidx
        PATHS(NAMESPACE MAPPING(xmlns:p="http://www.example.com/IPO"))
        GROUP MASTERGROUP XMLTABLE PO_TAB
        ('/p:PurchaseOrder'
            COLUMNS
               REFERENCE VARCHAR2(30) PATH 'p:Reference',
               REQUESTOR VARCHAR2(30) PATH 'p:Requestor' )
        GROUP ITEMGROUP XMLTABLE ITEMGROUP_TAB
        ('/p:PurchaseOrder/p:LineItems/p:LineItem'
            COLUMNS
               LINENUMBER NUMBER(38) PATH '@p:ItemNumber',
               QUANTITY NUMBER(38) PATH '@p:Quantity',
               DESCRIPTION VARCHAR2(256) PATH 'p:Description')
     
    

    After you add it to an index, you can also view the content in USER_XML_INDEXES. PARAMETERS (XML format).

  • How to connect the value of the input string to numeric values

    Hello

    I'm trying to figure out how to connect the value of unique user input string to numeric values. Basically I want the user to enter the name of a gas that I have a list for (I think I put the list of gases in a table >). Then I want to match numeric values 2 'a' and 'b', according to which gas, name of the user has set. These 'a' and 'b' values will be automatically matched with the name of the gas in a list that I put. For example, hydrogen gas has the value 3 for "a" and 4 for "b. when the user puts the ' hydrogen' name in a string constant, automatically 'a' and 'b' must be issued.» I have connect a and b to a formula

    Thanks for any help

    Hello

    It is perhaps not exactly what you are looking for, but perhaps you could use the enumerated data type and the array of clusters of points (a, b).

    Look at the VI I enclose.

  • control of the input string to the character to character upcase?

    Is there a property or method in chain control who can change the input character upcase character?

    Try the attached VI.

    Edit: Make sure that the update while typing of property is selected.

  • NumberFormatException: for the input string: "1."

    I'm trying to load data from a file to TimesTen using JDBC but NumberFormatException error occurs.

    This is how my table looks like:

    String tab_wysz = "CREATE TABLE WYSZ (CompanyID TT_INTEGER NOT NULL, TT_INTEGER NOT NULL, SearchDate ClientID DATE NOT NULL, Primary Key (CompanyID, ClientID));

    How to load data (the same as in the examples of programs of TT):

    String INPUTFILEWk = "/ book/wysz.txt";
    String INSERTWysz = "insert into Wysz values (?,?,?)";

    PreparedStatement pInsOrd = ttcon.prepareStatement (INSERTWysz);

    BufferedReader in = new BufferedReader (new FileReader (plik));
    String line;

    try {}
    in = new BufferedReader (new FileReader (INPUTFILEWk));
    While ((line = in.readLine ())! = null) {}
    Skip comments
    If (line.charAt (0) == ' # ') {}
    continue;
    }
    outStream.println ("data:" + line);
    String [] fields = line.split(";");

    pInsOrd.setInt (0, Integer.parseInt(fields[0])); CompanyID
    pInsOrd.setInt (1, Integer.parseInt(fields[1])); ClientID
    pInsOrd.setDate (2, Date.valueOf(fields[2])); SearchDate

    pInsOrd.executeUpdate ();

    reportSQLWarnings (pInsOrd.getWarnings ());
    // }
    ttcon.Commit ();
    }
    in. Close();
    pInsOrd.close ();
    } catch (IOException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }
    catch (SQLException e) {}
    e.printStackTrace ();
    } catch (NumberFormatException e1) {}
    Generative TODO catch block
    E1. PrintStackTrace();
    }

    }

    Wysz.txt file looks like this:

    1; 88894; 2011-05-17
    28; 30799; 2011-07-31
    28; 48583; 13-02-2012
    28; 116684; 2008-09-23
    28; 69301; 2009-08-02
    28; 64609; 2007-09-12
    83; 6514; 2007-04-29
    83; 98420; 2008-06-17
    83; 40325; 2008-09-14

    The file is located in the UTF-8 encoding, as well as Eclipse that I use to connect database and load data.

    The error looks like this:

    Connected to the database

    Data processing: 1; 88894; 2011-05-17
    java.lang.NumberFormatException: for input string: "1."
    at java.lang.NumberFormatException.forInputString (unknown Source)
    at java.lang.Integer.parseInt (unknown Source)
    at java.lang.Integer.parseInt (unknown Source)
    at bazy.operacjaInsertILoad(bazy.java:157)
    at bazy_zapytania.testInsertInto(bazy_zapytania.java:114)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (unknown Source)
    at java.lang.reflect.Method.invoke (unknown Source)
    to org.junit.runners.model.FrameworkMethod$ 1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    to org.junit.runners.ParentRunner$ 3.run(ParentRunner.java:238)
    to org.junit.runners.ParentRunner$ 1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    to org.junit.runners.ParentRunner.access$ 000 (ParentRunner.java:53)
    to org.junit.runners.ParentRunner$ 2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Closing the connection



    Any sugestion what is the problem?

    I just cut-n-Paste the error message in a text box:

    « 1 »

    and in a simple text box, there is a nonprintable character in front of the 1:
    « ? 1. "

  • ORA-01830Date end of photo format before converting all of the input string

    Hi guys,.

    We have two env db a dev and AQ. Both the envs are running on the same version of database and in both the setting nls_date_format envs are the same and they are 'DD-MON-YY' format only. But when I execute the same statement immediately following my dev env is fetching data appropriate without any problem but my env qa is any mistake on the mentioned error.

    I enclose the suite that I use

    SELECT TPTRJO1. JOURNAL_ENTRY_ID
    OF TRANSACTION_JOURNAL TPTRJO1,.
    JOURNAL_CASH_DRAWER TPJCD1
    WHERE (TPJCD1. CASH_DRAWER_ID = 5010639.0)
    AND (TPJCD1. DRAWER_SEQ = 5.0)
    AND (TPJCD1. CASH_DRAWER_DATE = TO_DATE ('2011-09-13 00:00:00 ', 'yyyy-MM-dd'))

    AND (TPTRJO1. JOURNAL_ENTRY_ID = TPJCD1. JOURNAL_ENTRY_ID)
    AND (TPTRJO1. TRANSACTION_ID = 595,0)

    However, according to the logic, it should error in both the envs due date format and the actual data used in the entry.

    What would be the possible difference between the envs db towing?

    Please, share your ideas.
    Any suggestions are appreciated.

    Thank you and waiting for an early response

    I assume that you have given in your dev environment.
    If there is a record with TPJCD1. CASH_DRAWER_ID = 5010639.0,
    the expression ' TO_DATE ('2011-09-13 00:00:00 ', 'yyyy-MM-dd').
    will never be evaluated.

    Here is my test scenario where '1 = 0' prevents the date under evaluation:

    SQL>SELECT *
      2    FROM all_objects
      3   WHERE created > TO_DATE('2011-09-13 00:00:00', 'yyyy-MM-dd');
     WHERE created > TO_DATE('2011-09-13 00:00:00', 'yyyy-MM-dd')
                             *
    ERROR at line 3:
    ORA-01830: date format picture ends before converting entire input string
    
    SQL>
    SQL>SELECT *
      2    FROM all_objects
      3   WHERE 1 = 0 AND created > TO_DATE('2011-09-13 00:00:00', 'yyyy-MM-dd');
    
    no rows selected
    

    URS

  • My Windows Live Messenger display messenge name and staff are automatic update!

    My Windows Live Messenger display name and staff messenge are automatic updated to a foreign link and url. When I login, I always see someone connect from somewhere else. And even I'm out somewhere else, change my password, he'll be back in 5 minutes. And my nickname and messange screw. It seems more that just the login/password has been stolen. It seems to happen after I click on a link of the email from my friend. That's happened?

    Hi Jerry,

    In dealing with the problem with Windows Live Messenger, I recommend you post your question in Windows Live Solution Center for assistance:

    Portal Messenger

    Hope the helps of information.

Maybe you are looking for