I have created a Windows Forms GUI in C# that can display tabular data (results of an SQL query against an Oracle Server DB) in a DataGridView. One of the field is an XML, potentially quite large, stored as a CLOB (Character Large OBject if I'm right). Of course, the user will not directly look at the cell, he will rather double-click the cell to see the file pretty-printed. The problem is that I need to convert the file (which is a CLOB) to a .NET String otherwise it generates an exception. I have tried, as a workaround, to use the Oracle to_char procedure, but it is limited to 4000 characters. So I take a substring of the file like this:
select to_char(dbms_lob.substr(column_name, 4000, 1 ))
The problem is, it doesn't display the whole file if it contains more than 4000 characters. How could I circumvent this limitation?