在执行此函数以执行存储过程时,我将数组作为输出参数。
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;
}