![]() |
Using CI with Oracle Stored Procedures - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Using CI with Oracle Stored Procedures (/showthread.php?tid=20810) |
Using CI with Oracle Stored Procedures - El Forum - 07-22-2009 [eluser]Ayo[/eluser] I have been trying to get CI+Oracle Stored Procedures working. The issue i currently have is the corruption of input data during oci binding: Below is a snippet from: MODEL Code: function testProc($dat) ORACLE STORED PROCEDURE Code: PROCEDURE test(p_num NUMBER, When i call this function from the Controller passing in a value(eg. 4), when i check the returned value in variable $res2 i get varying values like 220189512,220189160,-0.008212. Any help with how to bind oracle datatypes to php will be appreciated. Thanks. Using CI with Oracle Stored Procedures - El Forum - 07-22-2009 [eluser]Ayo[/eluser] I finally figured out the problem. I had to modify the oci8_driver.php file. Original form: Code: function _execute($sql) The stored_procedure() function parses the stored procedure sql [_set_stmt_id($sql)] and binds variables using this ociparse object [_bind_params($params)]. A subsequent call to query($sql, FALSE, $have_cursor) internally calls _execute($sql) which nullifies the stmt_id and attempts to reparse the sql string without the necessary bind variables. Based on other modifications to these files recommended in other posts on this forum, the modified files should look like this oci_driver.php Code: //bind variable declared for class The DB_driver.php file is also modified thus: Code: function query($sql, $binds = FALSE, $return_object = TRUE) The modifications also allow the use of bind variables in oracle queries instead of the substitution of values in '?' placeholders, as shown below: Code: function getAll() Using CI with Oracle Stored Procedures - El Forum - 08-04-2009 [eluser]Bhupendra[/eluser] Thanks for good work, I follow up your suggestion, there is no errors but still data is not inserting on table. Trying to insert records through html form on table. I am using Oracle 11g, codeigniter 1.7.1 and PHP 5.1.2. Thanks, Using CI with Oracle Stored Procedures - El Forum - 08-04-2009 [eluser]Ayo[/eluser] What exactly r u tryin' to do? I have some slight modification to query function(DB_driver.php) Code: function query($sql, $binds = FALSE, $return_object = TRUE) You can PM for more help Using CI with Oracle Stored Procedures - El Forum - 10-28-2009 [eluser]Jbeetle[/eluser] I had to modify all drivers but still probem with cursors. My code in model: public function GetUsers(){ $cursor = $this->db->get_cursor(); $this->db->stored_procedure("jile","get_roles" ,array (array ('name' => ':cRoles', 'value' => $cursor, 'type' => OCI_B_CURSOR, 'length' => -1) ) ); } displays: ORA-24374: in file oci8/oci8_result.php, Line Number: 154 Using CI with Oracle Stored Procedures - El Forum - 09-10-2010 [eluser]kimo_gusatava[/eluser] Hi, I'm trying to learn oracle, and I'm just using a sample database. seems like selecting table and views are easy but when calling procedures I got a bit of a problem... Is there an easier way to call an Oracle stored Procedure like using the default active record methods? or should I really have to modify the driver? seems like the $package is required here right this means I have to create the package? and all I got right now is a procedure... anyway I would like to call this one: Code: create or replace Using CI with Oracle Stored Procedures - El Forum - 09-11-2010 [eluser]mbtshoes[/eluser] Thanks for good work, I follow up your suggestion, there is no errors but still data is not inserting on table. Trying to insert records through html form on table. I am using Oracle 11g, codeigniter 1.7.1 and PHP 5.1.2. Thanks, mbt shoes ,mbt outlet,discount mbt shoes,cheap mbt shoes,mbt shoes sale Using CI with Oracle Stored Procedures - El Forum - 05-25-2011 [eluser]Unknown[/eluser] didn't help me at all, actually. i'm still stuck with this thing. i need to call not a query, but a procedure. it still outputs error on this line: Code: $exec_worked = ociexecute($this->stmt_id, $this->_commit); what to do? my head's about to explode. and my boss' too. |