>백엔드 개발 >PHP 튜토리얼 >pdo 怎么调用oracle 返回游标的存储过程

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

WBOY
WBOY원래의
2016-06-06 20:46:421320검색

存储过程是这样的

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>

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>

现在只知道第一个获取单个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>

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

回复内容:

存储过程是这样的

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>

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>

现在只知道第一个获取单个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>

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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.