Hi Everyone,

Hope that all is well. 🙂

I'm trying to call an Oracle store procedure that returns a value from Php using the ora libraries (no oci).

Even though it parses and binds well, it returns false when it executes.

Here's how the code looks (the connection was already made):

echo $requestid;
echo "<br> ";

$sql = "begin p_ins_gsdata2 ('$requestid', :returnval);
end;";

echo $sql;
echo "<br> ";

$cur = ora_open($this->conn);

// Parse the SQL Call
$rc = ora_parse($cur, $sql, 0);

if ($rc == true) {
echo " Parse was successful ";
}

$rc2 = ora_bind ($cur, "returnval", ":returnval", 10, 2);

if ($rc2 == true) {
echo " Returnval Bind Successful ";
}

$returnval = "a";
$rc3 = ora_exec($cur);

if ($rc3 == true) {
echo " Exec was successful ";
echo "<br> ";
echo " Return Value = ".$returnval;
ora_commit($this->conn);
}

if ($rc3 == false) {
echo " Error = ".ora_error($cur);
echo "<br> ";
echo "ErrorCode = ".ora_errorcode($cur);
echo "Did Not execute successfully";
}

ora_close ($cur);

The above code yields:

144937
begin gcnadm.p_ins_gsdata2 ('144937', :returnval); end;
Parse was successful
Returnval Bind Successful
Error = ORA-00000: normal, successful completion -- while
processing OCI function OBNDRA
ErrorCode = 0
Did Not execute successfully

I also tried binding the first variable and changing it accordingly and still get the same result.

So it seems that the parse and bind steps were o.k., but
it didn't execute even though the error code returned a successful code, but the ora_exec returns false. 😕

I appreciate any help in this matter. Have a great day and thanks in advance.

Regards,

Rudi

    Write a Reply...