我一直在网站上使用Oracle数据库,但是在拖放,创建或插入表时却遇到错误。
拖放给出
警告:oci_execute():ORA-00933:SQL命令未正确结束
创造礼物
警告:oci_execute():ORA-00922:缺少或无效的选项
插入给予
警告:oci_execute():ORA-00928:缺少SELECT关键字
编辑:(固定插入)
<?php
putenv("ORACLE_SID=teaching");
if ($Connection = oci_connect("username", "password")){
$sql = "DROP table BRANCH;";
$Statement = oci_parse($Connection, $sql);
oci_execute($Statement);
//drop rest of tables
$sql = "CREATE TABLE Branch
(Branch# Number,
PRIMARY KEY(Branch#));";
$Statement = oci_parse($Connection, $sql);
oci_execute($Statement);
//create rest of tables
$sql = "INSERT INTO Branch VALUES (12);";
$Statement = oci_parse($Connection, $sql);
oci_execute($Statement);
//insert rest of data
oci_close($Connection);
}else{
var_dump(oci_error($Connection));
}
?>
答案 0 :(得分:0)
(@ PonderStibbon已经在评论中回答了,我将其作为后继问题的答案-因此是Community Wiki。)
在最后一个将值插入表中的语句中,INSERT
命令的语法不正确。正确的语法是:
INSERT INTO Branch VALUES (12)