创建和填充表oracle php时出现问题ORA-00933 ORA-00922 ORA-00928

时间:2019-05-09 10:42:00

标签: php oracle sqlplus

我一直在网站上使用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));
}
?>

1 个答案:

答案 0 :(得分:0)

(@ PonderStibbon已经在评论中回答了,我将其作为后继问题的答案-因此是Community Wiki。)

在最后一个将值插入表中的语句中,INSERT命令的语法不正确。正确的语法是:

INSERT INTO Branch VALUES (12)