Tuesday, 15 April 2014

plsql - Problems passing parameters in PL/SQL from php -



plsql - Problems passing parameters in PL/SQL from php -

it's first time i'm developing application pl / sql , have difficulties pass parameters php pl / sql. functions pl / sql created in database , when run next query, returns due parameters:

begin pin_username := 'admin'; pin_passwd := '1'; pout_message := null; retval := pkg_login.login_portal ( pin_username, pin_passwd, pout_message ); dbms_output.put_line('pin_username='||pin_username); dbms_output.put_line('pin_passwd='||pin_passwd); dbms_output.put_line('pout_message='||pout_message); commit; end;

now problem can not same in php. here code in php developed help of google:

include 'define.php'; require_once '../config/connectdb.php'; if(isset($_post['user']) && isset($_post['senha'])) { $utilizador = $_post['user']; $senha = $_post['senha']; $msg; //connection database if(!ligacaodb()) { echo "dont connect"; } $query = "begin :r := pkg_login.login_portal (:1, :2, :3); commit; end;"; $result = oci_parse(ligacaodb(), $query); oci_bind_by_name($result, ":1", $utilizador); oci_bind_by_name($result, ':2', $senha); oci_bind_by_name($result, ':3', $msg); oci_bind_by_name($result, ':r', $r); $xpto = oci_execute($result); if($xpto == false) { $e = oci_error($result); print htmlentities($e['message']); } else { echo $msg . " | " . $r; } oci_free_statement($result); oci_close(ligacaodb()); }

from understand plsql function, parameter receives user , password checks whether database , returns message , boolean represented msg , r.

does can help me , explain me might doing wrong?

have discovered reason. have same problem here answer:

http://docs.oracle.com/cd/e11882_01/appdev.112/e10646/oci03typ.htm#cegieeji

the next 2 types internal pl/sql , cannot returned values oci:

boolean, sqlt_bol

record, sqlt_rec

php plsql

No comments:

Post a Comment