1

I have a select query which retrieves a LONG data type value. SQL Developer execution pulls the data but the OracleCommand doesn't retrieve the value. Instead it returns empty strings even though I know that the values exist in the database.

Is there a way to convert LONG type into VARCHAR2? The values stored in that field are plain text? Also I'm only doing a SELECT on the table.

SELECT REQ_COL FROM TEST_TABLE

I've tried TO_CHAR but that didn't work.

NOTE: This is a vendor database that I have no control over changing the data types of columns. I am only reading the data from the database.

h-rai
  • 3,636
  • 6
  • 52
  • 76
  • 1
    What is `OracleCommand` ? – user272735 Jul 15 '16 at 05:59
  • 1
    http://www.oracle-developer.net/display.php?id=430 – Mottor Jul 15 '16 at 06:57
  • Possible duplicate of [Oracle: LONG or CLOB?](http://stackoverflow.com/questions/3599211/oracle-long-or-clob) – J. Chomel Jul 15 '16 at 07:04
  • I googled "OracleCommand" and "ExecuteReader" and apparently they are part of the [Microsoft .Net framework](https://msdn.microsoft.com/en-us/library/ab4kxd8h(v=vs.110).aspx). – William Robertson Jul 15 '16 at 10:09
  • Actually a duplicate of this (that has a more complete answer): [C# - How to get oracle long raw type value](http://stackoverflow.com/questions/2644572/c-sharp-how-to-get-oracle-long-raw-type-value) – shindigo Jul 29 '16 at 12:35

1 Answers1

1

I have encountered this same problem while querying SYS.DBA_TRIGGERS. I have found that setting cmd.InitialLONGFetchSize = -1 solves it.

shindigo
  • 1,267
  • 15
  • 29