Method: OCI8::Cursor#exec

Defined in:
lib/oci8/cursor.rb

#exec(*bindvars) ⇒ Object

Executes the SQL statement assigned the cursor. The type of return value depends on the type of sql statement: select; insert, update and delete; create, alter, drop and PL/SQL.

In case of select statement, it returns the number of the select-list.

In case of insert, update or delete statement, it returns the number of processed rows.

In case of create, alter, drop and PL/SQL statement, it returns true. In contrast with OCI8#exec, it returns true even though PL/SQL. Use OCI8::Cursor#[] explicitly to get bind variables.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/oci8/cursor.rb', line 127

def exec(*bindvars)
  bind_params(*bindvars)
  case type
  when :select_stmt
    __execute(0)
    define_columns() if @column_metadata.size == 0
    @rowbuf_size = 0
    @rowbuf_index = 0
    @column_metadata.size
  else
    __execute(1)
    row_count
  end
end