Welcome Guest, Not a member yet? Register   Sign In
Getting output from a procedure using oracle databases
#1

[eluser]Unknown[/eluser]
Hi Guys,

I've hit a bit of a roadblock in my CI application. I want to bind the output of an Oracle procedure to a PHP variable using Codeigniter.

Suppose this is my procedure:

Code:
CREATE OR REPLACE PROCEDURE myproc(p1 IN NUMBER, p2 OUT NUMBER) AS
BEGIN
    p2 := p1 * 2;
END;

If I was doing this purely with oci8 functionality I could get the output this way:

Code:
$p1 = 8;

$stid = oci_parse($conn, 'begin myproc(:p1, :p2); end;');
oci_bind_by_name($stid, ':p1', $p1);

oci_bind_by_name($stid, ':p2', $p2, 40);

oci_execute($stid);

print "$p2\n";   // prints 16

(example adapted from example 11)

Is there a way I can achieve this using the oci8 driver and database class in Codeigniter? I've looked around and I've had no luck yet.

Many thanks in advance.


Messages In This Thread
Getting output from a procedure using oracle databases - by El Forum - 04-09-2014, 01:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB