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
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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货