The OracleError
class represents an error reported by Oracle.
Class Inheritance
Object
OracleError
Declaration
// C# public sealed class OracleError
Thread Safety
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
Remarks
The OracleError
class represents a warning or an error reported by Oracle.
Example
// 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); } } } }
Requirements
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
OracleError
members are listed in the following tables:
OracleError Static Methods
The OracleError
static method is listed in Table 5-45.
OracleError Properties
OracleError
properties are listed in Table 5-46.
Table 5-46 OracleError Properties
Properties | Description |
---|---|
ArrayBindIndex | Specifies the row number of errors that occurred during the Array Bind execution |
DataSource | Specifies the Oracle service name (TNS name) that identifies the Oracle database |
Message | Specifies the message describing the error |
Number | Specifies the Oracle error number |
Procedure | Specifies the stored procedure that causes the error |
Source | Specifies the name of the data provider that generates the error |
OracleError Methods
OracleError
methods are listed in Table 5-47.
Table 5-47 OracleError Methods
Methods | Description |
---|---|
Equals |
Inherited from Object (Overloaded) |
GetHashCode |
Inherited from Object |
GetType |
Inherited from Object |
ToString | Returns a string representation of the OracleError |
The OracleError
static method is listed in Table 5-48.
OracleError
properties are listed in Table 5-49.
Table 5-49 OracleError Properties
Properties | Description |
---|---|
ArrayBindIndex | Specifies the row number of errors that occurred during the Array Bind execution |
DataSource | Specifies the Oracle service name (TNS name) that identifies the Oracle database |
Message | Specifies the message describing the error |
Number | Specifies the Oracle error number |
Procedure | Specifies the stored procedure that causes the error |
Source | Specifies the name of the data provider that generates the error |
This property specifies the row number of errors that occurred during the Array Bind execution.
Declaration
// C# public int ArrayBindIndex {get;}
Property Value
An int
value that specifies the row number for errors that occurred during the Array Bind execution.
Remarks
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.
Declaration
// C# public string DataSource {get;}
Property Value
A string
.
This property specifies the message
describing the error
.
Declaration
// C# public string Message {get;}
Property Value
A string
.
This property specifies the Oracle error
number.
Declaration
// C# public int Number {get;}
Property Value
An int
.
This property specifies the stored procedure that causes the error
.
Declaration
// C# public string Procedure {get;}
Property Value
The stored procedure name.
Remarks
Represents the stored procedure which creates this OracleError
object.
This property specifies the name of the data provider that generates the error
.
Declaration
// C# public string Source {get;}
Property Value
A string
.
OracleError
methods are listed in Table 5-50.
Table 5-50 OracleError Methods
Methods | Description |
---|---|
Equals |
Inherited from Object (Overloaded) |
GetHashCode |
Inherited from Object |
GetType |
Inherited from Object |
ToString | Returns a string representation of the OracleError |
Overrides Object
This method returns a string representation of the OracleError
.
Declaration
// C# public override string ToString();
Return Value
Returns a string with the format Ora- error number: Class.Method name error message stack trace information.
Example
ORA-24333: zero iteration count