I have experience using MSSQL 2008 and I recently had to move from MSSQL to Oracle 10g.
The people who designed the (Oracle) table, which has a column I need to extract data from, used a BLOB
type column for the XML they need to store.
In MSSQL you would have simply stored your XML string in an XML
type or used a VARCHAR(MAX)
. Assume a table myTable
with a column called myColumn
which is a VARCHAR(MAX)
containing <ROOT><a>111</a></ROOT>
If you wanted to convert the VARCHAR(MAX)
type to an XML
type you would simply write something like:
SELECT CONVERT(XML, myColumn) FROM myTable
if you wanted, you could then use XQuery to get data from the converted column, like so:
SELECT CONVERT(XML, myColumn).query('/ROOT/a')
How would you accomplish the same thing in Oracle 10g if myColumn was a BLOB
, without having to write a stored procedure but still making it reusable? The text in the BLOB is UFT-8
.
I would really appreciate your assistance, as I kind of need this in a hurry.
XMLType is a system-defined opaque type for handling XML data. It as predefined member functions on it to extract XML nodes and fragments. You can create columns of XMLType and insert XML documents into it.
We can use two methods to convert a BLOB to a CLOB: dbms_lob. converttoclob. utl_raw.
Oracle XML DB provides full support for all of the key XML standards, including but not limited to XML, XML Schema, Namespaces, DOM, XQuery, SQL/XML and XSLT. By providing full support for XML standards, Oracle XML DB supports native XML application development.
A BLOB (binary large object) is a varying-length binary string that can be up to 2,147,483,647 characters long.
select
XMLType( BLOB_COLUMN,
1 /* this is your character set ID.
1 == USASCII */
) as XML
from my_table;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With