Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

.NET Oracle SP call errors ORA-00604 and ORA-01001 when pass

By: a guest on Feb 6th, 2012  |  syntax: C#  |  size: 1.10 KB  |  views: 77  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var totalNumRowsParam = new OracleParameter("total_num_rows", OracleType.Int32) { Direction = ParameterDirection.Output };
  2. var resultsParam = new OracleParameter("results", OracleType.Cursor) { Direction = ParameterDirection.Output };
  3. var temp = new List<Blah>();
  4. using (var conn = new OracleConnection(connectionString))
  5. {
  6.         conn.Open();
  7.  
  8.         using (var command = conn.CreateCommand())
  9.         {
  10.                 command.CommandType = CommandType.StoredProcedure;
  11.                 command.CommandText = "blah_search";
  12.  
  13.                 command.Parameters.Add(new OracleParameter("start_index", (object)0));
  14.                 command.Parameters.Add(new OracleParameter("num_rows", (object)100000));
  15.                 command.Parameters.Add(totalNumRowsParam);
  16.                 command.Parameters.Add(resultsParam);
  17.                 command.Parameters.Add(new OracleParameter("results1", OracleType.Cursor) { Direction = ParameterDirection.Output });
  18.  
  19.                 OracleString s;
  20.                 command.ExecuteOracleNonQuery(out s);
  21.                 using(var reader = (OracleDataReader)resultsParam.Value)
  22.                 {
  23.                         while (reader.Read())
  24.                         {
  25.                                 var item = new Blah();
  26.                                 temp.Add(item);
  27.                                 item.Name = (string)reader["name"]; // ...
  28.                         }
  29.                 }
  30.         }
  31. }