Req SQL syntax. to extract the value XML [CLOB]

Hello

I'll have the XML column in my table.

I have XML value in CLOB data type. I had an experience using extract XML from SQL syntax.

But I am unable to extract this file. I need to meet tagname value XML who gave example below.

For example, the name of the Table is A
Column name is A1

The value of column given below here.

<? XML version = "1.0" encoding = "ISO-8859-1? > < tags > < tag > < tagname > {docval} < / tagname > < tagvalue > ESPRefNotice < / tagvalue > < / tag > < tag > < tagname > {: inputvalue} < / tagname > < tagvalue > 3216 < / tagvalue > < / tag > < tag > < tagname > {officename} < / tagname > < tagvalue > ssvofficename < / tagvalue > < / tag > < / tags >

Kindly help me on this to extract the value 'tagname' or 'tagvalue' according to the above xml data.

Thank you
SELECT warehouse_name warehouse,
   warehouse2."Water", warehouse2."Rail"
   FROM warehouses,
   XMLTABLE('/Warehouse'
      PASSING warehouses.warehouse_spec
      COLUMNS
         "Water" varchar2(6) PATH '/Warehouse/WaterAccess',
         "Rail" varchar2(6) PATH '/Warehouse/RailAccess')
      warehouse2;

check this exp in the documentation
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB

the warehouse_spec is of type xmltype. So in your case it is clob then you need to add like what I did in the query...
XmlType ()...

Hope that explains everything...

Ravi Kumar

Tags: Database

