65.9K
CodeProject is changing. Read more.
Home

Read clob from Oracle

starIconstarIconstarIconstarIconstarIcon

5.00/5 (2 votes)

Dec 28, 2010

CPOL
viewsIcon

32028

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.