Home > Backend Development > PHP Tutorial > pdo 怎么调用oracle 返回游标的存储过程

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

WBOY
Release: 2016-06-06 20:46:42
Original
1299 people have browsed it

存储过程是这样的

1.

<code>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;
</code>
Copy after login
Copy after login

2.

<code>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;
</code>
Copy after login
Copy after login

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

<code>$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();
</code>
Copy after login
Copy after login

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

回复内容:

存储过程是这样的

1.

<code>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;
</code>
Copy after login
Copy after login

2.

<code>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;
</code>
Copy after login
Copy after login

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

<code>$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();
</code>
Copy after login
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template