Executing Stored procedure with Codeigniter 2 & Oracle 11g

Its been an hour I m having trouble executing oracle stored procedures in Codeigniter 2. I m not being able to find proper documentation for CI+Stored procedures.

My Stored Procedure :

CREATE OR REPLACE 
PROCEDURE SP_DISTRICT_INSERT(P_DST_NAME VARCHAR2, FLAG VARCHAR2 Default '0',P_USER_ID Number) AS

PKEY NUMBER:=0;

         BEGIN

             SELECT MAX(NVL(DST_ID,0))+1 INTO PKEY FROM DISTRICT ;

      INSERT INTO DISTRICT(DST_ID, DST_NAME, USER_ID, ENTERED_DATE, FLAG) VALUES(PKEY,P_DST_NAME,P_USER_ID,SYSDATE ,FLAG);

     COMMIT ;



EXCEPTION

        WHEN OTHERS THEN

 RAISE_APPLICATION_ERROR (-20001,PKEY|| 'INVALID_NO'|| P_DST_NAME|| 'DATAMISMATCH'|| SQLERRM, TRUE) ;

END SP_DISTRICT_INSERT ;

AND I executed stored procedure in my model like this

$ins=$this->db->query("call SP_DISTRICT_INSERT('abcdxyz',1,1)");

The page showing error

Error Number:

call SP_DISTRICT_INSERT('abcdxyz',1,1)

Filename: D:\xampp\htdocs\..\database\DB_driver.php

Line Number: 330

However,

If i call procedure directly from Navicat, it works

Any help will be appreciated.

P.S. I m using Codeigniter 2 and Oracle 11g

Thanks

Answers


$rsponse = '';
    $s = oci_parse($this->db->conn_id, "begin packageName.procedureName(:bind1,:bind2,:bind3,:bind4,:bind5); end;");
               oci_bind_by_name($s, ":bind1", $data['fieldOne'],300);
               oci_bind_by_name($s, ":bind2", $data['fieldTwo'],300);
               oci_bind_by_name($s, ":bind3", $data['fieldThre'],300);
               oci_bind_by_name($s, ":bind4", $data['fieldFour'],300);
               oci_bind_by_name($s, ":bind4", $response,300);
               oci_execute($s, OCI_DEFAULT); 
echo $message; // returned value

n the above example procedure accept four arguments as input and one parameter as output. in case of direct calling procedure remove 'packageName.' That's it...


Need Your Help

invalid conversion from ‘const char*’ to ‘char’

c++ string compiler-errors

I am trying to replace a certain character in a string with a space using the following code line:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.