I elaborated this little piece of code to get started with my baby steps. The connection is good. Simple OdbcDataReader
selects are working fine. But I can't test any PL/SQL functions. How does it work ? Do I need to install something extra or do I do something wrong ?
using System;
using System.Data.Odbc;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string connectionString = "dsn=TEST;uid=read;pwd=___";
OdbcConnection con = new OdbcConnection(connectionString);
con.Open();
try
{
OdbcCommand cmd = new OdbcCommand("begin end;", con);
int result = cmd.ExecuteNonQuery();
cmd.Dispose();
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
con.Close();
con.Dispose();
Console.ReadKey();
}
}
}
The PL/SQL program is obviously:
begin
end;
Error message is the following:
System.Data.Odbc.OdbcException (0x80131937): ERROR [HY000] [Oracle][ODBC][Ora]OR
A-06550: line 1, column 7:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin declare exit for goto if loop mod null pragma raise
return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall
<a single-quoted SQL string>
I think your error is on the PL/SQL side instead of the c# code side.
This is invalid, since between begin
and end
a statement is expected:
begin end;
This isn't invalid, since it contains a statement, although it is null;
:
begin null; end;
User contributions licensed under CC BY-SA 3.0