如何在PHP中使用OCI8执行存储过程

use*_*937 0 php oracle stored-procedures oci8

有人可以帮助我如何通过PHP调用oracle中的存储过程?我有存储过程的示例

CREATE OR REPLACE PROCEDURE view_institution(
       c_dbuser OUT SYS_REFCURSOR)
IS
BEGIN
  OPEN c_dbuser FOR
  SELECT * FROM institution;
END;
Run Code Online (Sandbox Code Playgroud)

上面名为view_instituion的存储过程用于显示表机构上的所有记录.有人可以教我在php中调用上面的存储过程.我是新玩的存储过程

谢谢

S.V*_*ser 5

如果您使用PDO引擎

/* Define output */
$output = "";    

/* The call */
$foo = $pdo->prepare("CALL view_institution(?)");

/* Binding Parameters */
$foo->bindParam($parameter1, $output);

/* Execture Query */
$foo->execute();

/* Get output on the screeen */
print_r($output, true);
Run Code Online (Sandbox Code Playgroud)

如果你使用oci

/* The call */
$sql = "CALL view_institution(:parameter)";

/* Parse connection and sql */
$foo = oci_parse($conn, $sql);

/* Binding Parameters */
oci_bind_by_name($foo, ':parameter', $yourparameter) ;

/* Execute */
$res = oci_execute($foo);

/* Get the output on the screen */
print_r($res, true);
Run Code Online (Sandbox Code Playgroud)