I am getting array as a out parameter while executing this function to execute stored procedure.
function ExecuteProcedure($procedureName, $parameters)
{ $query = "begin " . $procedureName . "(" ;
for($i=0; $i<count($parameters); $i++)
{
if($i==0)
$query = $query . ":" . $parameters[$i][0] ;
else
$query = $query . ", :" . $parameters[$i][0] ;
}
$query = $query . "); end;";
//echo $query . "<br />";
$this->stmt = ociparse($this->con, $query) or die (ocierror());
for($i=0; $i<count($parameters); $i++)
{
$valueList = $parameters[$i];
if(count($valueList) == 2)
ocibindbyname($this->stmt, $valueList[0], $valueList[1]) or die (ocierror());
else if(count($valueList) == 3)
ocibindbyname($this->stmt, $valueList[0], $valueList[1], $valueList[2]) or die (ocierror());
else{
ocibindbyname($this->stmt, $valueList[0], $valueList[1], $valueList[2], $valueList[3]) or die (ocierror());
}
}
@ociexecute($this->stmt, OCI_DEFAULT) or die (ocierror());
return $parameters;
}
I suggest you try with a simple example first, following the documentation which contains info about OUT variables:
You must specify maxlength when using an OUT bind so that PHP allocates enough memory to hold the returned value.
Build a simple procedure:
CREATE PROCEDURE foo (p OUT VARCHAR2) IS
BEGIN
p := 'bar';
END foo;
Then in PHP:
$stid = oci_parse($conn, 'begin foo(:p1); end;');
oci_bind_by_name($stid, ':p1', $p1, 3);
echo $p1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.