欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

pdo 怎么调用oracle 返回游标的存储过程

程序员文章站 2024-01-07 12:15:40
...
存储过程是这样的

1.

CREATE OR REPLACE PROCEDURE HR.get_job_info_sp (v_job_id OUT varchar2)
IS
BEGIN
   SELECT job_id
   INTO v_job_id
   FROM jobs
   WHERE job_id='oooo';
END;

2.

CREATE OR REPLACE PROCEDURE hr.get_job_sp_by_id (c_list OUT sys_refcursor)
IS
BEGIN
   OPEN c_list FOR
      SELECT job_id
      FROM jobs;
END;

现在只知道第一个获取单个out值的怎么写

$result = $conn->prepare("BEGIN get_job_info_sp(:v_job_id); end;");
            $result->bindParam(":v_job_id", $v_job_id, PDO::PARAM_STR, 300);
            $result->execute();

第二个返回游标的怎么获取?

回复内容:

存储过程是这样的

1.

CREATE OR REPLACE PROCEDURE HR.get_job_info_sp (v_job_id OUT varchar2)
IS
BEGIN
   SELECT job_id
   INTO v_job_id
   FROM jobs
   WHERE job_id='oooo';
END;

2.

CREATE OR REPLACE PROCEDURE hr.get_job_sp_by_id (c_list OUT sys_refcursor)
IS
BEGIN
   OPEN c_list FOR
      SELECT job_id
      FROM jobs;
END;

现在只知道第一个获取单个out值的怎么写

$result = $conn->prepare("BEGIN get_job_info_sp(:v_job_id); end;");
            $result->bindParam(":v_job_id", $v_job_id, PDO::PARAM_STR, 300);
            $result->execute();

第二个返回游标的怎么获取?

相关标签: php oracle

上一篇:

下一篇: