从oracle存储过程中获取数据和模式 [英] Get data and schema from oracle stored procedure

查看:66
本文介绍了从oracle存储过程中获取数据和模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello。


Oracle存储过程返回一些Oracle sys_refcursors。我的方法:

 public DataSet ExecuteProcedure(string sql,params OracleParameter [] parameters){
using(var cmd = new OracleCommand(sql,this.connection) )){
cmd.CommandType = CommandType.StoredProcedure;
OracleDataAdapter da = null;
试试{
cmd.Parameters.AddRange(参数);
da = new OracleDataAdapter(cmd);
}
catch(OracleException ex){
//关于异常的消息
}
var ds = new DataSet();
尝试{
da.Fill(ds);
}
catch(OracleException ex){
//关于异常的消息
}
return ds;
}
}


现在我需要在此DataSet中返回表的DataSet和模式。如何获取数据集模式?

解决方案

现在我需要在此DataSet中返回表的DataSet和模式。我如何获得数据集架构?


我建议您使用调试器,设置断点  on  return ds 并使用Quickwtach查看"ds"中的内容。

https://msdn.microsoft.com/en-us /library/y740d9d3.aspx


Hello.

Oracle stored procedure returns some Oracle sys_refcursors. My method:

public DataSet ExecuteProcedure(string sql, params OracleParameter[] parameters){
   using(var cmd = new OracleCommand(sql, this.connection)){
      cmd.CommandType = CommandType.StoredProcedure;
      OracleDataAdapter da = null;
      try {
         cmd.Parameters.AddRange(parameters);
         da = new OracleDataAdapter(cmd);
      }
      catch(OracleException ex){
         //message about exception
      }
      var ds = new DataSet();
      try {
         da.Fill(ds);
      }
      catch(OracleException ex){
         //message about exception
      }
      return ds;
   }
}

Now I need return DataSet and schema of tables in this DataSet. How can I get dataset schema?

解决方案

Now I need return DataSet and schema of tables in this DataSet. How can I get dataset schema?

I suggest that you use the Debugger, set s breakpoint  on  return ds and use Quickwtach to see what is in "ds".
https://msdn.microsoft.com/en-us/library/y740d9d3.aspx


这篇关于从oracle存储过程中获取数据和模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