Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> RAW Data From an XML Document
Hello All,
I a trying to write a function that will extract Raw Data from an XML Node.
Here is what I have so far...
FUNCTION GetFragRawVal(xmlRequest IN XMLTYPE,
xpathSearch IN VARCHAR2)RETURN OUR_Types.GUID_T IS
xmlFrag XMLType;
BEGIN xmlFrag := xmlRequest.extract(xpathSearch);
IF xmlFrag IS NOT NULL
THEN
rwGUID := UTL_RAW.cast_to_raw(xmlFrag.getStringVal);
END IF;
RETURN(rwGUID);
END GetFragRawVal;
Well after trying this I found out (and it makes sense now that I think about it) that UTL_RAW.cast_to_raw converts the character data to its binary representation so...
SELECT UTL_Raw.cast_to_raw('1') FROM Dual; yeilds 31
What I need to do is get the GUID data from the XML document and into a raw(16) variable exactly as it came in from the document..
So If the XML Fragment looked like this
<Equipment>
<IsChanged>9CF8D265824146D7A43466B385A55CE8</IsChanged> </Equipment>
How could I get the '9CF8D265824146D7A43466B385A55CE8' into a raw(16) datatype so I can use it in stored procedures?
Would it be better to store it as a varchar2 and let the server implicitly convert the data when making comparisons? Would that even work?
Much thanks for any help, and sorry if this is a stupid question. I am still on the steep part of the learning curve.
Regards,
Bill
Received on Tue Feb 25 2003 - 16:45:42 CST