| Oracle Data Provider for .NET Developer's Guide Release 9.2.0.2 Part Number A96160-01 |
|
Oracle.DataAccess.Client Namespace, 9 of 26
The OracleException class represents an exception that is thrown when the Oracle Data Provider for .NET encounters an error. Each OracleException object contains at least one OracleError object in the Error property that describes the error or warning.
Object
Exception
SystemException
OracleException
// C# public sealed class OracleException : SystemException
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C#
// The following example generates an OracleException due to bad SQL syntax,
// (that is the missing keyword "from") and then displays the exception message
// and source property.
..
try
{
...
// select * emp will cause ORA-00923
OracleCommand cmd = new OracleCommand("select * emp", con);
}
catch ( OracleException e )
{
Console.WriteLine("{0} throws {1}",e.Source, e.Message);
}
..
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccesss.dll
OracleException members are listed in the following tables:
OracleException static methods are listed in Table 4-63.
| Methods | Description |
|---|---|
|
|
Inherited from |
OracleException properties are listed in Table 4-64.
OracleException methods are listed in Table 4-65.
OracleException static methods are listed in Table 4-66.
| Methods | Description |
|---|---|
|
|
Inherited from |
OracleException properties are listed in Table 4-67.
This property specifies the TNS name that contains the information for connecting to an Oracle instance.
// C# public string DataSource {get;}
The TNS name containing the connect information.
This property specifies a collection of one or more OracleError objects that contain information about exceptions generated by the Oracle database.
// C# public OracleErrorCollection Errors {get;}
An OracleErrorCollection.
The Errors property contains at least one instance of OracleError objects.
Overrides Exception
This property specifies the error messages that occur in the exception.
// C# public override string Message {get;}
A string.
Message is a concatenation of all errors in the Errors collection. Each error message is concatenated and is followed by a carriage return, except the last one.
This property specifies the Oracle error number.
// C# public int Number {get;}
The error number.
This error number can be the topmost level of error generated by Oracle and can be a provider-specific error number.
This property specifies the stored procedure that caused the exception.
// C# public string Procedure {get;}
The stored procedure name.
Overrides Exception
This property specifies the name of the data provider that generates the error.
// C# public override string Source {get;}
The name of the data provider.
OracleException methods are listed in Table 4-68.
Overrides Exception
This method sets the serializable info object with information about the exception.
// C# public override void GetObjectData(SerializationInfo info, StreamingContext context);
The information includes DataSource, Message, Number, Procedure, Source, and StackTrace.
Overrides Exception
This method returns the fully qualified name of this exception, the error message in the Message property, the InnerException.ToString() message, and the stack trace.
// C# public override string ToString();
The string representation of the exception.
// C# ... try { ... // select * from emp will cause ORA-00923 OracleCommand cmd = new OracleCommand("select * from emp", con); } catch ( OracleException e ) { Console.WriteLine("{0}",e.ToString()); } ...
|
|
![]() Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|