php调用oracle存储

//todo 调用oracle 存储
$config = //数据库配置文件 里面包含 用户密码和host和端口以及dbname

$conn = oci_connect($config['username'], $config['password'], "(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=" . $config['host'] . ")(PORT = " . $config['port'] . "))(CONNECT_DATA =(SID=" . $config['dbname'] . ")))");
//若是本机上的数据库,可直接用PDO("oci:dbname=数据库",$db_username,$db_password);
$sql = "BEGIN pkg_ers_certificate.p_s_certificate_control(:id,:type,:message); END;";//(会计期:201612,凭证类型)
$stmt = oci_parse($conn, $sql);

// Bind the input parameter
oci_bind_by_name($stmt, ':id', $id, 32);
oci_bind_by_name($stmt, ':type', $type, 32);
oci_bind_by_name($stmt, ':message', $message, 32);
$id = implode(',',$params['id']);
$type = trim($params['type']);
oci_execute($stmt);
return $message;
posted @ 2017-01-17 15:45  KOBE-Jason  阅读(337)  评论(0编辑  收藏  举报