Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#4.0

Read clob from Oracle

5.00/5 (2 votes)
5 Jan 2011CPOL 31.9K  
Read clob from Oracle
What comes to your mind first when I say clob? Well, don't worry if you 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, I 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 & I figured it 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)