Similar Questions

  • How to extract the values of XMLTYPE column,

    SQL > create table temporary global xmtype_tab (xmlfile xmltype);

    SQL > select * from all_directories;

    SYS RESTOREDIR/home / / dbimptask /.

    insert into xmtype_tab values (xmltype (dbms_xslprocessor.read2clob ('RESTOREDIR ','LAS_SETUP.xml ')));

    1 line of creation.

    SQL > select * from xmtype_tab;

    XMLFILE
    --------------------------------------------------------------------------------
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >


    How to extract the values inside each tag?


    XML file has the following data...


    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >
    < > 9600 BAUD_RATE < / BAUD_RATE >
    < ACK_TIMEOUT > 1 < / ACK_TIMEOUT >
    < TUBE_TRAVEL_LIMIT > 4 < / TUBE_TRAVEL_LIMIT >
    < SEND_SID_TIMEOUT > 1 < / SEND_SID_TIMEOUT >
    < INDEX_Q_TIMEOUT > 2 < / INDEX_Q_TIMEOUT >
    < HW_HANDSHAKING > 1 < / HW_HANDSHAKING >
    < / ROW >
    < / LINES > ';

    I use the Oracle 10.2.0.3 version...

    Why does this work?

    You are missing the tag of the ROWSET:

    select extractvalue (xmlfile, '/ROWSET/ROW/BAUD_RATE') baud_rate
      from xmltype_tab
     where existsnode (xmlfile, '/ROWSET/ROW/BAUD_RATE') = 1;
    
  • To extract the value of particular tag of xmlType

    Hello
    The requirement is to extract the value of the specific tab of an XmlType column.

    Here is the schema of the table:
    CREATE TABLE DTCC_REF)
    MESSAGE XMLTYPE NOT NULL,.
    CashFlowId varchar2 (20)
    )

    This table is already filled with only a value in the Message column. cashFlowId is null for all rows.

    Here are examples of MESSAGE data:
    <? XML version = "1.0" encoding = "UTF-8"? > < env:Envelope xmlns:rm = xmlns:pmnt 'OTC_RM_15-Apr-2005' = xmlns:env 'OTC_Payment_15-Apr-2005' = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:fpml = "http://www.fpml.org/2004/FpML-4-1" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "OTC_RM_15-Apr-2005... «/OTC/OTC_RM_15-Apr-2005.xsd OTC_Payment_15-Apr-2005... http://schemas.xmlsoap.org/soap/envelope/ /xmls/OTC/soap-envelope.xsd /OTC/OTC_Payment_15-Apr-2005.xsd "> < env:Header > < OTC_RM xmlns =" OTC_RM_15-Apr-2005 "> < manifest > < PaymentMsg > < activity > edit < / activity > < status > Matched < / status > < LinkStatus > Linked < / LinkStatus > < TransType > payment < / TransType > < AssetClass > credit < / AssetClass > < DTCCUserId > 00006151» < / DTCCUserId > < CounterpartyId > 00006132 < / CounterpartyId > < / PaymentMsg > < MsgId > 1 < / MsgId > < / Manifest > < / env:Header > < env:Body > < OTC_Payment xmlns = "OTC_Payment_15-Apr-2005" > < payment > < ReferenceIdentifiers > < TradeId > 1001513 M < / TradeId > < ContraTradeId > CREC5856 < / ContraTradeId > < LinkId > LINKEE1DSL890420 < / LinkId > < MatchId > PYMTEKGDRP784788 < / MatchId > < CashFlowId > 2005/12 / 200INTEUREUR1001513M < / CashFlowId > < 61326151EUR1220 NetId > < / NetId > < GroupRefId > < / GroupRefId > < ContraGroupRefId > < / ContraGroupRefId > < / ReferenceIdentifiers > < TradeDetails > < TradeType > EXOTIC < / TradeType > < TradeDate > 2004 - 09 - 13 < / TradeDate > < EffectiveDate > 2004 - 09 - 14 < / EffectiveDate > < ScheduledTerminationDate > 2014 - 09 - 20 < / ScheduledTerminationDate > < NotionalAmount > < fpml : currency > EUR < / fpml:currency > < fpml: Amount > 6000000.00 < / fpml:amount > < / NotionalAmount > < EffectiveRate > 0.3150000 < / EffectiveRate > < ReferenceEntity > < / ReferenceEntity > < / TradeDetails > < SettlementDetails > < SourceSSI > < / SourceSSI > < DestinationSSI > < / DestinationSSI > < / SettlementDetails > < / payment > < / OTC_Payment > < / env : Body > < / env:Envelope >

    Now, I have to fill out the tag CashFlowId value in column 2 of the table.

    How can I retrieve value da? Plase help me...
    SQL> with dtcc_ref as ( select xmltype('
    
      
        
          
            
              Modify
              Matched
              Linked
              Payment
              Credit
              00006151
              00006161
            
            2
          
          
            
              DTCC
              DTCC00006151
            
            
              
                http://db.com/route
                2005-11-26T13:59:29.593Z
                2005-11-26T13:59:29.593Z
              
              
                www.dtcc.net
                2005-11-26T09:47:00.000-05:00
                2005-11-26T09:47:00.000-05:00
              
            
          
        
      
      
        
          
            
              1006299M
              0900000702811
              LINKEBHBKD364294
              PYMTEKUBMKN02373
              2005/12/200INTUSDUSD1006299M
              61516161USD1220
              
              
            
            
              REC
              
                USD
                625625.00
              
              2005-12-20
              Unknown
              Fixed
            
            
              EXO
              2004-09-30
              2004-09-30
              2009-03-20
              
                USD
                247500000.00
              
              1.0000000
              
            
            
              
              
            
          
        
      
    ') xml from dual
    )
    --
    --
    select trim(x.column_value) CashFlowId
      from dtcc_ref t, xmltable('declare namespace e = "OTC_Payment_15-Apr-2005";
                                //e:OTC_Payment//e:CashFlowId/text()' passing t.xml) x
    
    CASHFLOWID
    ------------------------------------------------------
    2005/12/200INTUSDUSD1006299M
    1 row selected.
    
  • Extract the value after the period

    Hello

    I am trying to extract the value from each period.

    I have the table data is stored in this mode 172.168.15.10, which is an IP address,.


    My requirement is I need to first value in a query with must return 172
    If I need the value after the second period, it should return 168


    Please suggest me how to write a SQL for the above requirement and oracle 11i Enterprise edition as the database.


    Thank you
    Sudhir

    with regexp

    select
      regexp_substr('172.168.15.10', '\d+', 1, :pos) s
    from dual
    

    without regexp

    select
      substr(s
            , instr(s, '.', 1, :pos) +1
            , instr(s, '.', 1, :pos + 1) - instr(s, '.', 1, :pos) -1
      ) s
    from (select '.'||'172.168.15.10'||'.'
     s  from dual)
    

    Edited by: chris227 the 01.10.2012 01:23

  • How im can extract the value of the persistence of virtual machine disk?

    Dear friends

    How im can extract the value of the value of the persistence of disks of virtual machines?

    IM using the bellows of the order, I have a if to check if the disks are independent or not

    but im only want values of the persistence of the column to use in my script

    Get-disk hard - vm machine01

    CapacityGB persistence Filename

    ----------      -----------                                                    --------

    10 000 persistent [LUN2] RJ7469SR039/RJ7469SR039.vmdk

    8 000 persistent [rate2] RJ7469SR039/RJ7469SR039_1.vmdk

    Thank you

    Almir

    In your example, you just use Select-Object

    Get-disk hard - vm machine01 | Select the Parent, persistence

    The parent is the name of the virtual machine

  • Extract the value of the node with multiple namespace xml

    Hello

    I have to extract values in xml that includes several namepspaces. a single namespace has value of xmlns. I managed to get the value of the node for tag event where as info tag returns null.

    experrts need help.

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

    < event xmlns = " " http://www.w3.org/2001/XMLSchema-instance ' >

    < data xmlns = ">

    < object >

    < eventtype > 110 < / eventtype >

    < result > < / result >

    < / object > < / data >

    < xmlns = info "> < jref > JREF < / jref >

    < / info >

    < / event >

    SELECT

    TMX.eventtype,

    TMX.result,

    TMX.jref

    of EXAMPLE_MESSAGES1.

    XMLTABLE (XMLNAMESPACES (DEFAULT 'http://www.w3.org/2001/XMLSchema-instance'), )

    ' for $i in/event/data/object

    Returns the local item: r {$i / eventtype,}

    $i / result.

    {$i / jref}'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH "eventtype"

    RESULT VARCHAR2 (30) PATH 'result ',.

    TMX JREF PATH VARCHAR2 (30) 'jref');

    Version of the database is 11.2.0.3.0

    Hello

    I have to extract values in xml that includes several namepspaces.

    There is only one workspace names in fact (the default value).

    Normally, an empty xmlns UN-declare a default namespace declaration is inherited from the parent node.

    So, in your example, only node belongs to the default namespace.

    In this case, when you have to walk through the nodes belonging to some namespaces and others in any namespace, do not use the DEFAULT option in the WITH XMLNAMESPACES.

    Instead, declare a prefix and use it as needed for qualify of nodes.

    Another thing:

    Returns the local item: r {$i / eventtype,}

    What what do you want with "local:" here?

    The following should give the expected results:

    SELECT TMX.*

    of EXAMPLE_MESSAGES1

    XMLTABLE)

    XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema-instance" as "ns0")

    , ' / ns0:event'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH 'data, object, eventtype.

    , RESULT VARCHAR2 (30) PATH ' object/data/result '.

    , PATH of VARCHAR2 (30) JREF ' info/jref.

    ) TMX;

  • ID - value in XML format. How to extract the value based on the id?

    Hello

    I have a XML type

    < root >
    < resource >
    < id > 123 / < ID >
    < value > CBA < / value >
    < / resource >
    < resource >
    < id > 456 / < ID >
    def < value > < / value >
    < / resource >
    < / root >

    It is stored in a column of XMLTYPE as a CLOB.

    Now, I want to get a particular value based on one id.

    I tried to use the following syntax

    ([Select case when existsnode(x.XML_CLOB,'/Root/Resource[Id="123"]') = 1
    then extractValue(x.XML_CLOB,'/Root/Resource/Value')

    but "/ Root / / value of resource" can mean either of the 2 values. How to solve this?

    Hello

    If the element 'id' is unique you just specify XPath to the 'value' on the basis of extractvalue (given that you are pregnant of a single node):

    WITH x AS (
     SELECT xmltype(
     '
     123abc
     456def
     '
     ) xml_clob
     FROM dual
    )
    SELECT extractvalue(x.xml_clob, 'root/resource[id="123"]/value')
    FROM x
    WHERE ...
    ;
    
  • Extract the value of an xml file (LPX-00601: invalid token)

    Hello

    I have this kind of XML / example...

    declare
        l_clob clob;
        l_xml xmltype;
    
    
    begin
        l_clob := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fu="http://www.fu.gov.si/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <soapenv:Body>
            <fu:BusinessPremiseResponse Id="data">
                <fu:Header>
                    <fu:DateTime>2015-10-02T10:56:40.416Z</fu:DateTime>
                    <fu:MessageID>2107C422-FC85-291C-E053-0CC910AC3C4F</fu:MessageID>
                </fu:Header>
                <fu:Error>
                    <fu:ErrorCode>S001</fu:ErrorCode>
                    <fu:ErrorMessage>eriworwiweorioweriorio</fu:ErrorMessage>
                </fu:Error>
            </fu:BusinessPremiseResponse>
        </soapenv:Body>
    </soapenv:Envelope>
    ';
     l_xml := xmltype(l_clob);
      put_xl_line(l_xml.extract('/soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode/text()','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"').getStringVal());
    
    end;
    

    what I want is to extract the /soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode

    I get this kind of error:

    ORA-31011: XML parsing failed

    ORA-19202: an error has occurred in the processing of XML

    LPX-00601: token not valid in: ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    ORA-06512: at "SYS." XMLTYPE", line 107

    ORA-06512: at line 23

    Thank you

    Hi Peter,.

    What is your version of db?

    EXTRACT and related functions are all deprecated from 11.2.

    Use XMLTABLE or XMLQUERY.

    About the error:

    You have the XPath to the right, but missing the mapping prefix of "fu":

    (l_xml). Extract

    ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    "', ' xmlns:soapenv ="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:Fu ="http://www.fu.gov.si/" "."

    )

    Example with XMLTABLE:

    declare
      l_clob        clob;
      l_error_code  varchar2(30);
    begin
      l_clob := '
        
            
                
                    2015-10-02T10:56:40.416Z
                    2107C422-FC85-291C-E053-0CC910AC3C4F
                
                
                    S001
                    eriworwiweorioweriorio
                
            
        
    ';
    
      select errorcode
      into l_error_code
      from xmltable(
             xmlnamespaces(
               'http://schemas.xmlsoap.org/soap/envelope/' as "env"
             , default 'http://www.fu.gov.si/'
             )
           , '/env:Envelope/env:Body/BusinessPremiseResponse/Error'
             passing xmlparse(document l_clob)
             columns errorcode varchar2(30) path 'ErrorCode'
           ) ;
    
      dbms_output.put_line(l_error_code);
    
    end;
    /
    
  • Extract the value between the xml tags in the XML inside the BLOB field

    Hello

    I have a table that contains a BLOB column, this XML file to store column that received from an external source. Now for one of my needs. I need to read that value is the specific XML tag and create the entry in the database.

    Column name DataType
    IDNumber
    RecordBLOB OBJECT

    This is the XML code that is stored in the file inside the BLOB field format. XML below, I need go get AMC1234 there is after < itemName > text < / itemName > I thought to use XMLTYPE, but unfortunately my DBA team does not XML database, I now use UTL_RAW. CAST_TO_VARCHAR2 and recovery entire string, but I am not able to read actual result it takes. Can someone help me remove AMC1234.

    <? XML version = "1.0"? >

    <! DOCTYPE importFile SYSTEM "xyz.dtd" >

    -< importFile >

    -< importResult >

    < mode status = "DΘFINIR" > general failure < / status >

    < statusCode > 1 < / statusCode >

    invalid < errorMsg > list and holiday component < / errorMsg >

    -< returnInfo >

    < itemName > PRQ < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > LMP < / itemName >

    < Valeurelement > CBA < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > KEY < / itemName >

    < Valeurelement > 9999 < / Valeurelement >

    < / returnInfo >

    -< returnInfo >

    < itemName > text < / itemName >

    < Valeurelement > AMC1234, FIXED_ALL, RED < / Valeurelement >

    < / returnInfo >

    < / importResult >

    < / importFile >


    Thank you

    Without

    Without - try something like...

    with t as (select"

    -

    -

    General failure

    1

    component and invalid vacation list

    -

    PRQ

    ABC

    -

    LMP

    ABC

    -

    KEY

    9999

    -

    Text

    AMC1234, FIXED_ALL, RED

    "the double pass."

    )

    Select Replace (regexp_substr (col,'([^<>']) itemName))

    , replace (regexp_substr (col,'([^<>""]) Valeurelement))

    t

    connection of level <=> ');

  • XMLTABLE - how to extract the value of the escape of a node as-is sequence

    Hello

    How can I me XMLTABLE leave the string value of a node like the version with escape sequence, rather than unescaping it?

    E.g.:
    select extract(xmltype('<root><test>&lt;unset&gt;</test></root>'), '/root/test/text()').getstringval() col1 from dual
    union all
    select col1
    from   xmltable('/root' passing xmltype('<root><test>&lt;unset&gt;</test></root>')
                    columns
                    col1 varchar2(20) path 'test');
    
    COL1                                                                            
    ---------------------
    &lt;unset&gt;                                                                   
    <unset>     
    NB. you will need to hit rΘpondre α and then quote my post to see the actual text; For the life of me, I can't get the forum properly displays things. In short, the string returned by the EXTRACT is escaped, while the XMLTABLE chain is unescaped.


    ETA: I looked through the standards xml from the list of available functions, and nothing seems relevant. {noformat} * scratches head * {noformat}

    Published by: Boneist on March 19, 2013 14:11

    You can emulate what do I EXTRACT / getStringVal () by projecting the node text() as XMLType and type-casting to VARCHAR2 in the SELECT clause:

    SQL> set scan off
    SQL>
    SQL> select cast(col1 as varchar2(20))
      2  from xmltable(
      3         '/root'
      4         passing xmltype('<unset>')
      5           columns col1 xmltype path 'test/text()'
      6       ) ;
    
    CAST(COL1ASVARCHAR2(20))
    ------------------------
    <unset>
     
    
  • extract the value between the _ or until the end

    Hello

    I was trying to extract a value from format using regexp_substr below. But I don't know how to use the REGEXP_SUBSTR for this. Can someone please help on this.

    STRING

    ORACLE_TECHNOLOGY

    ORACLE_TECHNOLOGY_NETWORK

    ORACLE_TECHNOLOGY_NETWORK_INDIA

    output:

    TECHNOLOGY

    So, what can be the input string, the output should be the string between the 1st and 2nd underscore (_). If missing the 2nd terms underscore (_), then it should give to the end.

    My version of oracle's 11g.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    "CORE 11.2.0.3.0 Production."

    AMT for 64-bit Windows: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    regexp_substr (String, ' _ ([^ _] *)(_|$)', 1, 1, null, 1)

    or

    substr (String, instr (string, '_') + 1, decode (instr (string, '_', 1, 2), 0, Length - instr (string, '_', 1, 2), instr (string, '_', 1, 2) - instr (string, '_', 1, 1) - 1))

  • Refresh the report area of PL/SQL (not Page) using the value of the select list

    Hello

    I have a report region based on a "body of the PL/SQL function returning a query'which SQL is generated on the selection of a value of an element from the selection list, select action list is"Redirect and set", but this causes the entire page refresh rather than just the region report." I tried to update the report using only a dynamic action on the item list select (Action now reset to 'None'), but now the report does not appear on the choice of the list. Can someone suggest a solution that will allow me to update this report without refreshing the page? I use APEX 4.2.2 and the syntax of the statement is as follows:

    DECLARE

    v_statement VARCHAR2 (500);

    BEGIN

    SELECT query_text
    IN v_statement
    OF sql_queries
    WHERE query_id =: P2_QUERY;

    RETURN v_statement;

    END;

    where P2_QUERY is Select list item,

    Kind regards

    Kevin.

    KevinFitz wrote:

    The displayed report region is subordinate to the point P2_QUERY is NOT NULL. I guess that the region appears not is because the Action for the select list item is set to None, and so P2_QUERY is always NULL.

    No, the region does not appear because it is subordinated to the P2_QUERY being NOT NULL. This means that the region of report never exists on the page displayed in the browser, so it cannot be updated dynamically. (Dynamic updating is not to evaluate the conditions of the region, and she makes only the content of the report, not the whole region again).

    Remove the condition on the region to report, check the update works and then go back on what exactly are the requirements here. If you want to the area appear only when P2_QUERY has a value, and you want it to be regenerated without submitting and reposting of the page, the region must then be hidden rather than conditionally restored and shown via dynamic when action P2_QUERY Gets a value.

    I tried to add a further Action for the event real value DA but has been a mistake, as stated above,

    All irrelevant if Page to submit items on the region is used correctly.

  • to change the pl/sql block to get the value of the user

    In this code rather than affect the value of the SID in the block, I want to get the sid of the user.

    Help, please.

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    declare

    v_sname t1.sname%type;

    v_issue_date t3.issue_date%type;

    v_book_title t2.book_title%type;

    v_book_id t2.book_id%type;

    cursor c1 is

    Select t1.sname, t3.issue_date, t2.book_title, book_id

    join T1 T3

    using (SID)

    Join t2

    using (book_id)

    where sid = 1;

    Start

    Open c1

    loop

    dbms_output.put_line (v_sname |) » '  || v_issue_date | » '  || v_book_title | ' ' || v_book_id);

    extract the c1 in v_sname, v_issue_date, v_book_title, v_book_id;

    When exit c1% notfound;

    end loop;

    Close c1;

    end;

    /

    Thank you

    If I set up a script that I want to pass a value, I just a configuration variable and name it and use it very similar to a procedure or function. Makes it easy to implement a procedure/function, or to convert a function/procedure in a PL/SQL block for test/debugging with relatively few changes to the code inside:

    declare
       in_sid  number  := to_number('&1');
    
       v_sname t1.sname%type;
       v_issue_date t3.issue_date%type;
       v_book_title t2.book_title%type;
       v_book_id t2.book_id%type;
       cursor c1 is
          select t1.sname, t3.issue_date, t2.book_title, book_id
          from t1 join t3
          using(sid)
          join t2
          using(book_id)
          where sid=in_sid;
    begin
       open c1
       loop
          dbms_output.put_line( v_sname ||' '  || v_issue_date ||' '  || v_book_title || ' ' || v_book_id);
          fetch c1 into v_sname, v_issue_date, v_book_title, v_book_id;
          exit when c1%notfound;
       end loop;
       close c1;
    end;
    /
    
  • How to extract the values of column aliases based on different column values?

    Hello gurus,

    I have a table with the following struture-
    "drop table T;
    create table T(Name, Symbol, Amount,dep) as select
    'Anderia', 'AA', 1050000,'HR' from dual union all select
    'Michael', 'ML',150000,'Sales' from DUAL union all select
    'Bill', 'BL', 1050000,'Finance' from dual union all select
    'Nancy', 'NY', 4000,'HR' from DUAL union all select
    'Anderia', 'AA',3000,'HR' from dual union all select
    'Michael', 'ML',1050000,'Sales' from DUAL union all select
    'Bill', 'BL', 1200000,'Finance' from DUAL union all select
    'Anderia', 'AA', 1200000,'HR' from DUAL union all select
    'Vish', 'VH', 1200000,'Marketing' from DUAL;"
    And try to find the values of the column as
    Name, symbol, dep, amount, % Total, Total $Cumm, rank but some additional as-columns

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total

    then I use the following query to retrieve the name, the symbol, the dep, amount, % Total, Total $Cumm, rank columns.
    select name
         , decode(grouping(symbol), 0, symbol, 'Total') symbol
         , dep
         , sum(amount) amount
         , sum(per_total) "% Total"
         , decode(grouping(symbol), 0, max(Cum_per_total), null) "% Cumm Total"
         , decode(grouping(symbol), 0, max(rank), null) rank
      from (
              select name
                   , symbol
                , dep
                   , amount
                   , per_total 
                   , sum(per_total) over(order by rk) cum_per_total
                   , rank
                   , rk
                from (     
                        select name
                             , symbol
                    , dep
                             , sum(amount) amount
                             , round((sum(amount)/max(total_amount)) * 100,2) per_total
                             , dense_rank () over (order by sum(amount) desc) as rank
                             , row_number() over(order by sum(amount) desc) as rk
                          from (
                                 select name
                                      , symbol
                                      , amount
                          , dep
                                      , sum(amount) over() total_amount 
                                      , sum(amount) over () 
                                   from t
                               )
                         group 
                            by name, symbol, dep
                    )
            )
      group         
         by grouping sets((name, symbol, dep), ())
      order by rank, max(rk) nulls last
    But I want to extract the following columns so... How can I do?

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total


    as I want that all records, then will the dep..do-specific I need to use the case here?
    Thanks for all your time and effort in advance

    If I understand your needs, you need pivot: SQL and PL/SQL FAQ

  • Extract the value of the ring of text created by program

    Hello

    I have a spreadsheet I need to extract a single line. The first column of the worksheet has non-espacees values of time and feed these time values in a property node that is introduced in the Strings [] of a ringtone text indicator property node. The purpose of this is because I want the user to select only time for which the data were collected and, ideally, the zero point of time in the list corresponds to the zero line.

    However, when the user selects an element of the ring of text, the control passes the chain selected and not the associated value, despite the use of the "Value" property node You have any idea why this is happening? I know I could use the table 1 d of research VI to solve this problem, but I'm more interested in why it does not work. I have attached a few example data as well as the VI in question for reference. Thank you very much for your help!

    EDIT: It seems that this can explained by the fact the string, I am animals in the field [] of strings are numbers. When I did, I swapped the hours with random text strings, it works beautifully. Curious and curious...

    Jeff and Nathand,

    Thank you both for your responses. In fact, I was just able to solve the problem on mine in Exchange for the VI of subset of table with the Index of table VI. It works perfectly now, even with the values not assigned (even if it's an excellent suggestion, Jeff). Nathand, in which your question, select the indicator that I had attached to the control time no was not to display the value (0,1,2...) than I expected but the character string chosen itself, (-800,-750...) which confused me into thinking that something was wrong. I have attached the fixed VI for reference.

Maybe you are looking for

  • Device not found, but internet work

    I have an Airport extreme with a capsule 2 TB that I use as a backup file. All of a sudden I can't connect to the airport time capsule. When I launch the airport utility, there is an orange triangle/exclamation point that fits the description "device

  • Re: My Satellite laptop will not load to the top

    Hello My laptop isn't even a year yet, it worked fine until today.I turn it on and the bit of Toshiba comes up then after that it of just a black screen and then it says Realtek rtl810ie/8102e pci-e ethernet controller v1.07 (080320)PXE - e61 media t

  • HP 15 Notebook: Keys F in Microsoft Word

    I'm taking a class on Microsoft Word 2013 and my book says that F9 should recalculate a formula and F4 repeat last function (insert a formula into a table cell), but it does not work with my laptop. Is there a combination of keys I can use to make it

  • How to convert string data from the serial port to double?

    Hello! I am very new in LabView and attempt to read data from an OHAUS pioneer pa-313 electronic scale via RS232 serial port. I use the VISA. I can read the data and see it as a string to the screen, but when I try to convert it to a double, it is ju

  • I ve a intel windows 7 and an imac, how to share files between them?

    Although sharing printer is working very well. I am unable to share files