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;

    完结
  • 相关阅读:
    C++函数声明与定义
    《寻找发帖“水王”》代码的理解
    将正整数转换为二进制数
    使用Cookie记住登录用户
    Java组合算法
    已知链表头结点指针head,写一个函数把这个链表逆序
    String.IsNullOrEmpty官方示例
    log4net的使用
    asp.net MVC4总结
    点击获取页面上的经纬度
  • 原文地址:https://www.cnblogs.com/linger/p/1879674.html
Copyright © 2011-2022 走看看