Sudipta Saha

Sudipta Saha

  • NA
  • 85
  • 13.5k

How to capture stored procedure query or print output in C#

Jan 16 2018 4:09 PM
I have a stored procedure like this
  1. PROCEDURE PRC_ABCD (resultset_out out TYPES.cursorType)  
  2. AS  
  3. SELECT * FROM ABCD;  
  4. END PRC_ABCD ;  
And my C# code is like this
  1. string cnn = "connectionstring";   
  2. OracleConnection conn = new OracleConnection(cnn);   
  3. conn.Open();   
  4. var cmd = adapter.CreateSpCommand(con, "PRC_ABCD");   
  5. cmd = adapter.outField(cmd, "resultset_out", OracleDbType.RefCursor);   
  6. using (var reader = cmd.ExecuteReader())   
  7. {   
  8.  while (reader.Read())   
  9.     {   
  10.        yield return Total.FromDataReader(reader, vProductCount, vProductAreaCount, vMonitoredByCount, customerCount);   
  11.  }  
  12. }  
My question is how do I get to see the results of PRC_ABCD into console message or how do I get to print the query SELECT * FROM ABCD?Anybody have any info about this?

Answers (3)