How to read XML in blob field
Hi guys,.Small need advise on your part.
My requirement is to read the XML file, which is stored as a BLOB in a table through plsql code.
Basically, I need to get the attribute values in the XML through code.
See you soon
Sexy
And once you have the data as XMLTYPE data type like Johan said, you can retrieve the data by using the function XMLTABLE...
for example
WITH t as (select XMLTYPE('
1
1800
1
28
6
12
5
19
1
90
2
2400
3
14
7
5
') as xml from dual)
-- END OF TEST DATA
select x.country, x.point, y.user_id, y.target, y.state, y.task
from t
,XMLTABLE('/RECSET/REC'
PASSING t.xml
COLUMNS country NUMBER PATH '/REC/COUNTRY'
,point NUMBER PATH '/REC/POINT'
,user_info XMLTYPE PATH '/REC/*'
) x
,XMLTABLE('/USER_INFO'
PASSING x.user_info
COLUMNS user_id NUMBER PATH '/USER_INFO/USER_ID'
,target NUMBER PATH '/USER_INFO/TARGET'
,state NUMBER PATH '/USER_INFO/STATE'
,task NUMBER PATH '/USER_INFO/TASK'
) y
COUNTRY POINT USER_ID TARGET STATE TASK
---------- ---------- ---------- ---------- ---------- ----------
1 1800 1 28 6 12
1 1800 5 19 1 90
2 2400 3 14 7 5
Tags: Database
Similar Questions
-
Hi Experts,
ORACLE 10G
My table structure as below the BLOB column with XML file
Lobid number (10)
File_Blob Blob () - with the XML from the file
My requirement is to analyze the XML Blob of code put in dish/text file with separators now java code did this and take more time
How to optimize it.
Thank you very much
KalingaI'm not sure what you want to use 'any delimiter' and you have not specified your needs analyzing. The following will unload the blob to a file on the operating system.
You can conver the blob xml as shown below and we many sql/plsql to work on the XML and then functions that write to a file.
the write_blob_to_file methods are a copy of what I have in my custom util plsql package
I hope this helps.
Mark Wooldridge
Secure Solutions, Inc. database.declare v blob; x xmltype; procedure write_blob_to_file(p_blob in blob, p_file in utl_file.file_type) is v_buffer raw(32767); v_buffer_size constant binary_integer := 8191; v_amount binary_integer; v_offset number; v_size number; begin if p_blob is null or dbms_lob.getlength(p_blob) = 0 then return; end if; v_size := dbms_lob.getlength(p_blob); v_amount := v_buffer_size; v_offset := 1; -- dbms_output.put_line('length: '||v_size); while v_amount >= v_buffer_size and v_offset <= v_size loop dbms_lob.read(lob_loc => p_blob, amount => v_amount, offset => v_offset, buffer => v_buffer); v_offset := v_offset + v_amount; utl_file.put_raw(file => p_file, buffer => v_buffer, autoflush => true); end loop; end write_blob_to_file; procedure write_blob_to_file(p_blob in blob, p_directory in varchar2, p_file_name in varchar2, p_write_null_file in boolean default true) is c_line_size constant number := 32767; v_file_handle utl_file.file_type; begin -- dbms_output.put_line('blob_to_file -dir: '||p_directory||' - file: '||p_file_name||' - size: '||dbms_lob.getlength(p_blob)); if not p_write_null_file and p_blob is null then return; end if; v_file_handle := utl_file.fopen(location => p_directory, filename => p_file_name, open_mode => 'wb', max_linesize => c_line_size); write_blob_to_file(p_blob, v_file_handle); utl_file.fclose(file => v_file_handle); end write_blob_to_file; begin /** * create example xml as a blob * * 873 is the character set id for NLS_CHARACTERSET AL32UTF8 * select * * from v$nls_parameters * * select nls_charset_id('AL32UTF8') * from dual * */ select xmltype('
').getblobval(873) into v from dual; --* this was just a test to conver the blob to an xmltye x := xmltype(v, 873); write_blob_to_file(v, 'DEBUGDIR', 'msw.xml'); end; /fac1 -
How to read pdf form data/fields
Hello
I want to orchestrate a process where the entrance is formed interactive and is the xml data output.
I mean that I want to read/data fields of the pdf form.
What activity are used on bench.
Concerning
Sunil
Try the ExportData or ProcessFormSubmission service.
I hope that helps!
Vikas - Vijayrania
-
How to read XML data stored as a Clob
Hello
I'm new on clob & XML types...
Data XML has been inserted into a Clob field in a Table in Oracle (9.2.0.8.0)
-----------------------------------------------------------
CREATE THE TEMP TABLE
(
SNO NUMBER (5),
STR_VAL LONG,
CREATED_DT DATE default sysdate,
COL2 CLOB,
COL3 SYS. XMLTYPE
)
-----------------------------------------------------------
SELECT dbms_lob.getlength (col2) of temp
---
-> 24754
-----------------------------------------------------------
SQL > select temp col2;
COL2
----------------------------------------------
& lt; DataSet1 & gt;
& lt; TAGSDATATABLE & gt;
& lt; TAG_NAME & gt; KST20001 & lt; / TAG_NA
--------------------------------------------------------------------------
If I use the stmt above it shows only a pice of data
How can I get the data in this column.
could someone help to obtain the data.
Concerning
Prakash
Published by: user12957183 on August 25, 2010 12:25 AMInsert data in to table XMLTYPE clob variable:
SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := '
'; 31 BEGIN 33 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 34* end; SQL> / PL/SQL procedure successfully completed. SQL> desc my_tab1; Name --------------------------------------------------------------------------------------------------- TABLE of XMLTYPE SQL> -- For larger data: SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := 'KST20001 3 4KST20002 5KST20003 6 8KST20004 79 11KST20005 1012 14KST20006 1315 17KST20007 1618 20KST20008 1921 23KST20009 2224 26KST20010 2527 29KST20009 283 '; 148 l_xmltype xmltype; 149 BEGIN 150 --l_xmltype := my_clob; 151 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 152* end; SQL> / PL/SQL procedure successfully completed. SQL>4 6KST20001 57 9KST20002 810 12KST20003 1113 15KST20004 1416 18KST20005 1719 21KST20006 2022 24KST20007 2325 27KST20008 2628 30KST20009 2931 33KST20010 3234 36KST20009 3537 39KST20009 3840 42KST20009 4143 45KST20009 4446 48KST20010 4749 51KST20009 5052 54KST20009 5355 57KST20009 5658 60KST20009 5961 63KST20010 6264 66KST20009 6567 69KST20009 6870 72KST20009 7173 75KST20009 7476 78KST20010 7779 81KST20009 8082 84KST20009 8385 87KST20009 8688 90KST20009 8991 93KST20010 9294 96KST20009 9597 99KST20009 98100 102KST20009 101103 105KST20009 104106 108KST20010 107109 111KST20009 110112 114KST20009 113115 117KST20009 116118 120KST20009 119121 123KST20010 122124 126KST20009 125127 129KST20009 128130 132KST20009 131133 135KST20009 134136 138KST20010 137139 141KST20009 140142 144KST20009 143145 147KST20009 146Published by: AP on August 25, 2010 04:46
-
How to read XML file in InDesign Script
indesign #target
var myFile is File.openDialog ("file select XML");.
If (myFile! = null)
{ myFile.open("r");
myElement var = new XML (myFile.read ());
myFile.close ();
Alert (MyElement.xmlElements.Length);
}
---------------------------------------------------------
Code above does not have XML elements, variable myElement to get all the data to an xml file,
but I don't get her child of the elements...
Can someone help me solve this problem please...
Thank you...
Hello
Try this...
alert(myElement.elements().length());
Concerning
-
How to READ XML and display hirarechy and data in separate columns 2
Hi, I have the following XML example and I need to extract the hirarechy and values separately. If the value is null, hirarechy must be displayed. Please advice!
for example,.
I want to output something this link
NŒUD
---------------------------
8. TEST4. FIVE
8. TEST4. SIX
8. TEST4. 7. TEST2. TWO
8. TEST4. 7. TEST2. THREE
VALUE
------------------------------------
1
5
I test m
example of XML data:
<? XML version = "1.0"? >
rowset <>
< ROW >
< 8 >
< TEST4 >
< 5 > 1 < / FIVE >
< 6 / >
< 7 >
< TEST2 >
< TWO > 5 < / TWO >
test of m i < 3 > < / 3 >
< 4 >
< A > 26 March 12 < / ONE >
< / OVEN >
< / TEST2 >
< / SEVEN >
< / TEST4 >
< TEST4 >
< 5 > 1 < / FIVE >
< SIX > 26 March 12 < / SIX >
< 7 >
< TEST2 >
< TWO > 5 < / TWO >
< 3 > 67 < / 3 >
< 4 >
< A > 26 March 12 < / ONE >
< / OVEN >
< / TEST2 >
< / SEVEN >
< / TEST4 >
< / 8 >
< / ROW >
< / LINES >
Thank you
Published by: Saad at March 26, 2012 15:18What is xml_test in your example? his error on this one.
This is a table of xmltype object I used to store your XML for my first tests.
Sorry, I forgot to remove the part while testing with a variable binding in place.Try this one (pass your real xmltype variable instead of xmltype(:xmldoc)):)
SELECT x.node_id , x.node_value FROM XMLTable( 'declare function local:getChildren($e as node(), $pID as xs:string?) as element()* { for $i in $e/(child::*|attribute::*) let $ID := if ($pID) then concat($pID,".",name($i)) else name($i) return element r { attribute is_leaf {empty($i/child::*)} , element node_id {$ID} , element parent_node_id {$pID} , element node_name {name($i)} , if ($i instance of attribute()) then ( element node_value {data($i)}, element node_kind {"attribute"} ) else ( element node_value {$i/text()}, element node_kind {"element"} ) } | local:getChildren($i,$ID) }; (: :) local:getChildren($d/ROWSET/ROW,())' passing xmltype(:xmldoc) as "d" columns node_id varchar2(100) path 'node_id' , node_name varchar2(30) path 'node_name' , node_value varchar2(2000) path 'node_value' , parent_node_id varchar2(100) path 'parent_node_id' , node_kind varchar2(30) path 'node_kind' , is_leaf varchar2(5) path '@is_leaf' ) x WHERE is_leaf = 'true' ;
-
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 ID Number Record BLOB 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"
-
"the double pass."-
General failure 1 component and invalid vacation list -
PRQ ABC -
LMP ABC -
KEY 9999 -
Text AMC1234, FIXED_ALL, RED )
Select Replace (regexp_substr (col,'
([^<> ']) itemName)) , replace (regexp_substr (col,'
([^<> ""]) Valeurelement)) t
connection of level <=>=>
'); -
How to read the data with different XML schemas within the unique connection?
- I have Oracle database 11g
- I access it via JDBC: Slim, version 11.2.0.3, same as xdb.
- I have several tables, each has an XMLType column, all based on patterns.
- There are three XML schemas different registered in the DB
- Maybe I need to read the XML data in multiple tables.
- If all the XMLTypes have the same XML schema, there is no problem,
- If patterns are different, the second reading will throw BindXMLException.
- If I reset the connection between the readings of the XMLType column with different schemas, it works.
The question is: How can I configure the driver, or the connection to be able to read the data with different XML schemas without resetting the connection (which is expensive).
Code to get data from XMLType is the implementation of case study:
1 ResultSet resultSet = statement.executeQuery( sql ) ;
2 String result = null ;
3 while(resultSet.next()) {
4 SQLXML sqlxml = resultSet.getSQLXML(1) ;
5 result = sqlxml.getString() ;
6 sqlxml.free();
7 }
8 resultSet.close();
9 return result ;It turns out, that I needed to serialize the XML on the server and read it as BLOB. Like this:
1 final Statement statement = connection.createStatement() ; 2 final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ; 3 ResultSet resultSet = statement.executeQuery( sql ) ; 4 String result = null ; 5 while(resultSet.next()) { 6 Blob blob = resultSet.getBlob( 1 ); 7 InputStream inputStream = blob.getBinaryStream(); 8 result = new Scanner( inputStream ).useDelimiter( "\\A" ).next(); 9 inputStream.close(); 10 blob.free(); 11 } 12 resultSet.close(); 13 statement.close(); 14 15 System.out.println( result ); 16 return result ; 17
Then it works. Still, can't get it work with XMLType in resultset. On the customer XML unwrapping explodes trying to pass to another XML schema. JDBC/XDB problem?
-
How to read report .xml to a printer?
How to read the .xml report that is sent by e-mail? You open the file with something?
Use the player to open the file. The report should be readable on the side of keft.
-
How to read the text of an XML with the dom parser?
Hi all
It's my code. How will I be able to read the text inside the xml file using dom parser?
my xml file is like this...
LLEYTON
Hewitt
Australian
1
897
André
Agassi
American
2
679
which I stored in _xml.
InputStream is = getClass () .getResourceAsStream (_xml);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
DocumentBuilder db = dbf.newDocumentBuilder ();
Doc document = db.parse (is);
NodeList nl = doc.getElementsByTagName("*");
for (int i = 0; i)< nl.getlength();="">
{
System.out.println ("node name" + nl.item (i) .getNodeName ()); Player, firstname, lastname, tennis o/p
System.out.println ("node value" + nl.item (i) .getTextContent ()); o/p value null, null, null, null
}
I want the text in the first name should get displayed as "Lleyton" and any other text in other tags as Andre/Agassi/American/2/679
You can install JDE and operates the samples, you will find XMLDEMO that will help you read XML application blackberry;
good luck;
-
How to do a bunch of fields read only value-based
IM using jdev 12.1.2.
I have a fragment with a few dozen jsff fields. I need to make these read-only or editable fields based on a value. I know how to do this for each field, but I was hoping there was a way to do this for each of them with a single property. For instance, all the fields are in a panelgrouplayout or a panelformlayout can I set a property on this provision which will set then all areas reporting to him read-only. I was just trying not to put the property read-only on each field of monkey.
There is none of these goods or componentwhich allows you to do. All you can do is to set the readonly property of each field to the same property (bean or pagedef) and ppr the container so that the components are updated.
Or you use a bean method that sets all the fields editiable readonly properties in a contianer orf true false. It would save that you set the property for each field.
Timo
-
How to read the values of the field of LOV disabled?
Hi all
I have a requirement, based on values that we entered one of the LOV fields, then we are arising from the new values based on the value that we entered this field of LOV. And then I must by default new LOV values derived in a two other fields of LOV and then disable them. Once the fields are disabled, then I'm not able to read the values using the pagecontext.getparameter... I get nothing when I tried to read using the pagecontext.getparameter.
Pointers on how to read the values of disabled field/LOV?
Thank you
Clarriiza1. you already have values, and that's what you set in the LOV before turning off, right? So why do you need to recover again from the LOV.
2. are you disabling or making it readonly? I think that if it is disabled, you might still be able to get the value using pageContext.getParameter.
3 have you tried to get the handle to the LOV bean and get the value using lovBean.getValue (pageContext)?
4. another Option is to combine the value of a FormValue Bean also (as well as the LOV bean) and retrieve it from FormValue.
5 BTW, why are, why you're seen LOV if you disable it? Can't you just a TextBox?
See you soon
AJ
-
Experts-
Is it possible that we can read the data in the column of table in database BLOB fields in Short 3.0?
Have we not some direct for BLOB fields readers ? Point No. 2 gold below is the correct way to short?
Below are some details that I could gather from google/search:
- http://docs.Oracle.com/CD/E29585_01/DeveloperStudio.61x/DevStudioHelp.PDF in other words directly CLOB / BLOB is not supported by SHORT
- https://forums.oracle.com/thread/2426178 - indicates a replacement for reading the sources BLOB' Oracle Advanced short JDBC Manager column 6.1.2 for generic platform '
Any help/pointers is very appreciated.
Thank you
Ranish
Please see thread external clover: http://forum.cloveretl.com/viewtopic.php?f=4&t=6644
That address this issue!
-
How to read the data of BLOB and save to the file system
Hi friends.
I have called DEMO table there image stored as a BLOB. now my requirement is to know how to read the data of BLOB and saved in the file system. is there a procedure
to read the blob object and stored in the file system. pls suggest me with an example.
Thank youHI - don't know what version you have, but have a read through this:
http://www.Oracle-base.com/articles/9i/ExportBlob9i.php
Hoek link is to import the blobs in the db, it is export, to a file.
-
How to load the image into the Blob field in Sql?
Hello
I want to know how to load the image into the Blob field in Sql
Concerning
Therese
Maybe you are looking for
-
iPhone, iPad Air 2 not recognized by iTunes
Very frustrated right now. Given that Apple's Support is not in contact with return despite requests, the story will go here. I have Windows 10, iPhone 6 + and iPad Air 2. Last weekend I was invited to and did pass to iTunes 12.5.1.21. Plugged my iPh
-
I use Windows XP and firefox version is up to date. Whenever I open the tab of the addon, it shows the loading sign but fails to load a virus even in a houris. Please help me in this regard.
-
Why, without real reason, sometimes modules not go where you want them to go on the worksheet? Its like there is an invisible module there and can be placed here. I find it rather annoying that I am trying to clean up a spreadsheet... Thanks for an
-
Error Microsoft Visual C++ Runtime Library to 44% install world of Warcraft WotLK
Microsoft Visual C++ Runtime Library is the error that I get every once of 44% to install my game World of Warcraft, it happenes with nothing else I even reformatted my system and tried to install it same thing its been happening for weeks now, I nee
-
Receipt of answer unanswered - Windows Update, an error code 80070570
I asked for a response to the above, and J of Nithyananda answered the and asked that in order to go further, he (she) needed more information. I have responded on 03/12/12 and provided the answer. From today 05/12/12, I have not heard something mo