Entry
Can I execute Oracle stored procedures in PHP?
Do I have access to Oracle OUT parameters in PHP?
How do I access Oracle stored procedure return values in PHP?
Aug 22nd, 2002 13:05
Eyzen Medina, Nathan Wallace, Aaron Leon Kaplan
For binding to an stored procedure OUT variable see the documentation
for Oracle 8 (OCI) -> OCIBindByName. Perfeclty simple.
Return values: I use an extra OUT variable for each stored proc. called
errnum. That is my return value. I bet you could do functions with
return values in OCI but I havent tried it yet. The other retun value
(that you probably don't mean) is the return value of the OCI Execute
stmt. That just says if your PL/SQL query worked or if there was some
ora-xxxx error.
Un ejemplo simple socio
un PL llamado LISTAR_TASACV con dos parametros OUT.
--------------------------------------------
$conn = ocilogon($USERNAMEDATA,$PASSWORDATA,$DATABASENAME);
$stmt = OCIParse($conn,"begin LISTAR_TASACV
(:Pv_Tasa_Colones,:Pv_Tasa_Dolares); end;");
ocibindbyname($stmt,":Pv_Tasa_Colones",$Tasa_Colones,32);
ocibindbyname($stmt,":Pv_Tasa_Dolares",$Tasa_Dolares,32);
if (!$stmt) {
$err = OCIError($conn);
# Do Something...
die();
}
if(!OCIExecute($stmt)){
$err = OCIError($stmt);
# Do Something...
die();
}
@OCIFreeStatement($stmt);
@OCIFreeCursor($stmt);
@OCILogOff($conn);
--------------------------------------------
Despues de esto las varibles $Tasa_Colones y $Tasa_Dolares van a tener
los valores devueltos por el PL.
:) Gracias
Ing. Eyzen Medina