compiler error during scripting Oracle stored procedure

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

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
 
Try this:

Select status from user_objects where object_name = 'TEST_PROC';

This will return VALID if it is.
 
Back
Top