selection column of the table xml data type

Hello.
I tried the following example with xml as column name data type
create table emp_detail( empno number,ename varchar2(32),empdetails sys.xmltype)

Insert into EMP_DETAIL
   (EMPNO, ENAME, EMPDETAILS)
 Values
   (1, 'satya', XMLTYPE('<NAME>
  <FIRSTNAME>SATYA</FIRSTNAME>
  <LASTNAME>SREE</LASTNAME>
  <LOC>SECBAD</LOC>
</NAME>
'));
Insert into EMP_DETAIL
   (EMPNO, ENAME, EMPDETAILS)
 Values
   (2, 'jo', XMLTYPE('<NAME>
  <FIRSTNAME>JO</FIRSTNAME>
  <LASTNAME>REDDY</LASTNAME>
  <LOC>MYPR</LOC>
</NAME>
'));
So, after that I tried this query to retrieve the State of an attribute data.
SELECT a.empdetails.extract('//NAME/text()').getStringVal() AS "Table Name"
FROM   emp_detail a
WHERE  a.empdetails.existsNode('/NAME')  = 1;
But those who above indicates no record...
Why?


Thank you
SQL>  SELECT a.empdetails.extract('//NAME/FIRSTNAME/text()').getStringVal() AS "first_name",
  2     a.empdetails.extract('//NAME/LASTNAME/text()').getStringVal() AS "last_name",
  3     a.empdetails.extract('//NAME/LOC/text()').getStringVal() AS "loc"
  4     FROM emp_detail a
  5    WHERE a.empdetails.existsNode('/NAME')  = 1;

first_name           last_name            loc
-------------------- -------------------- --------------------
SATYA                SREE                 SECBAD
JO                   REDDY                MYPR

Tags: Database

Similar Questions

  • using a column having the nvl char data type...

    The entity table has 4 records with 'X' account status and 42 records with account_status with null.

    Select * entity where nvl (account_status, 'X') = 'X '.

    When I run the query above, must be extracted all 46 records but only 42 records with only statement null is read.

    Also when I run the query below

    Select * entity where nvl(account_status,'T') = 'X '. No line is fethced.

    The account_status column is char data type.

    When I use the same type of query with a number data type column it works correctly.

    NVL work differently for the char data will type column? Could someone help me on this? I don't know if I am wrong anywhere.

    vesrion of Oracle that I use here is Oracle 10 g.

    Hello

    SELECT * ENTITY WHERE NVL (UPPER (TRIM (ACCOUNT_STATUS)), 'X') = 'X '.

    Check the empty space in the field you are trying to cut.

    Thank you

  • Reg. decimal alignment in selected columns in a Table

    Hi all

    Can someone help me to align the cells in the selected column of the table in decimal?

    Thank you in advance.

    Kind regards

    Rani Sathya M

    Hello

    As Ariel wrote, in the case of table you need not type "tabs" within cells to achieve a goal.

    Here is an example of the last column setting

    var
         mCols = app.activeDocument.textFrames[0].tables[0].columns[-1],
         mTarget = mCols.cells.everyItem().texts.everyItem().getElements(),
         len = mTarget.length;
    while (len-->0)
              mTarget[len].tabStops.add({
                        alignment: TabStopAlignment.CHARACTER_ALIGN,
                        alignmentCharacter: ".",
                        position: mCols.width - 10
                        });
    

    Notice: it should work in a simple doc for example (1 textFrame and 1 table)

    Jarek

  • Select this OPTION to generate XML data from the table using XMLELEMENT, XMLAGG gives error ORA-19011 string buffer too small

    My select statement fails with the error:


    The ORA-19011 string buffer too small


    The select statement looks like:


    SELECT TO_CLOB)

    XMLELEMENT ("accounts",

    XMLELEMENT ("count",

    XMLATTRIBUTES)

    rownum AS "recordId."

    To_date('20130520','YYYYMMDD') AS "datestarted."

    123456 AS "previousBatchId."

    56789 AS 'previousRecordId '.

    ),

    ....

    .... .

    .....

    XMLFOREST)

    SIG_ROLE AS "SignatoryRole."

    To_char(TRANSFER_DATE,'YYYY-mm-DD') AS "TransferDate."

    NVL(Reason,0) AS 'reason '.

    ) AS the 'transfer '.

    )

    ()) AS CRDTRPT

    OF ANY_TABLE;

    • It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    I'd use the XMLGEN package. But the environment team says no mounted drives in the future with the arrival of the EXADATA.

    NO HARD DRIVE MOUNTED, NO ACCESS TO THE DATABASE DIRECTORIES

    No UTL_FILE

    I need to use the REEL spool the resulting XML data of the SELECT query.

    SQL is a standard in my org, but I can do with a PL/SQL solution also to load data into a table (cannot use a COIL with PL/SQL)

    What I do is:

    1. a column of type CLOB to a xml_report of the loading of the above SELECT query table
    2. Then using SELECT * FROM xml_report to SPOOL the data to a file report.xml

    No need of XMLTYPE data behind. Xml data stream is fine for me.

    In addition, I need to validate the XML file, also using XSD.

    Problem is that the resulting lines of the select query are supposed to be from 15000 to 20000 bytes long.

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

    A Suggestion or a solution to this problem would be appreciated.

    (Sorry for the use of "BOLD", just to make it more readable and highlight the imp points)

    Bravo!

    Rahul

    It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    You use the right method.

    There is an implicit conversion from XMLType to the data type VARCHAR2 as expected by the function TO_CLOB, where the limitation, and the error.

    To serialize XMLType to CLOB, use the XMLSerialize function:

    SELECT XMLSerialize (DOCUMENT

    XMLELEMENT ("accounts",

    ...

    )

    )

    OF ANY_TABLE;

    For the rest of the requirement, I wish you good luck trying to spool the XML correctly.

    You may need to play around with the SET LONG and SET LONGCHUNKSIZE commands to operate.

  • Table design for the newspaper error due to a xml data type

    Hello

    I am trying to create a table of error log, but I get the below error

    ORA-20069: unsupported column or the types found:

    Table on which I am trying to create a column with the xml data type.

    Is there a way to create the error table for tables with the XML data type.

    Thank you

    PAL

    http://docs.Oracle.com/CD/E11882_01/server.112/e41084/statements_9014.htm#SQLRF55101

    Concerning

    Etbin

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e40758/d_errlog.htm#ARPLS680

    Look at the skip_unsupported setting

  • Impossible to extract the data of an additional column in the table advance

    Hello

    We have an obligation to add an extra column to the table of advanced search. In addition, we need sort the table using this additional column.

    Now, we have achieved the following:

    1. the required VO was already extended previously and the additional column (LAST_UPDATE_DATE) is already present in the definition of the EO. So, we just added the tag for LAST_UPDATE_DATE in YOUR XML in the form:

    < ViewAttribute

    Name = "LAST_UPDATE_DATE".

    IsPersistent = "false".

    Type = "Oracle.jbo.domain.date"

    ColumnType = "DATE".

    AliasName = 'LAST_UPDATE_DATE. '

    Expression = "LAST_UPDATE_DATE."

    SQLType = 'DATE' >

    < / ViewAttribute >

    2 added a new MessageStyledText column, and updated the following property:

    Prompt = LastUpdateDate. Discover the Instance = TaskPerzSumVO. Display attribute = LAST_UPDATE_DATE. Sort Allowed = true

    The field is now visible in table advance and whenever we seek, attaches the value as ' 1901-01-01'. While I checked manually in the respective table, we have the appropriate data. But in the front end we do not get the data in our additional column of table in advance. In addition, if we try to sort the table by clicking the column LAST_UPDATE_DATE, we get the NPE error. Spec of NullPointerException is as follows:

    # # 0 in detail

    1. java.lang.NullPointerException

    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:989)

    Kindly help us to obtain the appropriate data in the additional column. Thank you!

    Kind regards

    Zahid

    Hi Zahid,

    This is the error:

    29000: unexpected exception caught: oracle.jbo.NoObjException, msg = Houston-25003: TaskEO.LAST_UPDATE_DATE object of type entity activity not found

    Tag entity by its use should have only name of EO and not the name of the attribute.

    Use instead under the tag:

    EntityUsage = "TaskEO".

    Also, I mentioned that rather tags manually, add it please try Wizard VO to add this attribute in EO attributes available list.

  • How to extract data using the xml data type

    Hello
    I tried the following example using the xml data type, but not the desired output.
    could you please correct the query in order to obtain the necessary
    CREATE TABLE TEST.EMP_DETAIL
    (
      EMPNO       NUMBER,
      ENAME       VARCHAR2(32 BYTE),
      EMPDETAILS  SYS.XMLTYPE
    )
    Insert into EMP_DETAIL
       (EMPNO, ENAME, EMPDETAILS)
     Values
       (7, 'Martin', XMLTYPE('<Dept>
      <Emp Empid="1">
        <EmpName>Kevin</EmpName>
        <Empno>50</Empno>
        <DOJ>20092008</DOJ>
        <Grade>E3</Grade>
        <Sal>3000</Sal>
      </Emp>
      <Emp Empid="2">
        <EmpName>Coster</EmpName>
        <Empno>60</Empno>
        <DOJ>01092008</DOJ>
        <Grade>E1</Grade>
        <Sal>1000</Sal>
      </Emp>
      <Emp Empid="3">
        <EmpName>Samuel</EmpName>
        <Empno>70</Empno>
        <DOJ>10052008</DOJ>
        <Grade>E2</Grade>
        <Sal>2530</Sal>
      </Emp>
      <Emp Empid="4">
        <EmpName>Dev</EmpName>
        <Empno>80</Empno>
        <DOJ>10032007</DOJ>
        <Grade>E2</Grade>
        <Sal>1200</Sal>
      </Emp>
    </Dept>
    '));
    I need to get the record for Empid = '2'
    Then tried the following query with no expected o/p
    SELECT a.empno,a.ename,a.empdetails.extract('//Dept/Emp/EmpName/text()').getStringVal() AS "EmpNAME",
         a.empdetails.extract('//Dept/Emp/Empno/text()').getStringVal() AS "EMPNumber",
          a.empdetails.extract('//Dept/Emp/DOJ/text()').getStringVal() AS "DOJ",
          a.empdetails.extract('//Dept/Emp/Grade/text()').getStringVal() AS "Grade",
          a.empdetails.extract('//Dept/Emp/Sal/text()').getStringVal() AS "Salary",
          a.empdetails.extract('//Dept/Emp[@Empid="2"]').getStringVal() AS "ID",
          a.empdetails.extract('//Dept/Emp[EmpName="Coster"]').getStringVal() AS "CHK"
         FROM emp_detail a 
         where empno=7  
               AND a.empdetails.existsNode('//Dept/Emp[@Empid="2"]') =1
    Thank you...

    Karthick_Arp wrote:
    I'm not very good at that... But if your XML code should not be more like this

    SQL> Insert into EMP_DETAIL
    2     (EMPNO, ENAME, EMPDETAILS)
    3   Values
    4     (7, 'Martin', XMLTYPE('
    5    
    6      1
    7      Kevin
    8      50
    9      20092008
    10      E3
    11      3000
    12    
    .. cut ..
    

    Why? It is perfectly valid to data as attributes rather than elements and also quite common for key values.

  • How to get only latest date and other columns in the table

    Hello
    Table
     
       id          name        date
      123        a             2/3/2010
      124        b            15/2/2010
      125        c             1/1/2010
      123        a             12/4/2010
      125        c             17/2/2010
    
     
    It's a table, id, name, date here is the composite key.
    I want to select id, name, and date so that date (e.g., 123 date 04/12/2010 be selected for the id) is selected for each id and each id and name should be selected once.
    So, what will be its application?
    Thank you
    select
       id,
       name,
       date
    from
    (
       select
          id,
          name,
          date,
          max(date) over (partition by id, name) as max_date
       from your_table
    )
    where date = max_date;
    

    Would do assuming you do not have duplicates (all 3 columns) in the table.

  • Regd select the column in the table area

    Hello

    I have a search page... Have used autocustomization to create... This page will be used to query data from a table and then we must also update two fields of results table and save.

    There is a region of results. I've included the multiselect table option that made me select a column as the first column of the table. Also, including a tableaction and a button upate with whom...

    I need to write a handler for the update now... but do not understand all the slect column...

    Whenever a user clicks on the boxes to select specific records and change the fields and click Update to save, how to write code to check whether the checkbox option has been activated or not?


    Please help me as soon as possible...


    Kind regards
    Preeti

    Hello

    Take a Transient attribute tell 'SelectFlag' in view object and to set the Instance of the view and the view attribute
    for multipleselection in the table.

    Now that the update is click on the button:

    If (PageContext.GetParameter ("Update")! = null)
    {
    OAApplicationModule am = pageContext.getApplicationModule (webBean);
    OAViewObject vo = (OAViewObject) am.findViewObject ("projVO1");
    Line [] row = vo.getAllRowsInRange ();
    Loop through lines
    for (int i = 0; i)<>
    {
    Check if checbox is checked or not
    If (line.getAttribute("SelectFlag").toString().equals("Y"))//means checbox is checked for this line.
    {
    write your logic
    }
    }
    }

    Thank you
    Gerard

  • Error when selecting all the columns in the table

    Hi all

    When I write a query by selecting all the columns of the table fromo using * function as well as another new column, I get the error,

    Select *, to_char (hiredate, 'fmday') day

    WCP

    where to_char (hiredate, 'fmday') ('Monday');

    ERROR on line 1:

    ORA-00923: THE KEYWORD not found where expected

    I need all the columns in the table with the column user-defined 'day '. Is there a way I can get the result like this?

    Hello

    padders wrote:

    Alias table to use...

    Or the name of the table, for example

    Select emp.*, to_char (hiredate, "fmday") as day

    WCP

    where to_char (hiredate, 'fmday') ('Monday');

    The bottom line is that * must be qualified (with a table name or alias) when the SELECT clause includes anything else besides *.

  • Select all checkboxes in the column of the table during the 11 G radio button click

    Hello

    I have a table where I inserted a checkbox in the column of the table. I have two outside this table option button, Yes and no. When I select the option button Yes all the boxes in the table to spread and when I select any option button all the boxes should get deselected. As the boxes are inside the columns of the table, we can use setSelected(). How to do this please give ideas.



    Thank you.

    Hi, Maxim,.

    Is your table based on a view object or some bean code?
    If it is based on the view object, the column Boolean checkbox is bound to some transient attribute?

    Have you tried view iteration object rows (if your table bound to viewobject) /POJO(if created list of pojo instances in bean and bound to table) and by setting the Boolean attribute related to the box to true/false on valueChangeListener option button?

    Can you post an example of code to get an idea of your problem?

    Jean Lou

    Published by: Israel Jean Lou on October 24, 2009 04:50

  • to retrieve data from xml data type

    Hello...
    I have a doubt in the oracle database... Here's how to retrieve data from xml data type?

    Like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
    3 4 toMonth5 5 ctTestPan1 6 costType2 7 toYear2012 8 fromMonth12 9 fromYear2011 10 11
    ') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.
  • Toggle buttons control according to the selected line in the table?

    Hello

    I have used JDev 11.1.1.2.0

    On my main page, it has a query section and view the result to a component of the lookup table and also has functioning as (update/deletion) buttons in the toolbar.

    I want to toggle buttons operating according to some value of the selected line in the table, and I searched on the OTN forum, found more than issues like that, but seemed no found a good solution.

    The table is a unique and has a status column selection, its data type is integer, and I want to activate the buttons when the value of the status field of the selected line is 0 or 1, disable the buttons when the State value is other values.

    Code of the table as:

    < af:table value = "#{bindings." Var VO1.collectionModel}"="row ".
    lines = ' #{bindings. " VO1.rangeSize}.
    emptyText = "#{bindingsVO1.viewable?" '} ". No data to display. ': 'Access Denied. »} »
    fetchSize = "#{bindings." VO1.rangeSize}.
    rowBandingInterval = '0 '.
    filterModel = "#{bindings." VOCriteriaQuery.queryDescriptor}.
    queryListener = ' #{bindings. " VOCriteriaQuery.processQuery}.
    filterVisible = "true" varStatus = "vs."
    selectedRowKeys = ' #{bindings. " VO1.collectionModel.selectedRow}.
    selectionListener = "#{bindings." VO1.collectionModel.makeCurrent}.
    rowSelection = "single" id = "resId1" >

    Operation code buttons like:
    < af:commandToolbarButton text = "Update" id = "ctb2" action = "editDAF" / >

    Any suggestions would be very helpful.

    Thank you
    zeroxin

    Hello

    bind to the attribute in the PageDef file for the status field. Then configure the PartialTriggers property button to point to the ID of the table. Of the disabled button property then points to the status as attribute link

    #{bindings.statusField.inputValue == 'value'}

    Frank

  • display / hide column of the table running

    Are there known issues with display / hide a column of the table at run time?

    I have a table that contains a column with a check box and another with a radio button.  If the user is allowed to select more than one row in the table (as indicated by a form variable), then I want to hide the column of radio and checkbox column.  If not, I want to show / hide the contrary.

    I show / hide the column header too.  When I preview the form, however, the data in the table appears "scoot" left and placed in the column that is hidden, so to speak.

    Here is a view of the design of the table:

    tableDesignView.jpg

    And a view of the execution of the table.  You can see the radio is hidden, but the "account number" column wants to crush in the (hidden) radio column,

    tableRunTimeView.jpg

    Here is the script, I'm very confident in this small snippet of code because the lines of account were filling wonderfully until I added the column of radio buttons and the script to show/hide.

    Put the account data in the table

    function

    setAccountData (objAccountRow, objAccountItem) //Pass in the line and data to complete line

    {

    stuff the line

    objAccountRow.accountNumber.rawValue

    = objAccountItem.accountNumber;

    objAccountRow.accountName.rawValue

    = objAccountItem.accountName;

    objAccountRow.accountBalance.rawValue

    = objAccountItem.accountBalance;

    display the check box or radio button, depending on the number of accounts they are allowed to select (as specified by the form variable)

    var searchNumAccounts = objFragment.resolveNode("searchNumAccounts").value; Variable //Form

        if (searchNumAccounts==1)

    { //show the column of radio buttons and hide the checkbox column }

    hideObject (objResultsSubform.accounts.HeaderRow.txtSelect);   <-it's exaggerated here, to hide the table for each row header column,...

    hideObject (objAccountRow.accountSelected);

    showObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    showObject (objAccountRow.radioSubform.radioGroup.selected);

    }

    on the other

    { //show the checkbox column and hide the column of radio }

    hideObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

    hideObject (objAccountRow.radioSubform.radioGroup.selected);

    showObject (objResultsSubform.accounts.HeaderRow.txtSelect);

    showObject (objAccountRow.accountSelected);

    }

    }

    OK I got it. The table object implements a container to contain the fields. You hid the ok fields, but you then never reset the row in the table to have only two columns. I copied the parameter of the XML source so that I would have the exact width and then deleted the one I wanted to hide. Now everything works fine.

    See the example updated the.

    Paul

  • ADF: Columns of the Table filtering problem

    Hello

    My Version of JDeveloper is 11.1.1.5

    I am facing a problem with the filter of the table...

    Is it possible to implement the feature of research on filtering only on af:table with panelCollection?

    Could someone help me please in this?

    I need Research* not only the filtering of the data inside the table with the facet of the columns of the table filter...

    Can someone help me with this application?

    Many thanks in advance,

    Kind regards
    Anil

    Published by: 977652 on February 17, 2013 19:28

    Published by: 977652 on February 17, 2013 19:38

    You can just type in the filter like '% EBS' field and you will find your file.

    Timo

Maybe you are looking for