extract table data to different locations

Hello

I collected data in the format:

Temp: 25 Freq: 136 100 99.993 2998,581 0
Temp: 25 Freq: 136 125,89 125.991 2997,196-0.004
Temp: 25 Freq: 136 158,48 158.007 - 2995, 1 0.01
Temp: 25 Freq: 136 199,52 200.002 2991, 905 - 0.019
Temp: 25 Freq: 155 100 100.005 3000,866 0.003
Temp: 25 Freq: 155 125,89 126.003 3000,086 0.000
Temp: 25 Freq: 155 158,48 157.985 2996, 133 - 0.011
Temp: 25 Freq: 155 199,52 200.018 2992,644-0,021
Temp: 25 Freq: 174 100 100 3001,405 0.000
Temp: 25 Freq: 174 125,89 126.016 2997, 996 - 0.010
Temp: 25 Freq: 174 158,48 158.013 2996,371-0.015
Temp: 25 Freq: 174 199,52 199.983 2992, 315 - 0,026
Temp :-30 Freq: 136 100 99.993 2998,581 0
Temp :-30 Freq: 136 125,89 125.991 2997,196-0.004
Temp :-30 Freq: 136 158,48 158.007 - 2995, 1 0.01
Temp :-30 Freq: 136 199,52 200.002 2991, 905 - 0.019
Temp :-30 Freq: 155 100 100.005 3000,866 0.003
Temp :-30 Freq: 155 125,89 126.003 3000,086 0.000
Temp :-30 Freq: 155 158,48 157.985 2996, 133 - 0.011
Temp :-30 Freq: 155 199,52 200.018 2992,644-0,021
Temp :-30 Freq: 174 100 100 3001,405 0.000
Temp :-30 Freq: 174 125,89 126.016 2997, 996 - 0.010
Temp :-30 Freq: 174 158,48 158.013 2996,371-0.015
Temp :-30 Freq: 174 199,52 199.983 2992, 315 - 0,026
Temp: + 70 Freq: 136 100 99.993 2998,581 0
Temp: + 70 Freq: 136 125,89 125.991 2997,196-0.004
Temp: + 70 Freq: 136 158,48 158.007 - 2995, 1 0.01
Temp: + 70 Freq: 136 199,52 200.002 2991, 905 - 0.019
Temp: + 70 Freq: 155 100 100.005 3000,866 0.003
Temp: + 70 Freq: 155 125,89 126.003 3000,086 0.000
Temp: + 70 Freq: 155 158,48 157.985 2996, 133 - 0.011
Temp: + 70 Freq: 155 199,52 200.018 2992,644-0,021
Temp: + 70 Freq: 174 100 100 3001,405 0.000
Temp: + 70 Freq: 174 125,89 126.016 2997, 996 - 0.010
Temp: + 70 Freq: 174 158,48 158.013 2996,371-0.015
Temp: + 70 Freq: 174 199,52 199.983 2992, 315 - 0,026

