I already setup the codeigniter dbdriver to "oci8".
For reference, here's my stored procedure. This is just my sample stored procedure.
CREATE OR REPLACE STORED PROCEDURE sp_sample(
in_id IN VARCHAR2,
out_code OUT varchar,
out_desc OUT varchar) IS
var_result VARCHAR2(100);
CURSOR GetStatus (my_id IN NUMBER) IS
SELECT status
FROM tbl_sample
WHERE id= my_id;
BEGIN
OPEN GetStatus(in_id);
LOOP
FETCH GetStatus into var_result;
EXIT WHEN GetStatus%NOTFOUND;
END LOOP;
CLOSE GetStatus;
IF(result != 'A')
UPDATE tbl_sample SET status = 'A'
WHERE id = in_id;
COMMIT;
out_code := '00';
out_desc := 'Success';
ELSE
out_code := '01';
out_desc := 'Already active';
END IF;
END sp_sample;
And this is how I call the stored proc in codeigniter:
$id = '10';
$params = array($id);
$result = $this->db->query("CALL sp_sample(?, @out_code, @out_desc)", $params);
exit($result);
Then I get this error message:
Query error: ORA-00936: missing expression - Invalid query: CALL sp_sample('10', @out_code, @out_code)
My question now is how can I call the oracle stored procedure using codeigniter? How to bind the parameters correctly?
Thanks, Irvin