簡體   English   中英

問題創建和填充表oracle php ORA-00933 ORA-00922 ORA-00928

[英]Problem creating and populating table oracle php ORA-00933 ORA-00922 ORA-00928

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

(@PonderStibbon已在評論中回答,我正在將其作為后綴的答案 - 因此社區Wiki。)

在最后一個語句中,您將值插入表中, INSERT命令的語法不正確。 正確的語法是:

INSERT INTO Branch VALUES (12)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM