The OracleError class represents an error reported by Oracle.
System.Object
Oracle.DataAccess.Client.OracleError
// C# public sealed class OracleError
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
The OracleError class represents a warning or an error reported by Oracle.
If there are multiple errors, ODP.NET only returns the first error message on the stack.
// C#
using System;
using System.Data;
using Oracle.DataAccess.Client;
class OracleErrorsSample
{
static void Main()
{
string constr = "User Id=scott;Password=tiger;Data Source=oracle";
OracleConnection con = new OracleConnection(constr);
con.Open();
// Create an OracleCommand object using the connection object
OracleCommand cmd = con.CreateCommand();
try
{
cmd.CommandText = "insert into notable values (99, 'MyText')";
cmd.ExecuteNonQuery();
}
catch (OracleException ex)
{
Console.WriteLine("Record is not inserted into the database table.");
foreach (OracleError error in ex.Errors)
{
Console.WriteLine("Error Message: " + error.Message);
Console.WriteLine("Error Source: " + error.Source);
}
}
}
}
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleError members are listed in the following tables.
The OracleError static method is listed in Table 5-50.
Table 5-50 OracleError Static Method
| Method | Description |
|---|---|
|
|
Inherited from |
OracleError properties are listed in Table 5-51.
Table 5-51 OracleError Properties
| Property | Description |
|---|---|
|
Specifies the row number of errors that occurred during the Array Bind execution |
|
|
Specifies the Oracle service name (TNS name) that identifies the Oracle database |
|
|
Specifies the |
|
|
Specifies the Oracle |
|
|
Specifies the stored procedure that causes the |
|
|
Specifies the name of the data provider that generates the |
OracleError methods are listed in Table 5-52.
The OracleError static method is listed in Table 5-53.
OracleError properties are listed in Table 5-54.
Table 5-54 OracleError Properties
| Property | Description |
|---|---|
|
Specifies the row number of errors that occurred during the Array Bind execution |
|
|
Specifies the Oracle service name (TNS name) that identifies the Oracle database |
|
|
Specifies the |
|
|
Specifies the Oracle |
|
|
Specifies the stored procedure that causes the |
|
|
Specifies the name of the data provider that generates the |
This property specifies the row number of errors that occurred during the Array Bind execution.
// C#
public int ArrayBindIndex {get;}
An int value that specifies the row number for errors that occurred during the Array Bind execution.
Default = 0.
This property is used for Array Bind operations only.
ArrayBindIndex represents the zero-based row number at which the error occurred during an Array Bind operation. For example, if an array bind execution causes two errors on the 2nd and 4th operations, two OracleError objects appear in the OracleErrorCollection with the ArrayBindIndex property values 2 and 4 respectively.
This property specifies the Oracle service name (TNS name) that identifies the Oracle database.
// C#
public string DataSource {get;}
A string.
This property specifies the message describing the error.
// C#
public string Message {get;}
A string.
This property specifies the stored procedure that causes the error.
// C#
public string Procedure {get;}
The stored procedure name.
Represents the stored procedure which creates this OracleError object.
OracleError methods are listed in Table 5-55.
Table 5-55 OracleError Methods
| Method | Description |
|---|---|
|
|
Inherited from |
|
|
Inherited from |
|
|
Inherited from System. |
|
Returns a string representation of the |