Re: access stored proc
| From: | (Harry N. C. Ng) | Date: | Mon, 31 Dec 2001 18:43:15 +0000 |
| Subject: | Re: access stored proc | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15286@lists.php.net to get a copy of this message | ||
Here's one I used:
Example of Php program invoking a PL/SQL anonymous block. The block can
then call a PL/SQL compiled function or stored procedure on the
server. The OCIBindByName function is used to pass values into or out
of the PL/SQL anonymous block. In this example, a compiled PL/SQL
function on PRD1 (get_eicsum) is invoked. Two variables are passed
in (SCC and SIC) and one is returned (result).
<?php
$conn = OCILogon("scott","tiger","PRD1");
$result = 0;
$scc = 12345678;
$sic = 1234;
$stmt = OCIParse($conn, "begin :x := get_eicsum(:a, :b); end;");
OCIBindByName($stmt, ":x", &$result, 10);
OCIBindByName($stmt, ":a", &$scc, 9);
OCIBindByName($stmt, ":b", &$sic, 5);
OCIExecute($stmt);
echo "Result: $result<BR>";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>