Read clob from oracle

Posted: December 10, 2010 in C#
Tags: , , ,

What comes to your mind first when I say clob ?Well,dont worry if your are not able to think anything about it :).It’s nothing but a type used to store 4 GB of data in the database.I work with an oracle db & today had to read a clob out parameter from oracle procedure in .Net .Infact had to rewrite some code as the out param was initially of type varchar & then changed to clob.It’s a bit tricky & google din’t come to my rescue this time & figured out using watch window of visual studio.

Code I had written when the out param was varchar is as below

errorCode = Params[3].Value.ToString();

and re written as below to read a clob

errorCode = ((Oracle.DataAccess.Types.OracleClob)(Params[3].Value)).Value.ToString();

Hope this snippet comes to your mind when you deal with oracle datatypes like BFile,Blob,Clob,Binary etc

  1. Meena says:

    Thank you for the code this works. I did this in my code too and can read the string.
    string test = ((Oracle.DataAccess.Types.OracleClob)(paramosignature.Value)).Value.ToString();

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s