Share via


Need to convert CLOB into string

Question

Monday, June 18, 2012 5:11 PM

Hi ,

I am fetaching XML from SP ( Oracle DB) as CLOB Datatype using out Parameter. I am getting value in output parameter but i am not able to convert CLOB into string.

I want to convert into string and then load it as XML object and display vales from XML to frontend.

Any help is appreciated.

 

 

All replies (4)

Wednesday, June 20, 2012 4:17 AM âś…Answered

Hi, please refer to the following documents:

http://msdn.microsoft.com/en-us/library/cydxhzhz(v=vs.80).aspx

http://www.devart.com/dotconnect/oracle/docs/Lob.html


Monday, June 18, 2012 5:36 PM

Look

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:367980988799

Thank u


Monday, June 18, 2012 6:16 PM

Thanks for your reply, but i want do it in C#. I am calling SP from frontend and getting XML retuned by SP as CLOB but not able to convert into string in C# . Tried various ways ...

pls provide links or idea how to do it


Wednesday, June 20, 2012 4:31 AM

Hi,

the type System.Data.OracleClient.OracleLob is derived from System.IO.Stream. So you should be able to read the entire XML stored in the CLOB like this:

StreamReader streamreader = new StreamReader(clob, Encoding.Unicode);
string xml = streamreader.ReadToEnd();

Use any appropriate encoding in the StreamReader constructor.