[eluser]Unknown[/eluser]
Hello. I`m a new user of the codeignitor. Trying to get data from the oracle base using a CodeIgniter functioanality. My user function (which is listed below) returning a refcursor. And I can not rich the data from it. CodeIgniter always return an error like this:
Message: ocibindbyname() [function.ocibindbyname]: Error while trying to retrieve text for error ORA-01036
here is the code:
Code:
public function getAll() {
$curs = $this->db->get_cursor();
$params=array(
array('name'=>'data', 'value'=>&$curs, 'type'=>OCI_B_CURSOR, 'length'=>-1)
);
return $this->db->stored_procedure("TEST","GETDATA" ,$params);
}
Here is an oracle function:
Code:
RETURN SYS_REFCURSOR IS
RESULT SYS_REFCURSOR;
BEGIN
OPEN RESULT FOR
SELECT NAME
FROM TABLE;
RETURN RESULT;
END;
And here is the example of the php code (without a codeignitor framework) which returns me a normal data.
Code:
$conn = oci_connect("login", "pass", $db, 'UTF-8');
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"begin :data := package.procedure(); end;");
ocibindbyname($stmt,"data",&$curs,-1,OCI_B_CURSOR);
oci_execute($stmt);
oci_execute($curs);
while (OCIFetchInto($curs,&$data)) {
var_dump($data);
}
OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);
Please help me to understand how to use it with cursors.