+ -
当前位置:首页 → 问答吧 → C# .net 执行oracle包报错..

C# .net 执行oracle包报错..

时间:2011-12-20

来源:互联网

C#代码:
 public void Conntion()
  {
  OracleConnection conn = null;
  if (conn == null)
  {
  conn = new OracleConnection();
  conn.ConnectionString = "User ID=system;Password=manager;Data Source=(DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST=192.168.1.5)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=Ora.finemoon)))";
  }
  if (conn.State == ConnectionState.Closed)
  {
  conn.Open();
  }
  OracleCommand command = new OracleCommand();
  command.CommandText = "TestPackage.GetRecords";
  command.Parameters.Add("ret_cursor", OracleType.Number);
  command.Connection = conn;
  command.CommandType = CommandType.StoredProcedure;
  int it= command.ExecuteNonQuery();
  int rpws=Convert.ToInt32(command.Parameters[0].Value);
  }

oracle 代码:
 create or replace package TestPackage is
  procedure GetRecords(ret_cursor out number); -- 定义过程,用游标变量作为返回参数
end TestPackage;
   
--包体是这么定义的:
create or replace package body TestPackage is
  procedure GetRecords(ret_cursor out number) 
  as
  begin
  ret_cursor:=1;
  end GetRecords;
end TestPackage;
错误提示:
ORA-06550: 第 1 行, 第 7 列: 
PLS-00905: 对象 SYSTEM.TESTPACKAGE 无效
ORA-06550: 第 1 行, 第 7 列: 
PL/SQL: Statement ignored

作者: feiji1019   发布时间: 2011-12-20

借宝地一用赚点可用分

作者: askandstudy1   发布时间: 2011-12-20

该回复于2011-12-20 15:52:02被管理员删除

  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
#3楼 得分:0回复于:2011-12-20 16:01:41
你把名字换换

作者: daf380   发布时间: 2011-12-20