zoukankan      html  css  js  c++  java
  • ORA00933: SQL 命令未正确结束

    说明:数据库版本是 Oracle 10g express edition, 下面命令都在 Oracle 数据库主页中的 SQL 命令中执行、测试的。

    在 Oracle 的 SQL 命令中执行如下 SQL 语句:

    sql

    ORA-00933: SQL 命令未正确结束

    查阅了帮主文档,里面有这样一段说明:

    About Command Termination


    You can terminate a command in SQL Commands using a semicolon (;), a forward slash (/), or with nothing. Consider the following valid alternatives:

    SELECT * from emp;
    
    
    SELECT * from emp
    /
    
    
    SELECT * from emp
    
    

    The first example demonstrates the use of a semicolon (;), the second example demonstrates the use of forward slash (/), and the final example demonstrates a command with no termination.

    根据这里的说明,上面的代码却是看不出来有什么问题!

    在 CSDN 上某帖子看到有位兄弟的回答是这样的:

    sql

    用这种方法执行,成功插入。

    提示信息是:已处理语句。

    原来插入一行的提示信息是:已插入 1 行。
    然后我查阅了文档,看到关于 SQL command 的一点说明:

    A SQL command can contain SQL statements or PL/SQL blocks.

    所以问题应该是这样的:

    单条插入语句是一个 SQL statement, 直接执行即可;

    但如果多条插入语句一起执行就属于一个 PL/SQL block, 所以需要以执行一个 PL/SQL block 的方式去运行,PL/SQL block 结构是:

    delcare
    varlist
    begin
    dosomething
    end;

    完结
  • 相关阅读:
    php生成二维码
    赞的算法
    Linux系统信息查看命令大全
    详细介绍Linux telnet命令的使用
    Linux VSFTP服务器
    禁止浏览器缓存页面的方法
    php开启短标签
    BZOJ2648 SJY摆棋子(KD-Tree)
    KD-Tree学习笔记
    BZOJ5461 PKUWC2018Minimax(概率期望+线段树合并+动态规划)
  • 原文地址:https://www.cnblogs.com/linger/p/1879674.html
Copyright © 2011-2022 走看看