Fix issue #413 (Oracle _error_message(), _error_number())
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index d9acaae..6da6dc7 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -529,13 +529,11 @@
 	/**
 	 * The error message string
 	 *
-	 * @access  protected
-	 * @return  string
+	 * @return	string
 	 */
 	protected function _error_message()
 	{
-		// If the error was during connection, no conn_id should be passed
-		$error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error();
+		$error = $this->_oci8_error_data();
 		return $error['message'];
 	}
 
@@ -544,19 +542,43 @@
 	/**
 	 * The error message number
 	 *
-	 * @access  protected
-	 * @return  integer
+	 * @return	string
 	 */
 	protected function _error_number()
 	{
-		// Same as _error_message()
-		$error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error();
+		$error = $this->_oci8_error_data();
 		return $error['code'];
 	}
 
 	// --------------------------------------------------------------------
 
 	/**
+	 * OCI8-specific method to get errors.
+	 * Used by _error_message() and _error_code().
+	 *
+	 * @return	array
+	 */
+	protected function _oci8_error_data()
+	{
+		if (is_resource($this->curs_id))
+		{
+			return oci_error($this->curs_id);
+		}
+		elseif (is_resource($this->stmt_id))
+		{
+			return oci_error($this->stmt_id);
+		}
+		elseif (is_resource($this->conn_id))
+		{
+			return oci_error($this->conn_id);
+		}
+
+		return oci_error();
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
 	 * Escape the SQL Identifiers
 	 *
 	 * This function escapes column and table names