Series read returns the string with excess-need information to extract data from the middle of the string

I read data from a STI flow meter using the base series writing and reading which used the VISA.  The read string begins with 'OK' or an error code, then a carriage return, then the data follows streaming rate temp pressure flow rate comma comma comma comma Temp... and so on. The string ends with a CR LF.  I need to pull the flow, temperature and pressure data out of the string and write it to a file.  I have difficulties to find a function that will retrieve the data for the string.  Any suggestions?  Thank you.

Try the subset of string in the palette of the chain.

Or match the model if you want a more direct control.

Also a good way is the string analysis, but you must be willing to read oexactly, what happens or an error, pass the entrance.

Tags: NI Hardware

Similar Questions

  • Extract data from the table on hourly basis

    Hello

    I have a table that has two columns date all the hours of the base and the response time. I want to extract data from the date corresponding previous hourly basis with the response time. The data will be loaded into the table every midnight.

    for example: today date 23/10/2012
    I want to extract data from 22/10/12 00 to the 22/10/12 23

    The sub query pulls the date as demanded, but I'm not able to take the time to answer.

    with one also
    (select min (trunc (lhour)) as mindate, max (trunc (lhour)) as AVG_HR maxdate)
    SELECT to_char (maxdate + (level/25), "dd/mm/yyyy hh24") as a LEVEL CONNECTION dates < = * (1) 24;

    Please help me on this.

    Try this

    SELECT * FROM table_nm
     WHERE to_char(hour,'DD') = to_char(SYSDATE-1,'DD')
    
  • Is there any task under the WSF to extract data from configuration of an instance as working Structures?

    Hello

    Is there any task in the Installation Manager to extract data from configuration of an instance as working Structures, research etc.

    I'm looking for the same kind that I could move all these configurations of one example to the other.

    Thank you

    Maury

    The name of the task is to manage Configuration packages in the installation and maintenance program. You can see this document http://docs.oracle.com/cd/E48434_01/fusionapps.1118/e49542/F1166430AN11D30.htm

  • How to extract data from SQL server in the FDM

    Hi Experts

    How to extract data from a SQL server HFM to another SQL Server using scripts for integration in FDQM?

    concerning

    Dev

    Could you clarify why you want to do this?

    If you try to synchronize two databases (apps) to have a backup or something running in a development environment, I suggest configuring replication between two databases. It would be much more effective to do it at the SQL Server level through the application of FDM, IMHO.

    Charles

  • Extracting data from table without refreshment and without using the tab key.

    Hi friends,

    I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.

    for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.

    How can I do that.

    Thank you
    Maury

    Hi Maury,

    I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?

    If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.

    Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.

    Andy

  • With the help of ODI to extract data from IBM DB2

    Has anyone used IBM DB2 as a data source for essbase using ODI? If so, do you have tips, pointers specific to this particular situation of DB2, or better yet the resources outside the SER60 reading?

    If you want to understand the different modules of knowledge and how to set up the DB2 technology in ODI, then have a read of:-http://download.oracle.com/docs/cd/E14571_01/integrate.1111/e12644/db2.htm#CHDBJIBH

    Once you have extracted the data from db2 source then you would just use the SQL IKM to essbase with a rule of load data for load data into essbase, I covered the essbase data loading in my blogs.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to extract data from the APEX report with stored procedure?

    Hi all

    I am doing a report at the APEX. the user selects two dates and click on the GO button - I have a stored procedure linked to this region of outcome for the stored procedure is called.

    my stored procedure does the following-

    using dates specified (IN) I do question and put data in a table (this painting was created only for this report).

    I want to show all the data that I entered in the table on my APEX report the same procedure call. can I use Ref cursor return? How to do this?

    Currently, I use another button in the APEX that basically retrieves all the data from table. Basically, the user clicks a button to generate the report and then another button for the report. which is not desirable at all :(


    I m using APEX 3.1.2.00.02 and Oracle 10 database.

    pls let me know if you need more clarification of the problem. Thanks in advance.

    Kind regards

    Probashi

    Published by: porobashi on May 19, 2009 14:53

    APEX to base a report out of a function that returns the sql code... Your current code goes against a Ref cursor returns the values...

    See this thread regarding taking a ref cursor and wrapping it in a function to channel out as a 'table' (use a cast to cast tabular function vale)...

    (VERY COOL STUFF HERE!)

    Re: Tyring to dynamically create the SQL statement for a calendar of SQL

    Thank you

    Tony Miller
    Webster, TX

  • How to extract data from your laptop with crushed Windows Vista without restoring to the factory settings?

    I ran a few updates, but before you restart the computer, I deleted many files.

    The result is that my Vista does not start, and only offered solution is to restore to factory State, which is not acceptable for me because I need data from the HARD drive.
    Y at - it an easy way to recover data from the HARD drive, or should I contact? Thank you.

    Need help on MS Answers was my last option before calling a service.

    But, luckily, I found a way. I just change the settings in the BIOS for SATA, Vista started, I restored some of the deleted files, and voila - it worked. Another reboot, BIOS have been changed on the previous settings, and now it works perfectly.

  • extracting data from the CLOB using materialized views

    Hello

    We have xml data from clob which I have a requirement to extract (~ 50 attributes) on a daily basis, so we decided to use materialized views with refreshes full (open good suggestions)

    A small snippet of code

    CREATE THE MWMRPT MATERIALIZED VIEW. TASK_INBOUND

    IMMEDIATE CONSTRUCTION

    FULL REFRESH ON DEMAND

    WITH ROWID

    AS

    SELECT M.TASK_ID, M.BO_STATUS_CD, b.*

    OF CISADM. M1_TASK m,

    XMLTABLE (' / a ' XMLPARSE PASSING ())

    CONTENT '< a > | M.BO_DATA_AREA | "< /a >."

    ) COLUMNS

    serviceDeliverySiteId varchar2 (15) PATH

    "cmPCGeneralInfo/serviceDeliverySiteId"

    serviceSequenceId varchar2 (3) PATH "cmPCGeneralInfo/serviceSequenceId"

    completedByAssignmentId varchar2 (50) PATH "completedByAssignmentId."

    Cust_id varchar2 (10) PATH "cmPCCustomerInformation/customerId,"

    ACCT_SEQ varchar2 (5) PATH "customerInformation/accountId"

    AGRMT_SEQ varchar2 (5) PATH cmPCCustomerAgreement/agreementId"."

    COLL_SEQ varchar2 (5) PATH "cmPCGeneralInfo/accountCollectionSeq"

    REVENUE_CLASS varchar2 (10) PATH "cmPCCustomerAgreement/revenueClassCode"

    REQUESTED_BY varchar2 (50) PATH ' attributes customerInformation/contactName',...~50

    This ddl ran > 20 hours and no materialized view created. There are certain limits that we have

    • Cannot create a materialized view log
    • cannot change the source as its defined provider table
    • cannot do an ETL

    DB is 11g R2

    Any ideas/suggestions are very much appreciated

    I explored a similar approach, using the following test case.

    It creates a table "MASTER_TABLE" containing 20,000 lines and a CLOB containing an XML fragment like this:

    09HOLVUF3T6VX5QUN8UBV9BRW3FHRB9JFO4TSV79R6J87QWVGN

    UUL47WDW6C63YIIBOP1X4FEEJ2Z7NCR9BDFHGSLA5YZ5SAH8Y8

    O1BU1EXLBU945HQLLFB3LUO03XPWMHBN8Y7SO8YRCQXRSWKKL4

    ...

    1HT88050QIGOPGUHGS9RKK54YP7W6OOI6NXVM107GM47R5LUNC

    9FJ1JZ615EOUIX6EKBIVOWFDYCPQZM2HBQQ8HDP3ABVJ5N1OJA

    then an intermediate table "MASTER_TABLE_XML" with the same columns with the exception of the CLOB which turns into XMLType and finally a MVIEW:

    SQL > create table master_table like

    2. Select level as id

    3, cast ('ROW' | to_char (Level) as varchar2 (30)) as the name

    4       , (

    5. Select xmlserialize (content

    XMLAGG 6)

    7 xmlelement (evalname ('ThisIsElement' | to_char (Level)), dbms_random.string ('X', 50))

    8                    )

    9 as clob dash

    10                  )

    11 double

    12 connect by level<=>

    (13) as xmlcontent

    14 double

    15 connect by level<= 20000="">

    Table created.

    SQL > call dbms_stats.gather_table_stats (user, 'MASTER_TABLE');

    Calls made.

    SQL > create table (master_table_xml)

    Identification number 2

    3, name varchar2 (30)

    4, xmlcontent xmltype

    5)

    binary xmltype 6 securefile XML column xmlcontent store

    7;

    Table created.

    SQL > create materialized view master_table_mv

    2 build postponed

    full 3 Refresh on demand

    4, as

    5. Select t.id

    6, t.nom

    7       , x.*

    master_table_xml 8 t

    9, xmltable ('/ r' in passing t.xmlcontent)

    10 columns

    11 path of varchar2 (50) ThisIsElement1 'ThisIsElement1 '.

    12, path of varchar2 (50) ThisIsElement2 'ThisIsElement2 '.

    13, path of varchar2 (50) ThisIsElement3 'ThisIsElement3 '.

    14, path of varchar2 (50) ThisIsElement4 'ThisIsElement4 '.

    15 road of varchar2 (50) ThisIsElement5 'ThisIsElement5 '.

    16, road of varchar2 (50) ThisIsElement6 'ThisIsElement6 '.

    17 road of varchar2 (50) ThisIsElement7 'ThisIsElement7 '.

    18 road of varchar2 (50) ThisIsElement8 'ThisIsElement8 '.

    19 road to varchar2 (50) ThisIsElement9 'ThisIsElement9 '.

    20, path of varchar2 (50) ThisIsElement10 'ThisIsElement10 '.

    21, road to varchar2 (50) ThisIsElement11 'ThisIsElement11 '.

    22 road of varchar2 (50) ThisIsElement12 'ThisIsElement12 '.

    23 road of varchar2 (50) ThisIsElement13 'ThisIsElement13 '.

    24, path of varchar2 (50) ThisIsElement14 'ThisIsElement14 '.

    25 road of varchar2 (50) ThisIsElement15 'ThisIsElement15 '.

    26, path of varchar2 (50) ThisIsElement16 'ThisIsElement16 '.

    27, way to varchar2 (50) ThisIsElement17 'ThisIsElement17 '.

    28 road of varchar2 (50) ThisIsElement18 'ThisIsElement18 '.

    29 road of varchar2 (50) ThisIsElement19 'ThisIsElement19 '.

    30, path of varchar2 (50) ThisIsElement20 'ThisIsElement20 '.

    31, path of varchar2 (50) ThisIsElement21 'ThisIsElement21 '.

    32 road of varchar2 (50) ThisIsElement22 'ThisIsElement22 '.

    33, path of varchar2 (50) ThisIsElement23 'ThisIsElement23 '.

    34 road of varchar2 (50) ThisIsElement24 'ThisIsElement24 '.

    35 road of varchar2 (50) ThisIsElement25 'ThisIsElement25 '.

    36, road to varchar2 (50) ThisIsElement26 'ThisIsElement26 '.

    37, path of varchar2 (50) ThisIsElement27 'ThisIsElement27 '.

    38, path of varchar2 (50) ThisIsElement28 'ThisIsElement28 '.

    39, path of varchar2 (50) ThisIsElement29 'ThisIsElement29 '.

    40, road of varchar2 (50) ThisIsElement30 'ThisIsElement30 '.

    41 road of varchar2 (50) ThisIsElement31 'ThisIsElement31 '.

    42, path of varchar2 (50) ThisIsElement32 'ThisIsElement32 '.

    43, road to varchar2 (50) ThisIsElement33 'ThisIsElement33 '.

    44, path of varchar2 (50) ThisIsElement34 'ThisIsElement34 '.

    45, path of varchar2 (50) ThisIsElement35 'ThisIsElement35 '.

    46, path of varchar2 (50) ThisIsElement36 'ThisIsElement36 '.

    47, path of varchar2 (50) ThisIsElement37 'ThisIsElement37 '.

    48, path of varchar2 (50) ThisIsElement38 'ThisIsElement38 '.

    49, path of varchar2 (50) ThisIsElement39 'ThisIsElement39 '.

    50 road of varchar2 (50) ThisIsElement40 'ThisIsElement40 '.

    51, path of varchar2 (50) ThisIsElement41 'ThisIsElement41 '.

    52, path of varchar2 (50) ThisIsElement42 'ThisIsElement42 '.

    53, path of varchar2 (50) ThisIsElement43 'ThisIsElement43 '.

    54, path of varchar2 (50) ThisIsElement44 'ThisIsElement44 '.

    55 road of varchar2 (50) ThisIsElement45 'ThisIsElement45 '.

    56, path of varchar2 (50) ThisIsElement46 'ThisIsElement46 '.

    57, path of varchar2 (50) ThisIsElement47 'ThisIsElement47 '.

    58 road of varchar2 (50) ThisIsElement48 'ThisIsElement48 '.

    59 road of varchar2 (50) ThisIsElement49 'ThisIsElement49 '.

    60 road of varchar2 (50) ThisIsElement50 'ThisIsElement50 '.

    (61) x;

    Materialized view created.

    The discount is then performed in two steps:

    1. INSERT INTO master_table_xml
    2. Refresh the MVIEW

    (Note: as we insert in an XMLType column, we need an XML (only root) document this time)

    SQL > set timing on

    SQL >

    SQL > truncate table master_table_xml;

    Table truncated.

    Elapsed time: 00:00:00.27

    SQL >

    SQL > insert into master_table_xml

    2. select id

    3, name

    4, xmlparse (document '' |) XmlContent |'')

    5 master_table;

    20000 rows created.

    Elapsed time: 00:04:38.72

    SQL >

    SQL > call dbms_mview.refresh ('MASTER_TABLE_MV');

    Calls made.

    Elapsed time: 00:00:22.42

    SQL >

    SQL > select count (*) in the master_table_mv;

    COUNT (*)

    ----------

    20000

    Elapsed time: 00:00:01.38

    SQL > truncate table master_table_xml;

    Table truncated.

    Elapsed time: 00:00:00.41

  • Problem with difference of calculation between two dates from Monday to Saturday

    Hello

    I need help to change a function return number you dates, including Saturday hours (09:00 - 14:00), Monday to Friday (09:00 - 21:00);

    This is my code;

    CREATE OR REPLACE
    FUNCTION TEST2 (FECHA_INICIO DATE, DATE FECHA_FIN)

    RETURN NUMBER IS THE NUMBER OF HORASTOTALES;
    date the date;

    BEGIN
    If)
    SELECT date, to_char (date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') dia.
    (SELECT to_date('FECHA_INICIO') + LEVEL - 1 date
    OF THE DOUBLE
    CONNECT BY LEVEL < = (FECHA_FIN - FECHA_INICIO))
    WHERE TO_CHAR (DATE, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') not IN ("SAT") THEN

    with t as)

    SELECT CASE LEVEL
    When 1 then greatest (fecha_inicio, trunc (fecha_inicio) + 9 / 24)
    to another level - 15 + trunc (fecha_inicio) / 24
    end fecha_inicio
    case connect_by_isleaf
    When 1 then least (fecha_fin, trunc (fecha_fin) + 21 / 24)
    Another trunc (fecha_inicio) + level - 3 / 24
    end fecha_fin
    of the double

    connect by level < = trunc (fecha_fin) - trunc (fecha_inicio) + 1).

    Select sum (more large (fecha_fin - fecha_inicio, 0)) * 24 horas
    in horastotales
    T

    WHEN TRUNC (FECHA_INICIO) - TRUNC (FECHA_INICIO, 'iw') < 5;

    RETURN HORASTOTALES;

    ) ELSE IF
    Return HORASTOTALES + 5;
    END;

    concerning

    Hello again,

    Using this function, which makes me ask properly, what hours, my problem is that I can not include Saturday hours;

    create or replace FUNCTION TEST (FECHA_INICIO DATE, FECHA_FIN DATE

    )

    RETURNS the NUMBER IS horastotales NUMBER;

    BEGIN

    with t as)

    SELECT CASE LEVEL

    When 1 then greatest (fecha_inicio, trunc (fecha_inicio) + 9 / 24)

    to another level - 15 + trunc (fecha_inicio) / 24

    end fecha_inicio

    case connect_by_isleaf

    When 1 then least (fecha_fin, trunc (fecha_fin) + 21 / 24)

    Another trunc (fecha_inicio) + level - 3 / 24

    end fecha_fin

    of the double

    connect by level<= trunc(fecha_fin)="" -="" trunc(fecha_inicio)="" +="">

    )

    Select sum (more large (fecha_fin - fecha_inicio, 0)) * 24 horas

    in horastotales

    T

    When TRUNC (FECHA_INICIO) - TRUNC (FECHA_INICIO, 'iw')<>

    RETURN horastotales;

    END;

    Example:

    SELECT TEST (TO_DATE (January 7, 2013 09:10 ',' DD-MM-YYYY HH24 '), TO_DATE (February 7, 2013 09:00 "," DD-MM-YYYY HH24 ')) horas

    OF THE DOUBLE

    output: 11, 8 hours

    Then try to add parts of your function, to get what I want, but it gives me compilation errors

  • Extract data from files of the NRF

    Hello!

    So, I'm working on a project where I have files of data that are written on 12 channels in a .nrf file.  As the NRF seems to be a pretty unique file format I don't come with a better than DIAdem Software for open data.  I'm looking for a way to take data from each of the channels and enter the values programmatically every x number of data points.  I use Visual Studio, written in c#, using the Library COM DIAdem.

    At this point I wrote a very basic program that uses CmdExecuteSync ("DataFileImport (" "+ file.)") FillName + "')"); to import the .nrf file in DIAdem, but from there, I'm lost.  I tried to export the data using the DataFileSaveSel function, but unfortunately the CSV output ends up being almost a gigabyte in size, which is too big for my needs.  I hope there is a way to perform the operation, that I need in tiara and if so someone could help get me pointed in the right direction.

    Thank you very much in advance for any help.

    Hi Kub,

    I recommend you use the loading capacity reduced by tiara, like this:

    n = 10
    SectionBegin = 1
    SectionEnd = 1000
    Call DataDelAll
    Call DataFileLoadRed (FileDlgName, "", "", "IntervalWidth", N, 1, SectionBegin, SectionEnd)

    This will load every nth value from value 1 to the value 1000.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • extract data from the generic cursor xy graph

    Hi, I'm new in this Forum.

    In my VI I need to extract the data from the graph xy of one cursor to another, how can I do this?

    I want to extract all the data between the two sliders, to develop.

    Thank you

    In addition to everything said altenbach, you want the slider list: property of the Index. That will tell you where in the table of data, the sliders are.

    The attached VI shows how we can work and also meaningless how it can be with common types of XY data.

    Lynn

  • Send with blackBerry Smartphones, how to retrieve data from blackberry?

    Hi, I need to send an email to blackberry and on the user's response, I need to store this data in the database. Can u please help me in this regard. How to send email from web browser, and then retrieve the data in a database.

    khushi289 wrote:
    OK ya... We use Tomact 6. How do you after that

    It is a forum oriented BlackBerry technology, you have questions about web development. I think it's best for you is to find some tutorials on the internet on "how to create a web application on tomcat with a database" or try a forum oriented Tomcat directly.

  • Need assistance to migrate data from XML to oracle table.

    Hey Odie,

    Im trying to insert data from an xml file into a table.

    My XML file is as follows.

    <? XML version = "1.0" encoding = "UTF-8" standalone = 'yes' ?>

    - < TransferXML >

    < BatchName > HJ69240 < / BatchName >

    < BatchStatus > Park < / BatchStatus >

    - < SubBatch >

    < SubBatchName > UQ80288 < / SubBatchName >

    < SubBatchStatus > project < / SubBatchStatus >

    - < SubBatchDetail >

    < Ingredient > I3308 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 4.0 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3261 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 3.5 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3235 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,5 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3142 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,2 < / MDispensedQty >

    < / SubBatchDetail >

    </SubBatch>

    - < SubBatch >

    < SubBatchName > ZB97913 < / SubBatchName >

    < SubBatchStatus > incomplete < / SubBatchStatus >

    - < SubBatchDetail >

    < Ingredient > I3309 < / > of theingredient

    < DispensedQty > 0,75 < / DispensedQty >

    < MDispensedQty > 0,0 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3436 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,05 < / MDispensedQty >

    < / SubBatchDetail >

    </SubBatch>

    <Final>false</Final>

    < / TransferXML >



    With the help of your previous posts I've migrated data from this xml file in a table that works perfectly well. But these data repeats instead of giving 6 lines that his return 12 lines guide please.


    CREATE TABLE XXBATCH AS

    SELECT A.BatchName, A.BatchStatus, B.SubBatchName, B.SubBatchStatus, C.Ingredient, C.DispensedQty, C.MDispensedQty, A.FINAL

    OF (XMLTable ('/ TransferXML'))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    BatchName VARCHAR2 path (99) "BatchName.

    , Path of the BatchStatus VARCHAR2 (999) "BatchStatus.

    Path VARCHAR2 (99) final 'Final')),

    (XMLTable ('/ TransferXML/SubBatch '))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    Path of SubBatchName VARCHAR2 (99) "SubBatch/SubBatchName".

    , Path of the SubBatchStatus VARCHAR2 (99) "SubBatch/SubBatchStatus".

    (B)

    (XMLTable ('/ TransferXML/SubBatch/SubBatchDetail '))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    Path of the ingredient VARCHAR2 (99) SubBatchDetail/ingredient"."

    , Path of the DispensedQty VARCHAR2 (99) "SubBatchDetail/DispensedQty".

    , Path of the MDispensedQty VARCHAR2 (99) "SubBatchDetail/MDispensedQty".

    (C)

    I didn't test your query, but apparently it's because you have access to the same file three times instead of spend one XMLTable to another correlated nested groups.

    Better, this should work:

    SELECT A.BatchName

    A.BatchStatus

    B.SubBatchName

    B.SubBatchStatus

    C.Ingredient

    C.DispensedQty

    C.MDispensedQty

    A.FINAL

    FROM XMLTable ('/ TransferXML')

    PASSAGE xmltype (bfilename('TEST_DIR','HJ69240.xml'), nls_charset_id ('AL32UTF8'))

    Path of COLUMNS BatchName VARCHAR2 (99) "BatchName.

    , Path of the BatchStatus VARCHAR2 (999) "BatchStatus.

    , Path VARCHAR2 (99) final "Final."

    , Path of XMLTYPE «SubBatch» SubBatchList

    ) AT

    , XMLTable ('/ SubBatch')

    PASSAGE SubBatchList

    Path of COLUMNS SubBatchName VARCHAR2 (99) "SubBatchName".

    , Path of the SubBatchStatus VARCHAR2 (99) "SubBatchStatus".

    , Path of XMLTYPE «SubBatchDetail» SubBatchDetailList

    ) B

    , XMLTable ('/ SubBatchDetail')

    PASSAGE SubBatchDetailList

    Path VARCHAR2 (99) ingredient of COLUMNS "Ingredient."

    , Path of the DispensedQty VARCHAR2 (99) "DispensedQty".

    , Path of the MDispensedQty VARCHAR2 (99) "MDispensedQty".

    ) C

    ;

    Post edited by: odie_63

  • Extract data from complex XML of XMLType with nodes parents containing several internal nodes

    Hello

    I use Google geocoding XML Web Service to try to enrich some geo data in the database. I've kept all the Google result in an XMLType column, the result is something like this:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < GeocodeResponse >

    < status > OK < / status >

    < result >

    Zip_code < type > < / type >

    < formatted_address > 76279, Saudi Arabia < / formatted_address >

    < address_component >

    < > 76279 long_name < / long_name >

    < > 76279 short_name < / short_name >

    Zip_code < type > < / type >

    < / address_component >

    < address_component >

    < long_name > Northern Frontier Province < / long_name >

    < short_name > Northern Frontier Province < / short_name >

    administrative_area_level_1 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > Saudi Arabia < / long_name >

    < short_name > SA < / short_name >

    country of < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < geometry >

    < location >

    < lat > 29.1214197 < / lat >

    < LNG > 44.3945656 < / LNG >

    < / location >

    < location_type > APPROX. < / location_type >

    < window >

    < Southwest >

    < lat > 29.1016132 < / lat >

    < LNG > 44.3654665 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 29.1400926 < / lat >

    < LNG > 44.4116001 < / LNG >

    < / Northeast >

    < / window >

    < limits >

    < Southwest >

    < lat > 29.1016132 < / lat >

    < LNG > 44.3654665 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 29.1400926 < / lat >

    < LNG > 44.4116001 < / LNG >

    < / Northeast >

    < / delimits >

    < / geometry >

    < place_id > ChIJcy767DIAYxURohAm-DLSunw < / place_id >

    < / result >

    < result >

    locality < type > < / type >

    < Type > policy < / type >

    Foucart, France < formatted_address > < / formatted_address >

    < address_component >

    < long_name > Foucart < / long_name >

    < short_name > Foucart < / short_name >

    locality < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > Seine-Maritime < / long_name >

    < > 76 short_name < / short_name >

    administrative_area_level_2 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > upper Normandy < / long_name >

    < short_name > upper Normandy < / short_name >

    administrative_area_level_1 < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < address_component >

    < long_name > France < / long_name >

    < short_name > EN < / short_name >

    country of < type > < / type >

    < Type > policy < / type >

    < / address_component >

    < geometry >

    < location >

    < lat > 49.6131170 < / lat >

    < LNG > 0.5951040 < / LNG >

    < / location >

    < location_type > APPROX. < / location_type >

    < window >

    < Southwest >

    < lat > 49.6019770 < / lat >

    < LNG > 0.5731880 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 49.6329760 < / lat >

    < LNG > 0.6081609 < / LNG >

    < / Northeast >

    < / window >

    < limits >

    < Southwest >

    < lat > 49.6019770 < / lat >

    < LNG > 0.5731880 < / LNG >

    < / Southwest >

    < Northeast >

    < lat > 49.6329760 < / lat >

    < LNG > 0.6081609 < / LNG >

    < / Northeast >

    < / delimits >

    < / geometry >

    < place_id > ChIJQdTiHHJc4EcRUIO2T0gUDAQ < / place_id >

    < / result >

    < / GeocodeResponse >


    Here are practically two entries from geo (the /result of xml nodes), and each entry has multiple secondary entries of type address_component and a secondary entrance to the geometry of type.


    I can get the entries in the result of this query:


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ("' / GeocodeResponse/result")

    PASSAGE x.google_geodata_xml

    COLUMNS

    Path of 'FORMATTED_ADDRESS' VARCHAR2 (200) "formatted_address".

    ) xt;


    The subnodes XML type address_component and type geometry of teas and those below:


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ('/ GeocodeResponse/result/address_component ')

    PASSAGE x.google_geodata_xml

    COLUMNS

    Path of "LONG_NAME' VARCHAR2 (200)"long_name. "

    'SHORT_NAME' VARCHAR2 (500) PATH 'short_name ',.

    Path ACCESS VARCHAR2 (200) from 'TYPE_1' 'type [1]. "

    Path ACCESS VARCHAR2 (200) to 'TYPE_2' 'type [2].

    ) xt;


    SELECT xt.*

    OF zip_tree_sort_xml x,.

    XMLTABLE ("/ GeocodeResponse/result/geometry/location")

    PASSAGE x.google_geodata_xml

    COLUMNS

    "latitude" NUMBER PATH 'lat ',.

    "longitude" NUMBER PATH 'LNG '.

    ) xt;


    But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?

    Best regards

    Rodriguez

    But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?

    You can do chaining XMLTABLE another that will handle the address_component expandable nodes.

    Data from the geometry node can be extracted at the same level as a result.

    SQL> select x1.formatted_address
      2       , x2.long_name
      3       , x2.short_name
      4       , x2.type_1
      5       , x2.type_2
      6       , x1.latitude
      7       , x1.longitude
      8  from zip_tree_sort_xml t
      9     , xmltable('/GeocodeResponse/result'
     10         passing t.google_geodata_xml
     11         columns
     12           formatted_address   varchar2(200) path 'formatted_address'
     13         , address_components  xmltype       path 'address_component'
     14         , latitude            number        path 'geometry/location/lat'
     15         , longitude           number        path 'geometry/location/lng'
     16       ) x1
     17     , xmltable('/address_component'
     18         passing x1.address_components
     19         columns
     20           long_name   varchar2(200) path 'long_name'
     21         , short_name  varchar2(500) path 'short_name'
     22         , type_1      varchar2(200) path 'type[1]'
     23         , type_2      varchar2(200) path 'type[2]'
     24       ) x2 ;
    
    FORMATTED_ADDRESS       LONG_NAME                   SHORT_NAME                   TYPE_1                         TYPE_2       LATITUDE  LONGITUDE
    ----------------------- --------------------------- ---------------------------- ------------------------------ ---------- ---------- ----------
    76279, Saudi Arabia     76279                       76279                        postal_code                               29,1214197 44,3945656
    76279, Saudi Arabia     Northern Borders Province   Northern Borders Province    administrative_area_level_1    political  29,1214197 44,3945656
    76279, Saudi Arabia     Saudi Arabia                SA                           country                        political  29,1214197 44,3945656
    Foucart, France         Foucart                     Foucart                      locality                       political   49,613117   0,595104
    Foucart, France         Seine-Maritime              76                           administrative_area_level_2    political   49,613117   0,595104
    Foucart, France         Upper Normandy              Upper Normandy               administrative_area_level_1    political   49,613117   0,595104
    Foucart, France         France                      FR                           country                        political   49,613117   0,595104
    
    7 rows selected.
    

Maybe you are looking for