Procedures, functions and triggers can be created using PHP. For example, to create the
procedure myproc the code is:
<?php
$c = oci_connect('hr', 'hrpwd', '//localhost/XE');
$plsql = "create or replace procedure "
. "myproc(d_p in varchar2, i_p in number) as "
. "begin "
. "insert into mytab (mydata, myid) values (d_p, i_p);"
. "end;";
$s = oci_parse($c, $plsql);
$r = oci_execute($s);
if ($r) {
echo 'Procedure created';
}
?>
Note that there is a semi-colon after the PL/SQL keyword end, which is different to the way
SQL statements are written.
|