I am able to extract specific data and establish a curve for the different Freqs (see "extract file_for email.VI pivot table).  I would like to help in order now to a parcel with a fixed frequency but different time (therefore field will be 3 Graphics: 25-30, + 70 for the same word of freq 136).

Thanks for your help and your time,

hiNi.

This code gross works for any number of temperatures and allow for different sizes of each table (say that you measured 3 points to 1, temp and 6 points to another).  I strongly doubt this operation is necessary, but this is how the code works.

Just drop the and connect the tables correctly loaded from your text file to place the controls in table I used.  (or you can wire up and use it as a subvi).

Tags: NI Software

Similar Questions

  • external table data with several locations pump

    Hello
    I'm on:
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - 64biit
    SunOS 5.10

    I am trying to create a table of data pump external at the same time, with the location of the files previously created using pump.
    This is the same as the example given in step 10-13 here:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14215/et_dp_driver.htm#i1007502

    But when I do this and select all the lines in the resulting table, I get the error:

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can anyone help?
    Here is a script of what I do...


    create the directory message_archive_dir as ' / your/path/directory "; -change default directory
    -chmod 777 your way

    create the sys_tables table
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_tables.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'TABLE '.
    and rownum < 11;

    create the table sys_indexes
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_indexes.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'INDEX '.
    and rownum < 11;

    Select * from sys_tables
    Union
    Select * from sys_indexes;

    -all 20 rows returned!
    -now I combine the two dmp files in a single table...

    create the table sys_objects
    (
    object_id NUMBER (14).
    object_type VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')
    );

    Select *.
    of sys_objects
    where rownum = 1;

    -ok returnes one line (one of the dmp files work)
    --Choose so all lines...

    Select *.
    of sys_objects;

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can you see what I'm doing wrong?

    Any help is greatly appreciated!
    Thank you.

    user9969845 wrote:
    ... Etc...

    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')

    Combination dump files

    Files dump populated by different external tables can all be specified in the LOCATION of another external table clause. For example, data from different databases can be unloaded in separate files, and these files can then be included in an external table defined in a data warehouse. This provides an easy way to aggregate data from multiple sources. The only restriction is that the metadata for all external tables is exactly the same. This means that the game characters, time zone, schema name, table name, and column names must match. In addition, the columns must be defined in the same order, and their data types must be identical. This means that after you create the first external table you must remove it so that you can use the same table name for the second outer table. This ensures that the metadata in two dump files is the same and they can be used together to create the external table even.
    8 2

  • EXTRACTION OF INFORMATION OFF COMPUTER OFFLINE EVEN PLACED IN A DIFFERENT LOCATION

    Hello

    MY NAME IS CHANDA. IAM WORKING AS A PROFESSOR OF COMPUTER SCIENCE.  I FORGOT TO KEEP SOME IMPORTANT DATA WITH ME. AND NOW I NEED IT. BUT NO POSSIBILITY TO PERCEIVE THE SAME.

    I WANT TO KNOW HOW CAN I EXTRACT DATA FROM THE COMPUTER IN OFFLINE MODE, PLACED AT A DIFFERENT LOCATION.

    IS THERE ANY SCOPE FETCH

    I LOOK FORWARD TO YOUR RESPONSE

    CONCERNING

    CHASSOT KONE

    Unless you have a software on the another dedicated computer is not.

    BTW ALL CAPS IS CONSIDERED YELLING

  • Extracting the data from relational tables in 11.1.2.1

    I want to extract the following data sets from relational tables
    1 attribute and his partner basic member
    2 Smartlist value of an account

    Have a code to extract such data? It will be useful in pointing to the correct table names.

    Thank you

    You will find the table schemas in the [documentation for EPMA | http://www.oracle.com/technetwork/middleware/bi-foundation/epm-data-models-11121-354684.zip]. If this does not work, there are other options to export hierarchies in text files. You can use the lifecycle management or the [EPMA line Generator | http://docs.oracle.com/cd/E17236_01/epm.1112/epma_file_gen_user/launch.html].

    Kyle Goodfriend
    http://www.in2hyperion.com

    Please make sure that you assign your post as answered when an appropriate response is provided (or useful when it takes place) as well as other benefits.

  • How to store the ASO dat file in different location

    Hi all

    I have a requirement where I need to store the .dat (ASO) file in one location other than the folder where are stored the artifcats of enforcement. In OSB, we can right-click the database properties, edit, and in the storage tab, we can choose where the data files and indexes must be stored. We have a similar option of ASO too? because the space we have for the application files are limited and we have a separate drive of SAN for the storage of the data and index files, and this is where the BSO .pag files are stored. Since our ASO cube is more I want to move the data to a location where the data of the BSO, I mean for the player designated for data. Any suggestion will be highly appreciated.

    Thank you.

    Yes, ASO has the notion of 'spaces '. There are four (by default, temp, log and metadata), but you probably just want to pass the tablespaces 'default' and 'temp' in your location of SAN. Temp will look really small (i.e. empty) until you run a restructuring or consolidation, then it will explode to the size of the default storage space so it is important not to miss.

    See the section "Managing storage for ASO bases" here http://docs.oracle.com/cd/E17236_01/epm.1112/esb_dbag/asysadmn.html, or the MaxL "alter tablespace" command http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/maxl_alttabl.html here.

    EDIT: Actually, looking at the documentation, I see that you can't move the metadata or journal storage. But you're probably only going to worry about 'default' and 'temp' anyway.

  • Re-import table data dictionary

    Hello

    I recently created a relational model with more than 2000 paintings by importing the data from the data dictionary. Unfortunately, I left out a few tables when I originally created the template. How can I add the tables after the fact? I tried to go through the process of reimportation again, but it doesn't seem like it adds tables. Thank you!

    Hello

    Are there any error messages in the log file?  (This is normally datamodeler.log file in the datamodeler\datamodeler\log folder, unless you set a different location on the environment/log preferences page.)

    Note that if you want to update the properties of Java, the updated file is different for the version 4.0.0.833 Data Modeler.  AddVMOption reports should be updated in the product.conf file and not in the datamodeler64.conf file. Assuming you are on Windows 7, you should be able to find the product.conf file in the file C:\Users\\AppData\Roaming\Oracle SQL Developer Data Modeler\4.0.0.833.

    David

  • The same drive letter may point to different locations for different processes?

    The same drive letter may point to different locations for different processes?

    Our users have the E: drive mapped to one place. But I need a scheduled task in order to use the E: drive to point to a different location at the same time, without affecting the mapping of moose for logged in users.

    There is no work around this need of ours. This is because users are working 24 X 7 update of our data files on the E: drive, and a log file is made. We plan prevent users for a minute every night while move us / save the log file and then allow users of the resume and allow a new log file to create. Then take the saved log file and apply it to a real set of monthly backup of data files, so the backup files will be ready for a recovery after disaster. The program that applies the transactions recorded in the data files is able to apply operations to files that are considered as being in the same exact location.

    I know that's not possible without resorting to the application logs a set of files on a completely different machine. But I ask.

    Thank you

    Dan

    Hello

    The question you posted would be better supported in the TechNet Forums. I suggest you to ask your question in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads

    I hope that helps!

  • Extraction of data from MS SQL .bak file

    Hi all

    I received a MS SQL .bak file and need to extract the data into it, what should I do to achieve this?

    In addition, what is a bak file? It's a backup for a database file? I remember that I read somewhere that backup database has several different method (for example, the differential backup, the full backup), which will affect the restoration?

    Thank you

    Lee

    Hi Lee

    Your best resource for information is the Forum dedicated to suppoeting SQL.

    Category of the SQL Server:

    http://social.msdn.Microsoft.com/forums/en-us/category/SQLServer

    Concerning

  • Cannot specify a different location for multiple-image backups.

    I want to record several image files on an external drive (which can contain a large amount of data)... It was suggested to specify a different location for the second image... but when I run the process of backup image... first a screen shows my external drive where the image will be stored... but then the screens seem to just continue to do a backup. I don't see any place where I can change the location of the image... It keeps on the re-write on the last saved... image I think that maybe you can change the location of the regular backups... but not for the image file... its on another screen or buried somewhere... the help screen with "attention, images can be replaced" is meaningless for me... I thought he said that it would only replace old images if there is not enuf room on the disc.

    thanx

    Steve

    Hello bichon,

    Thanks for posting on the Microsoft answers Forum.

    Look at the post below which asked questions on images and backup locations.
    http://social.technet.Microsoft.com/forums/en/w7itprogeneral/thread/338e311d-c0fc-4c56-a4c2-b25a7028188b
    With this option, below is where you can make changes.
    Select the drive to destination or optical disk or network location to store backup files. (this is where I want to change the destination directory name).

    If please reply back and let us know if this helps answer your question.

    Sincerely,

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Foglight v6 - FaultException: impossible to extract the data of inventory of the collector

    After having modernized our virtual center to V4, the foglight fails to report all the details and only has the following alert:
    "FaultException: impossible to extract the data of inventory of the collector: the parameter name cannot be null or an empty string."
    ' Parameter name: key to make sure the collection agent service is running.
    If anyone else has had this problem and how to solve?
    Thank you
    Karim

    Hi Joviyach,
    I logged a call with Vizioncore and the resolution is as follows:
    the problem you have is related to a VMware problem experienced during the upgrade to vSphere 4.0 as detailed in: kb.vmware.com/.../search.do
    Bascially, you must run a SQL command of your Virtual Center via MS SQL Management Studio that will identify one or more VMs who have a missing entry in the VPX_VIRTUAL_SCSICONTROLLER table. Once this information is determined that you would follow the steps 2 to 6 of the reolution... basically remove these virtual machines of the inventory and adding them back.
    When these steps are complete, you will re-start the vFoglight Collector of Vmware and Vmware vFoglight connector services.

  • How to add the new column in existing table to our desired location?

    How to add the new column in existing table to our desired location?

    For example, I have to add the new column 'course' before the salary column in the emp table.

    I think the best way is to add the column at the end of the table and create a new view with the order of the columns...

    Another option...

    places the data into a temporary table and recreate the table with the correct order of the columns, and then insert data to the table from the temporary table

    Refer

    Add column (from table) in the desired position

    Example:

    CREATE TABLE temp_my_user LIKE)

    SELECT * FROM password);

    DROP TABLE password;

    (Password) CREATE TABLE

    userID NUMBER

    , first name VARCAHR2 (25)

    , middleInitial VARCHAR2 (1)

    (, name VARCHAR2 (25));

    INSERT INTO password (userID, firstName, lastName)

    (SELECT username

    first name

    lastName

    OF temp_my_user);

    DROP TABLE temp_user;

  • Loading XML into the relational Table data

    Hello

    I get a generated XML file to other tools (Windows), I am trying to create a Linux shell script that will gather the necessary XML file to my Linux server, then ask Oracle to use this file to load the XML data into a relational table. This activity and the data will be needed on an ongoing basis.

    I tried two ways. First, I loaded the XML document into the database and tried to extract the data directly from the document, but it does not work. Now I want to try to read the data directly from the file on the server through select, however I don't get all the returned data. In the Select statement below, I am trying to query the data to see what is returned for my tests.

    Create Table ci_results_table (transactionID Varchar2 (100), //transactionID should be PrimaryKey but became errors in test of insert, PK so deleted NULL value)

    message Varchar2 (200),

    This Varchar2 (50).

    XMLType of the ProcessedDate,

    status Varchar2 (50).

    sourceFile VarChar2 (100));

    Select x.*

    from XMLTable)

    ' TSPLoadResults/results '.

    PASSAGE xmltype (bfilename('CMDB_DEVADHOCRESULTS_DIR','LoadResults-HP_146.results.xml'), nls_charset_id ('AL32UTF8'))

    COLUMNS

    transactionID PATH Varchar2 (100) 'TransactionID '.

    Result XMLType PATH 'result ',.

    Message Varchar2 (200) PATH "Message."

    PrimaryKey Varchar2 (50) PATH "PrimaryKey"

    Date of ProcessedDate path "ProcessedDate."

    Status Varchar2 (50) PATH "Status."

    SourceFile VarChar2 (100) PATH "SourceFileName.

    ) x

    ;

    Eventually, I'll have to build on that to limit the returned data to records where SourceFileName is like '% PA' and insert what is returned in to the ci_results_table. Attached is an example of the XML results file I am trying to load, it is named "ResultsTransformedtoUnix" because I used dos2Unix to convert Unix which can be good or bad. (I send the output file must be converted to the format BACK until the other application can read). Original (before converting Unix) file named in the script is also attached.

    Help, please. Thank you!

    Hello

    I see some bad things in your query.

    (1) obvious one, explaining why you get all the data: there is a typing error in the XQuery expression, there 'result' not'slead.

    (2) ProcessedDate can be extracted as a date (at least not directly) because it actually represents a timestamp, use the TIMESTAMP WITH time ZONE HOURS and cast back to DATE data type in the SELECT clause

    (3) transactionID is an attribute, it must be accessible with ' @' (or ' attribute:' axis)

    (4) if the encoding of file really is ISO-8859-1 as suggested in the prologue, then do not use AL32UTF8 but the name of the corresponding character set: WE8ISO8859P1

    Here is the query to work:

    select x.transactionID
         , x.Message
         , x.Primarykey
         , cast(x.ProcessedDate as date) ProcessDate
         , x.Status
         , x.SourceFile
    from XMLTable(
           '/TSPLoadResults/Result'
           PASSING xmltype(bfilename('XML_DIR','LoadResults-HP_146.results.xml'), nls_charset_id('WE8ISO8859P1'))
           COLUMNS
             transactionID Varchar2(100)            PATH '@transactionID',
             Message       Varchar2(200)            PATH 'Message',
             PrimaryKey    Varchar2(50)             PATH 'PrimaryKey',
             ProcessedDate timestamp with time zone PATH 'ProcessedDate',
             Status        Varchar2(50)             PATH 'Status',
             SourceFile    VarChar2(100)            PATH 'SourceFileName'
         ) x
    ;
    

    Directly on the file using this query will only be decently (for large files) on 11.2.0.4 and beyond.

    On older versions, first load the file into a (temporary) XMLType column with binary XML storage and CHOOSE from there.

    because I used dos2Unix to convert Unix which can be good or bad.

    This conversion should not be necessary.

  • How to read the data with different XML schemas within the unique connection?

    • I have Oracle database 11g
    • I access it via JDBC: Slim, version 11.2.0.3, same as xdb.
    • I have several tables, each has an XMLType column, all based on patterns.
    • There are three XML schemas different registered in the DB
    • Maybe I need to read the XML data in multiple tables.
    • If all the XMLTypes have the same XML schema, there is no problem,
    • If patterns are different, the second reading will throw BindXMLException.
    • If I reset the connection between the readings of the XMLType column with different schemas, it works.

    The question is: How can I configure the driver, or the connection to be able to read the data with different XML schemas without resetting the connection (which is expensive).

    Code to get data from XMLType is the implementation of case study:

     1   ResultSet resultSet = statement.executeQuery( sql ) ; 
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as BLOB. Like this:

     1    final Statement statement = connection.createStatement() ;  2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;  3   ResultSet resultSet = statement.executeQuery( sql ) ;  4   String result = null ;  5    while(resultSet.next()) {  6   Blob blob = resultSet.getBlob( 1 );  7   InputStream inputStream = blob.getBinaryStream();  8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();  9   inputStream.close(); 10   blob.free(); 11   } 12   resultSet.close(); 13   statement.close(); 14  15   System.out.println( result ); 16    return result ; 17
    

    Then it works. Still, can't get it work with XMLType in resultset. On the customer XML unwrapping explodes trying to pass to another XML schema. JDBC/XDB problem?

  • How to display rows of data in different columns?

    I'm new to SQL and currently, that's what I try to do:

    Display multiple lines of data in different columns in the same row

    I have a table like this:

    CREATE TABLE TRIPLEG)

    T # NUMBER (10) NOT NULL,

    STEP # NUMBER (2) NOT NULL,

    DEPARTURE VARCHAR (30) NOT NULL,

    VARCHAR (30) DESTINATION NOT NULL,.

    CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T #, LEG #).

    TRIPLEG_UNIQUE UNIQUE CONSTRAINT (T #, DEPARTURE, DESTINATION).

    CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T #) REFERENCES TRIP(T#));

    INSERT INTO TRIPLEG VALUES (1, 1, 'Sydney', 'Melbourne');

    INSERT INTO TRIPLEG VALUES (1, 2, 'Melbourne', 'Adélaïde');

    The result should be something like this:

    > T # | ORIGIN | DESTINATION1 |  DESTINATION2

    > 1 | SYDNEY | MELBORUNE | ADELAIDE

    The request must include the ' COUNT(T#) < 3' since I only need to display the records of less than 3. How can I get the results I want to use relational views?

    Thank you!!!

    I replaced the syntax "where" with the syntax 'account '. The reason why I do this is because I want to only display records with a number of travel of less than 3. By defining where the legs #.<=3, the="" result="" will="" be="" all="" the="" records="" of="" the="" tripleg="" table="" since="" each="" record="" could="" also="" have="" leg#="" is="">

    The answer is:

    with t as (SELECT t #,)

    REGEXP_REPLACE)

    LISTAGG (start |) '->' || destination, ' ')

    THE Group (ORDER BY t #, leg #).

    '([^ ]+) \1+',

    "\1") str

    OF tripleg

    HAVING COUNT (T #)<>

    GROUP BY t #)

    Select T #, regexp_substr (str, ' [^->] +', 1, 1) departure

    , regexp_substr (str, ' [^->] +', 1, 2) destination_1

    , regexp_substr (str, ' [^->] +' 1, 3) destination_2

    , regexp_substr (str, ' [^->] +' 1, 4) destination_3

    Thanks to Marty and knani!

  • extract xml data in the collection

    Hello

    I want to extract xml data in a collection of collection


    could any body you tell me if we succeed in sql
    ex:

    declare
    type t_code is table of number;
    type r_rec is record (c_name varchar2 (100),)
    c_code vrachar2 (100),
    c_code_number t_code);
    type t_rec is the table of the r_rec;

    l_xml xmltype: = xmltype (')

    < body >
    <>campaign
    < code > < code > CAMP_1
    < description > Campaign_1 < / description >
    < rateplans >
    < rateplanCode > 1 < / rateplanCode >
    < rateplanCode > 2 < / rateplanCode >
    < rateplanCode > 3 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_2
    < description > Campaign_2 < / description >
    < rateplans >
    < > 11 rateplanCode < / rateplanCode >
    < > 22 rateplanCode < / rateplanCode >
    < rateplanCode > 33 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_3
    < description > Campaign_3 < / description >
    < rateplans >
    < > 111 rateplanCode < / rateplanCode >
    < > 222 rateplanCode < / rateplanCode >
    < > 333 rateplanCode < / rateplanCode >
    < / rateplans >
    < / campaign >
    < result >
    < > 00 resultCode < / resultCode >
    < resultText > success < / resultText >
    < / result >
    (< / body > ');

    Start

    Select / * logic exrat value of xml in the final collection * /.
    Double;

    end;

    I want data in the model in my final collection t_rec

    CAMP_1, Campaign_1, nested_table (1,2,3)
    CAMP_2, Campaign_2, nested_table (11,22,33)
    CAMP_3, Campaign_3, nested_table (111,222,333)

    Published by: 948596 on May 17, 2013 05:17

    Like this

    SQL> declare
      2       type t_code is table of number ;
      3       type r_rec is record
      4       (
      5          c_name varchar2(100),
      6          c_code varchar2(100),
      7          c_code_number t_code
      8       );
      9       type t_rec is table of r_rec ;
     10       l_rec t_rec := t_rec();
     11       l_xml xmltype := xmltype
     12                        ('
     13                           
     14                           
     15                           CAMP_1
     16                           Campaign_1
     17                           
     18                           1
     19                           2
     20                           3
     21                           
     22                           
     23                           
     24                           CAMP_2
     25                           Campaign_2
     26                           
     27                           11
     28                           22
     29                           33
     30                           
     31                           
     32                           
     33                           CAMP_3
     34                           Campaign_3
     35                           
     36                           111
     37                           222
     38                           333
     39                           
     40                           
     41                           
     42                           00
     43                           Success
     44                           
     45                           '
     46                        ) ;
     47  begin
     48       for i in (
     49                 select rownum id
     50                      , t1.code
     51                      , t1.description
     52                      , t2.rate_plan_code
     53                      , row_number() over(partition by t1.code order by t2.rate_plan_code) rno
     54                   from xmltable
     55                        (
     56                             '/body/campaign' passing l_xml
     57                             columns
     58                               code        varchar2(100) path 'code',
     59                               description varchar2(100) path 'description',
     60                               rate_plans  xmltype       path 'rateplans'
     61                        ) t1
     62                      , xmltable
     63                        (
     64                             '/rateplans/rateplanCode' passing t1.rate_plans
     65                             columns
     66                               rate_plan_code varchar2(100) path '.'
     67                        ) t2
     68                )
     69       loop
     70            if i.rno = 1 then
     71               l_rec.extend;
     72               l_rec(l_rec.count).c_name := i.description;
     73               l_rec(l_rec.count).c_code := i.code;
     74               l_rec(l_rec.count).c_code_number := t_code();
     75            end if;
     76            l_rec(l_rec.count).c_code_number.extend;
     77            l_rec(l_rec.count).c_code_number(i.rno) := i.rate_plan_code;
     78       end loop;
     79       for i in 1..l_rec.count
     80       loop
     81          dbms_output.put_line(l_rec(i).c_code || '  ' || l_rec(i).c_name);
     82          for j in 1..l_rec(i).c_code_number.count
     83          loop
     84             dbms_output.put_line(l_rec(i).c_code_number(j));
     85          end loop;
     86       end loop;
     87  end;
     88  /
    CAMP_1  Campaign_1
    1
    2
    3
    CAMP_2  Campaign_2
    11
    22
    33
    CAMP_3  Campaign_3
    111
    222
    333
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

Maybe you are looking for

  • Variable playback speed?

    The podcast app allows variable playback speed?

  • In - app purchases

    Where app purchases come from? My bank account shows no deduction of my last few purchases, but yet they are working and I am able to buy things...?

  • Install more than one language

    Heya, From time to time, I use my laptop with Windows 7 girlfriends. I have my own profile here. As she is Italian, she installed the Italian Firefox. I don't speak any word from the Italian language, so it's abit of a problem for me. Is it possible

  • My Z500 won't read the dedicated graphics card driver.

    Or just got a new Z500, removed the BONE, it came with and Windows 8.1 is installed. First of all, I had a problem that the screen was too low, so I fiddled with the driver and after removing and re - install the graphics driver Intel HD4000, I manag

  • I have no sound after having my computer wiped and reset for my personal use.

    Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: the sound was working before. But I got it reset because the other owner info was still on it. (Information store... etc). I am not compu