2009-07-31/22:57
Create A Table Using OCI
下面我们将建立一个email个人信息簿。这次采用OCI8 API指令
相关PHP代码:
PutEnv("ORACLE_SID=ORASID");
$connection = OCILogon ("username", "password");
if ($connection == false){
echo OCIError($connection)."
";
exit;
}
$query = "create table email_info " .
"(fullname varchar(255), email_address varchar(255))";
$cursor = OCIParse ($connection, $query);
if ($cursor == false){
echo OCIError($cursor)."
";
exit;
}
$result = OCIExecute ($cursor);
if ($result == false){
echo OCIError($cursor)."
";
exit;
}
OCICommit ($connection);
OCILogoff ($connection);
?>
我们可以看到这2段代码语法几乎都一样,区别仅仅函数名字不同; 其次,在OCI8中我们不需要专门运行打开游标的指令,在调用 OCIParse 系统就自动返回了一个游标ID.