How to get the column name and table name from xml file
I have one XML file, I generated xsd file from that xml file but the problem is i dont know table name and column name. So my question is how can I retrieve the data from that xml file?
Here's an example using binary XML storage (instead of Object-Relational storage as described in the article).
begin
dbms_xmlschema.registerSchema(
schemaURL => 'my_schema.xsd'
, schemaDoc => xmltype(bfilename('TEST_DIR','my_schema.xsd'), nls_charset_id('AL32UTF8'))
, local => true
, genTypes => false
, genTables => true
, enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS
, options => dbms_xmlschema.REGISTER_BINARYXML
end;
genTables => true : means that a default schema-based XMLType table will be created during registration.
enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS : indicates that a repository resource conforming to the schema will be automatically stored in the default table.
If the schema is not annotated, the name of the default table is system-generated but derived from the root element name :
SQL> select table_name
2 from user_xml_tables
3 where xmlschema = 'my_schema.xsd'
4 and element_name = 'employee';
TABLE_NAME
employee1121_TAB
(warning : the name is case-sensitive)
To annotate the schema and control the naming, modify the content to :
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
<xs:element name="employee" xdb:defaultTable="EMPLOYEE_XML">
<xs:complexType>
Next step : create a resource, or just directly insert an XML document into the table.
Example of creating a resource :
declare
res boolean;
doc xmltype := xmltype(
'<employee>
<details>
<emp_id>1</emp_id>
<emp_name>SMITH</emp_name>
<emp_age>40</emp_age>
<emp_dept>10</emp_dept>
</details>
</employee>'
begin
res := dbms_xdb.CreateResource(
abspath => '/public/test.xml'
, data => doc
, schemaurl => 'my_schema.xsd'
, elem => 'employee'
end;
The resource has to be schema-based so that the default storage mechanism is triggered.
It could also be achieved if the document possesses an xsi:noNamespaceSchemaLocation attribute :
SQL> declare
2
3 res boolean;
4 doc xmltype := xmltype(
5 '<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:noNamespaceSchemaLocation="my_schema.xsd">
7 <details>
8 <emp_id>1</emp_id>
9 <emp_name>SMITH</emp_name>
10 <emp_age>40</emp_age>
11 <emp_dept>10</emp_dept>
12 </details>
13 </employee>'
14 );
15
16 begin
17 res := dbms_xdb.CreateResource(
18 abspath => '/public/test.xml'
19 , data => doc
20 );
21 end;
22 /
PL/SQL procedure successfully completed
SQL> set long 5000
SQL> select * from "employee1121_TAB";
SYS_NC_ROWINFO$
<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS
<details>
<emp_id>1</emp_id>
<emp_name>SMITH</emp_name>
<emp_age>40</emp_age>
<emp_dept>10</emp_dept>
</details>
</employee>
Then use XMLTABLE to shred the XML into relational format :
SQL> select x.*
2 from "employee1121_TAB" t
3 , xmltable('/employee/details'
4 passing t.object_value
5 columns emp_id integer path 'emp_id'
6 , emp_name varchar2(30) path 'emp_name'
7 ) x
8 ;
EMP_ID EMP_NAME
1 SMITH
Similar Messages
-
How to fix the column length and table length?
Hi Experts/Gurus,
I want to fix the column lenght so that if data exceeds it should be in the same colum. But the size of the table should not get changed.. I used the width property of both table and column. But its not working..
Regards,
YugeshHi Yugesh,
For column wrapping you can use the SET_WRAPPING of cl_salv_wd_header and the data.....you have got cell editor for that column right...then using the cell edtior reference you can get the specific cell tyep(like cl_salv_wd_text_view type check this)
this is object reference and you can use the set_wrapping of this class. using this you can get the wrapping functionality for the data also....
DATA: lr_column TYPE REF TO cl_salv_wd_column,
lr_column_header type ref to cl_salv_wd_header,
lr_editor type ref to cl_salv_wd_uie,
lr_textview type ref to cl_salv_wd_uie_text_view.
wd_this->alv_value->if_salv_wd_table_settings~set_fixed_table_layout( ABAP_TRUE ).
lr_column = wd_this->alv_value->if_salv_wd_column_settings~get_column( 'EDITION' ).
lr_column->set_width( '55' ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_wrapping( abap_true).
lr_editor = lr_column->get_cell_editor( ).
lr_textview ?= lr_editor.
lr_textview->set_wrapping( abap_true ).
Now for the column and it's data the wrapping is set...
Regards,
Lekha.
Edited by: Lekha on Nov 16, 2009 2:12 PM -
How to get the column name and table name with value
Hi All
I have one difficult requirement
I have some column values and they have given some alias column names but i need to find the correct column name and table name from the database.
For example value is "SRI" and i dont know the table and exact column name so is there any possibilities to find the column name and table name for the given value
Thanks & Regards
Srikkanth.MSearching all the database for a word...
Courtesy of michaels...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
11g upwards
SQL> select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('EMP', 'DEPT')),
xmltable (str columns result varchar2(10) path '.')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME es RESEARCH
EMP ENAME es JAMES
EMP JOB es SALESMAN
EMP JOB es SALESMAN
4 rows selected. -
How to get the column names of the table into the Dashboard prompt
how to get the column names of the table into the Dashboard prompt
Thanks & Regards
Kishore PHey john,
My requirement is as follows
I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
My pivot table looks like this
COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
---------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK REGION DOLLARS DOLLARS DOLLARS DOLLARS
1 CENTRAL 10 20 30 40
2 SOUTHERN 10 30 30 70
3 EASTERN 20 20 20 60
4 WESTERN 10 20 30 40
When i select the District in column selector
Report has to display rank based on Total Sales by District. i.e
------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK DISTRICT DOLLARS DOLLARS DOLLARS DOLLARS
for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
do you have any solution for this?
http://rapidshare.com/files/402337112/Presentation1.jpg.html
Thanks & Regards
Edited by: Kishore P on Jun 24, 2010 7:24 PM
Edited by: Kishore P on Jun 24, 2010 7:28 PM -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
How to get the column index inside a dataTable
Hello,
before I get staked, there are multiple threads handling familiar topics to the one I'm questioning about but none gives an anwer. If there is one, I'm propably to less skilled to see it.
So here is my Problem: I've build a web-interface to a time-recording system. The hours worked on a certain project are displayed in a dataTable component which is generated out of a mySQL Query. Each entry (column/row) contains a inputText component to display and edit the specific value.
Editing one of these inputText elements now fires a valueChangeEvent which reads the new value and stores it in the database. For that cause I need to know the row- and column-index of the inputText component that fired the event.
Using the getClientId method from the valueChangeEvent I get some Information which makes it possible to calculate the row/column index. A typical clientID looks like "form_table:mainTable:0:_id14". "form_table" is the ID of the form the dataTable is in. "mainTable" is the id of the dataTable component. "0" is the row the component is in. And finally "_id14" stands for the id randomly given to the inputText component by JSF.
My Problem is now, that though I can calculate the column out of the[i] "_id14", this calculation is hardcoded. So everytime I add a component in before the dataTable, the calculation needs to be adjusted in the code.
The Questions:
- How to force a sensefull id indicating a column-index for the inputText components inside the columns of a dataTable?
- Nicer since no workaround: How to get the column-index inside the dataTable on a natural way? (e.g. out of the valueChangeEvent the specific inputText component fires)
After some investigation here on the board and on the net I know multiple ways to get the row index, (Things like component-binding and so on) but I can't find a answer on how to get the column-index.
Thanks to all answers and/or links to things my eyes missed while searching for one....then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
You can manage this yourself using one of the following methods (I forget which one):
table.convertColumnIndexToModel(int viewColumnIndex)
table.convertColumnIndexToView(int modelColumnIndex)
Or, you can get data from the data model directly:
table.getModel().getValueAt(row, 0); -
How to find Field Name and Table Name
Hi All,
I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
Is there any way i can do it.
Points will be rewarded for all useful answers.
Regards
ABHi All,
I got some output values from the legacy system with me but need to know whats the actual field name and table name to which i need to transfer these values. How can i do it, since which theres is not field name or despcription given for the data.
Is there any way i can do it.
Points will be rewarded for all useful answers.
Regards
AB
Hi Abuser,
now u have legacy data. now u want to do upload this data from legacy to r/3 by using one sap transaction. yes ok na..
first of all u want to know the data is relevant to the which transaction...
without knowing the transaction u cant trasfer the data..
then open transaction put cursor on i/p field and click on f1
and find out the field name & table..
this is one method to find the field name and table name. -
How to get the column index of the selected column
Hi All,
I have a dynamically populated advanceddatagrid. Iam trying to edit any column of a particular row. In my as file im able to get the row index using selecteditem property. But I need to get the column Index and the updated value of the column to be passed from the as file to the java method.
So that I can update the DB with the updated value. Can somebody help with a sample code....then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
You can manage this yourself using one of the following methods (I forget which one):
table.convertColumnIndexToModel(int viewColumnIndex)
table.convertColumnIndexToView(int modelColumnIndex)
Or, you can get data from the data model directly:
table.getModel().getValueAt(row, 0); -
How to get the column count at the bottom of the column
Hi Friends,
How to get the column count at the bottom of the column
Thanks
RajYou mean row count? Add another column, click on the fx button and type RCOUNT(1).
If you want just the total you can make it MAX(RCOUNT(1)), hide this column and then add a Narrative View after your report and enter "Total Number of Records: @n" where "n" represents what order your column is from the left side. -
hi
i am new to programming... i would like to know how to get the column values... i have a resultset object
i need code .... asap
thnx@OP: It is always good to type complete sentences and describe your problem at length. It helps in letting people know what you really need instead of making wild guesses or silly jokes. You post mentions that you get the ResultSet. Then you should look up the API docs for java.sql.ResultSet and take a look at the getxxx() method signatures. Use the ones which suit the specific case.
Besides, it is good to refrain from using asap and urgent. Even if something is urgent to you, it need not be urgent to others. Wording a question properly would attract better replies.
Finally, would you mind getting down to specifics of your problem? From what I perceived, the JDBC tutorial and the API docs should provide all the information you need. -
How to get the Equipements number and desciption for the contract item ?
Hi Gurus,
How to get the Equipements number and desciption for the contract item items? It would gr8 helpful to me...
VBAP,,EQUI,,,,,,?
Thanks
KrisnaCheck with below tables :
EQUI Equipment master data
EQKT Equipment short text
EQUZ Equipment time segment
Thanks
Seshu -
How to sum the column in a table seperated by sign.
How to sum the column in a table separate by sign.
For Example:
A B
10 MOHAN
-15 KUMAR
-25 MARCH
50 MAYSELECT SUM(CASE SIGN(A) WHEN 1 THEN A ELSE NULL END) SUM_POSTIIVE,
SUM(CASE SIGN(A) WHEN -1 THEN A ELSE NULL END) SUM_NEGATIIVE
FROM tbl
/SY. -
Does anyone know how to get the vendor ID and product ID for NI-Visa? TIA
Does anyone know how to get the vendor ID and product ID for NI-Visa? TIA
This question has already been addressed in this thread:
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa?
John M
National Instruments -
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa? TIA
Does anyone know how to get the vendor ID and product ID for a USB device in NI-Visa? TIA
Hello,
Exactly which USB device are you referring to? Is the device a NI product?
The Product ID for National Instruments DAQPad-6020E is 0x12C0. The USB vendor ID is 0x3923. This is a 16-bit hexadecimal number(1093) (that is decimal 4243).
Also, here's a document on our website that will help you in configuring NI-VISA to control your USB device:
http://zone.ni.com/devzone/conceptd.nsf/webmain/6792BAB18242082786256DD7006B6416?opendocument
Swapnil P.
National Instruments Engineer -
How to get the kerning value and set it to back use script?
hi,guys
I come back again.
I encountered a kerning problem.
how to get the kerning value and set it to back use script?
Thanks very much!For both cases, the filename can be found on the FILE.ReceivedFileName Context Property. You can access this Property in a Pipeline Component or Orchestration and take any action you want, such as apply to a database.
The value is accessed by: MyReceivedMessage(FILE.ReceivedFileName)
In the case of a duplicate EDI Interchange, you would use the Failed Message Routing feature to capture the error message with either an Orchestration or Send Port. -
Where will i get the method code and method name in Bpc
Dear Experts,
Thanks for watching this thread at the time of creating Consolidation methods they have
NEW
HOLDING
GLOBAL
PROPORTIONAL
EQUITY
lEAVING (END OF THE YEAR)
LEAVING(DURING THE YEAR)
Where will i get the method Code and method name.
Can you please guide me.
Regards,
Srinivasan.The consolidation methods types you have listed are the standard ones provided by BPC for Consolidation Method types.
You can set the Consolidation Methods in the BPC Administration Console under Business Rules Library -> Consolidation Methods.
There you can see some defaults - you can remove these and set your own if you prefer.
You should read the BPC340 Training guide.
Maybe you are looking for
-
Is it possilbe to totally disable the use of Microsoft Accounts in Windows 8.x ?
The existence and need of "Microsoft Accounts" in Windows 8.x causes many issues for corporate IT management. 1) To access Windows 8.x Mail App, Calendar App, etc, OneDrive, Skype, to upgrade from Windows 8.0 to Windows 8.1, and the Windows Store req
-
Bug or Feature: pictures not ordered by date and time taken
Is this a bug or a feature? Pictures are not displayed in the sequence (order) they where originally taken (timestamp of the camera), when - importing pictures via camera connection kit - importing pictures via photo stream - when editing pictures t
-
I have a Mac Pro 1,1 and have been experiencing some RAM problems. First, I had RAM sticks fail on the entire top riser card. I replaced all of it and have been fine up until now. Now, when I start up my machine, one pair of 2 GB sticks will registe
-
I purchased a WAP54G Wireless Access Point to replace our old one here at the coporate office of Decorating Den Interiors. We've had our old Belkin access point for several years and it's losing it's signal(it's down to limited areas). Last night I g
-
Searching LDAP with space in name
All, I'm trying to write a package utilizing DBMS_LDAP that will take in an exchange distribution list as a VarChar2 and return a semi-colon delimitted list of member e-mails. So far, everything seems to be going well (though I haven't tested this pa