Welcome Guest, Not a member yet? Register   Sign In
can not call an Oracle Stored Procedure
#1

[eluser]Unknown[/eluser]
Hi everyone, recently i've been able to have CodeIgniter 2.0.2 to connect to Oracle 11gR2, and i can do normal query (SELECT/UPDATE/DELETE...), but i got this error when try to call a 'SELECT stored procedure' :

Quote:A PHP Error was encountered
Severity: Warning

Message: ocifetchinto() [function.ocifetchinto]: ORA-24374: define not done before fetch or execute and fetch

Filename: oci8/oci8_result.php

Line Number: 155

my SP is to select all data from a table as below (which i put in an pakage as from some hints i got from forums):

Code:
create or replace
PACKAGE PGK_ALLEMP AS
  TYPE cs_emp IS REF CURSOR;
  /* TODO enter package declarations (types, exceptions, methods etc) here */
  PROCEDURE SP_GETALLEMPLOYEE(employees IN OUT cs_emp);
END PGK_ALLEMP;

--==============================================
create or replace
PACKAGE BODY PGK_ALLEMP AS

  PROCEDURE SP_GETALLEMPLOYEE(employees IN OUT cs_emp)
  IS
  BEGIN
    /* TODO implementation required */
    OPEN employees FOR
      SELECT *
      FROM mst_employee;  
  END SP_GETALLEMPLOYEE;
END PGK_ALLEMP;

code in my model is like this :

Code:
...
$refcur = $this->db->get_cursor();
      $param = array(
       array('name'=>':employees' , 'value'=>$refcur , 'length' => -1, 'type'=>OCI_B_CURSOR)
      );
      $this->db->stored_procedure('PGK_ALLEMP','SP_GETALLEMPLOYEE',$param);

thanks for any reply!




Theme © iAndrew 2016 - Forum software by © MyBB