Oracle® Data Provider for .NET Developer's Guide 11g Release 1 (11.1) Part Number B28375-01 |
|
|
View PDF |
The OracleError
class represents an error reported by Oracle.
Class Inheritance
System.Object
Oracle.DataAccess.Client.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.
If there multiple errors, ODP.NET only returns the first error message on the stack.
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
Microsoft .NET Framework Version: 1.x or 2.0
See Also:
OracleError
members are listed in the following tables:
OracleError Static Methods
The OracleError
static method is listed in Table 5-45.
Table 5-45 OracleError Static Method
Method | Description |
---|---|
|
Inherited from |
OracleError Properties
OracleError
properties are listed in Table 5-46.
Table 5-46 OracleError Properties
Properties | 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
OracleError
methods are listed in Table 5-47.
Table 5-47 OracleError Methods
Methods | Description |
---|---|
|
Inherited from |
|
Inherited from |
|
Inherited from |
Returns a string representation of the |
The OracleError
static method is listed in Table 5-48.
Table 5-48 OracleError Static Method
Method | Description |
---|---|
|
Inherited from |
OracleError
properties are listed in Table 5-49.
Table 5-49 OracleError Properties
Properties | 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.
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.
See Also:
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 |
---|---|
|
Inherited from |
|
Inherited from |
|
Inherited from System. |
Returns a string representation of the |
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