如何使用oledbConnection从ADO.net调用Oracle函数 [英] How to call the Oracle function from ADO.net using oledbConnection

查看:109
本文介绍了如何使用oledbConnection从ADO.net调用Oracle函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在尝试使用以下代码调用Oracle函数,但它显示的错误如



ORA-01403:找不到数据\ nORA -06512:at \TEST.VOD_BULK_TRANS1 \,第47行\ nORA-06512:第1行



该函数需要3个输入参数并返回一个整数值。

Hi i am trying to call the Oracle function using the following code but it is showing the error like

"ORA-01403: no data found\nORA-06512: at \"TEST.VOD_BULK_TRANS1\", line 47\nORA-06512: at line 1"

the function takes 3 input parameters and return one integer value.

using (OleDbConnection conn= new OleDbConnection(connectionString))
{
    conn.Open();
    
    //set the command text (stored procedure name or SQL statement)
    command.CommandText = "VOD_BULK_TRANS1";
   command.CommandType=CommandType.StoredProcedure;
    
    command.Parameters.Add(new OleDbParameter("retVal", OleDbType.Integer, 11, ParameterDirection.ReturnValue, true, 0, 0, "retVal", DataRowVersion.Current,null));
    command.Parameters.Add( OleDbParameter("@t_list", videosListWithCommaSeparated);
    command.Parameters.Add( OleDbParameter("@option1", 3);
    command.Parameters.Add( OleDbParameter("@id1", groupId);
    command.ExecuteNonQuery();
}





请建议我如何使用Oledb Conneciton调用函数或存储过程..



谢谢



Please suggest me the way how to call the function or stored procedure using the Oledb Conneciton..

Thanks

推荐答案

有你试图设置



Have you tried to set

command.CommandType = CommandType.StoredProcedure;





我认为默认值是 CommandType.Text



[更新]

ORA-06512:此错误是由堆栈解除引起的通过PLSQL代码中未处理的异常。

ORACLE / PLSQL:ORA-06512 [ ^ ]



我认为你的c#代码没问题,但存储过程会引发异常。

这可能是因为你没有正确匹配输入参数或者没有数据如果发现,SP不返回,但继续执行未初始化的变量。



如果没有看到你的SP声明和SQL代码,很难帮助你。



I think the default is CommandType.Text

[Update]
ORA-06512: This error is caused by the stack being unwound by unhandled exceptions in your PLSQL code.
ORACLE/PLSQL: ORA-06512[^]

I think your c# code is ok, but the stored procedure throws an exception.
That might be because you are not matching the input parameters properly or that if no data is found, the SP doesn't return, but continues to execute with uninitialized variables.

Without seeing your SP declaration and SQL code, it is very difficult to help you.

引用:

该函数接受3个输入参数并返回一个整数值。

the function takes 3 input parameters and return one integer value.



如果没有类型信息,上面的信息并不是很有用。



一个名字如下的变量 videosListWithCommaSeparated 也会引起怀疑ternal SP代码未知。以逗号分隔的列表可能是问题的原因。


The info above is not very useful without type information.

A variable with a name like this videosListWithCommaSeparated also raises suspicions when the internal SP code is unknown. Comma separated lists can be a cause of problems.


这篇关于如何使用oledbConnection从ADO.net调用Oracle函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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