class statement : ?sql:string -> ora_connection ->
object
.. end
This class implements DML and DDL Oracle operations on a given
connection descriptor. It should not be instantiated using it's
own constructor, but rather via a connection#stmt
call.
val stmt : ora_statement
val connection : ora_connection
method con : ora_connection
Get a connection object that this statement is bound to.
method select : ?sql:string ->
?max_rows:int option ->
param_val array ->
cursor option * string array * ora_value array list
Parameters: |
sql |
: |
string
|
max_rows |
: |
int option
|
params |
: |
param_val array
|
|
method select_list : ?sql:string ->
?max_rows:int option ->
param_val array -> cursor option * ora_value array list
Parameters: |
sql |
: |
string
|
max_rows |
: |
int option
|
params |
: |
param_val array
|
|
method fetch : ?max_rows:int option ->
cursor -> cursor option * ora_value array list
This method is used in combination with
select
when
max_rows
parameter is specified. In this case the
cursor
parameter returned
by the
select
method can be fetched again to get the next
max_rows
rows as a list of records represented as arrays of fields.
Example:
value stmt = con#stmt ~sql:"select * from test";
let n = 10 in
let (cursor, lst) = stmt#select ~max_rows:n in
match cur with
[ None -> ()
| Some cur -> (let rec f -> fun (c, l) (ora_fetch_list cur ~max_rows:n)]
Parameters: |
max_rows |
: |
int option
|
cursor |
: |
cursor
|
|
method foreach : ?params:param_val array ->
?sql:string -> (ora_value array -> unit) -> unit
method execute : ?sql:string -> (int * param_val) list -> (int * ora_value) list
method execute_array : ?sql:string -> param_val array list -> int
method prepare : string -> unit
Assign an SQL string to the statement
method prepare_plsql : ?params:(int * param_val) list -> string -> unit
Assign an PL/SQL block to the statement. The block may contain bind variables
method update : ?sql:string -> param_val array -> int
Use this method to run an SQL INSERT / UPDATE / DELETE statement