Exception: OCIError

Inherits:
OCIException show all
Defined in:
ext/oci8/error.c,
ext/oci8/error.c

Overview

Subclass of OCIException

The following exceptions are defined as subclasses of OCIError.

  • OCISuccessWithInfo

  • OCINoData (It had been a subclass of OCIException, not OCIError, until ruby-oci8 2.0)

Raised when underlying Oracle Call Interface failed with an Oracle error code such as ORA-00001.

Direct Known Subclasses

OCINoData, OCISuccessWithInfo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = nil, sql = nil, parse_error_offset = nil) ⇒ Object

Creates a new OCIError object.

Examples:

OCIError.new("ORA-00001: unique constraint (%s.%s) violated", 1)
# => #<OCIError: ORA-00001: unique constraint (%s.%s) violated>


173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'ext/oci8/error.c', line 173

static VALUE oci8_error_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE msg;
    VALUE code;
    VALUE sql;
    VALUE parse_error_offset;

    rb_scan_args(argc, argv, "04", &msg, &code, &sql, &parse_error_offset);
    rb_call_super(argc > 1 ? 1 : argc, argv);
    rb_ivar_set(self, oci8_id_at_code, code);
    rb_ivar_set(self, oci8_id_at_sql, sql);
    rb_ivar_set(self, oci8_id_at_parse_error_offset, parse_error_offset);
    return Qnil;
}

Instance Attribute Details

#codeObject (readonly)

#parse_error_offsetObject (readonly) Also known as: parseErrorOffset

#sqlObject (readonly)