有如下PL/SQL块:
string strSql = @"declare
o_error_code varchar2(1000);
o_error_msg varchar2(1000);
t_res number;
begin
t_res:=10;
end;";用OleDb调用:
OleDbCommand cmd = new OleDbCommand();
OleDbConnection con = new OleDbConnection("Provider=OraOleDb.Oracle;Data Source=..;Database=..;User Id=..;Password=..;");
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
cmd.ExecuteNonQuery();
运行成功。
而用OracleClient:
OracleCommand cmd = new OracleCommand();
OracleConnection con = new OracleConnection(User ID=..;Password=..;Data Source=..;);
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
cmd.ExecuteNonQuery();
出现如下错误:RA-06550: 第 2 行, 第 1 列:
PLS-00103: 出现符号 ""在需要下列之一时:
begin case
declare exit for goto if loop mod null pragma raise return
select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
符号 "" 被忽略。
ORA-06550: 第 3 行, 第 1 列:
PLS-00103: 出现符号 ""在需要下列之一时:
begin case
declare end exception exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind var
........................不知道是什么原因啊,大家有没有碰到过???
string strSql = @"declare
o_error_code varchar2(1000);
o_error_msg varchar2(1000);
t_res number;
begin
t_res:=10;
end;";用OleDb调用:
OleDbCommand cmd = new OleDbCommand();
OleDbConnection con = new OleDbConnection("Provider=OraOleDb.Oracle;Data Source=..;Database=..;User Id=..;Password=..;");
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
cmd.ExecuteNonQuery();
运行成功。
而用OracleClient:
OracleCommand cmd = new OracleCommand();
OracleConnection con = new OracleConnection(User ID=..;Password=..;Data Source=..;);
cmd.Connection = con;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
cmd.ExecuteNonQuery();
出现如下错误:RA-06550: 第 2 行, 第 1 列:
PLS-00103: 出现符号 ""在需要下列之一时:
begin case
declare exit for goto if loop mod null pragma raise return
select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
符号 "" 被忽略。
ORA-06550: 第 3 行, 第 1 列:
PLS-00103: 出现符号 ""在需要下列之一时:
begin case
declare end exception exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind var
........................不知道是什么原因啊,大家有没有碰到过???
解决方案 »
- 如何实时监测某网页,一旦更新就给出提示。
- 继承一个自定义dll中窗体时报错,其大家帮帮忙。多谢!!
- “/”应用程序中的服务器错误。
- 如何求得分段时间内各时间分段中某列出现频率最高的列的值(不创建临时表)!
- C#中如何判断目录权限是可写的,还有删除的时候,如何判断文件正在使用?
- 问几个 初级问题 请各位不吝赐教
- 写过word应用的来!RPC不可用.(在线等),100分重谢!
- C# .Net 怎么更改访问源代码的IP
- 高分!高分!,,,,,,,一段C到C#的转换。请问有错不。
- 为什么我用数据窗口向导建立的数据窗口检索不出数据?
- comboBox简单问题,急...在线等!~~~~
- 高手来看看。c#简单问题。
而且,用OracleClient的话,单条的sql语句也是可以的。就是不能执行PL/SQL。