How to find out or catch compiler error during scripting stored procedure
via OracleCommand class?

E.g.

OracleCommand _oracleCommand = new OracleCommand();
......


StringBuilder sb = new StringBuilder();

sb.AppendLine("create or replace procedure test_proc(var_number in
number) as");
sb.AppendLine("begin");
sb.AppendLine(" insert into test_table (data) values (var_number);");
sb.AppendLine(" any wrong code;");
sb.AppendLine("end;");

_oracleCommand.CommandText = sb.ToString();

_oracleCommand.Connection.Open();
_oracleCommand.ExecuteNonQuery();
_oracleCommand.Connection.Close();


ADO .NET throws no exception, bu stored procedure is not valid. Is any
solution?

TIA

Re: compiler error during scripting Oracle stored procedure by Jim

Jim
Tue Mar 20 15:04:36 CDT 2007

Try this:

Select status from user_objects where object_name = 'TEST_PROC';

This will return VALID if it is.

"Andy" <o.motl@centrum.cz> wrote in message
news:OOz1luyZHHA.348@TK2MSFTNGP02.phx.gbl...
> How to find out or catch compiler error during scripting stored procedure
> via OracleCommand class?
>
> E.g.
>
> OracleCommand _oracleCommand = new OracleCommand();
> ......
>
>
> StringBuilder sb = new StringBuilder();
>
> sb.AppendLine("create or replace procedure test_proc(var_number in
> number) as");
> sb.AppendLine("begin");
> sb.AppendLine(" insert into test_table (data) values
> (var_number);");
> sb.AppendLine(" any wrong code;");
> sb.AppendLine("end;");
>
> _oracleCommand.CommandText = sb.ToString();
>
> _oracleCommand.Connection.Open();
> _oracleCommand.ExecuteNonQuery();
> _oracleCommand.Connection.Close();
>
>
> ADO .NET throws no exception, bu stored procedure is not valid. Is any
> solution?
>
> TIA
>
>