PHP passes value to Oracle stored procedure
My client wrote a stored procedure on the Oracle server and he told me the stored procedure name (PRO), database name, tnsname, access password, data table name, and 5 field names.
Now I'm going to call this Oracle stored procedure remotely on my PHP program, which is simple enough to pass 5 PHP variable values to 5 fields in the stored procedure (PRO), namely S_a, S_b, S_c, S_d, S_e
In addition, the stored procedure (PRO) Returns a result value after receiving the above 5 values, the field name is S_f
How to write the specific code?
I pay all my points to the master who can solve my problem!!
------Solution--------------------
PHP code
$user = "Scott"; Database user name $password = "Tiger"; Password $conn_str = "Tnsname"; Connection string (cstr:connection_string) $remote = TRUE//Whether remote connect if ($remote) {$conn = Ocilogon ($user, $password, $conn _str);} else {$conn = Ocilogon ($user, $password);} $a = ' s_a '; $b = ' s_b '; $c = ' S_c '; $d = ' s_d '; $e = ' s_e '; $sql _sp = "BEGIN proc_test (: A,: B,:c,:d,: E); END; "; /parse$stmt = Ociparse ($conn, $sql _sp);//Execute Binding ocibindbyname ($stmt, ": A", $a, 30); Ocibindbyname ($stmt, ": B", $b, +), Ocibindbyname ($stmt, ": C", $c, +) Ocibindbyname ($stmt, ":d", $d, +); Ocibindbyname ( $STMT, ": E", $e, +); Ociexecute ($stmt);
Code Geek recommended Solution: Oracle stored procedure, http://www.daimami.com/oracle-develop/177537.html