tags:

views:

67

answers:

2
+1  A: 

Hi sayket,

you could use oci_fetch:

// parse/bind your statement

if (oci_fetch($your_statement)) {
    ... // do something when there is rows
}    
else {
    ... // do something when there is no rows
}
Vincent Malgrat
I believe the OP refers to running statements that do not return rows, such as inserts, updates, procedures...
Álvaro G. Vicario
Thanks Malgrat it worked.........Thank u very much..........
A: 

After assigning the bind values with oci_parse(), you need to run the query with oci_execute(). This is the function definition:

bool oci_execute ( resource $statement [, int $mode = OCI_COMMIT_ON_SUCCESS ] )

Returns TRUE on success or FALSE on failure.

Putting it all together:

<?php

$stmt = oci_parse($conn, $sql);
$res = oci_execute($stmt);
if( !$res ){
    $error = oci_error($stmt);
    echo "Error: " . $error['message'] . "\n";
}else{
    echo "OK\n";
}

?>
Álvaro G. Vicario