文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9014.htm#i2064185

(DML_table_expression_clause::=)

values_clause::=


Description of the illustrationvalues_clause.gif

--可见values里头的语法:只有表达式 或者 默认 (既是如果columnlist中有存在列在设计表的时候有默认值,那么可以使用DEFAULT来代替任何值在 values_clause子句中。见下英文说明)

values_clause

For a single-table insert operation,specify a row of values to be inserted into the table or view. Youmust specify a value in the values_clause for each column inthe column list. If you omit the column list, then thevalues_clause must providevalues for every column in the table.

For a multitable insert operation, each expression inthe values_clause must refer tocolumns returned by the select list of the subquery. If you omitthe values_clause, then the selectlist of the subquery determines the values to be inserted, so itmust have the same number of columns as the column list of thecorresponding insert_into_clause. If you donot specify a column list in the insert_into_clause, then thecomputed row must provide values for all columns in the targettable.

For both types of insert operations, if you specify a column listin the insert_into_clause, then thedatabase assigns to each column in the list a corresponding valuefrom the values clause or the subquery. You can specify DEFAULT for any value in thevalues_clause.If you have specified a default value for thecorresponding column of the table or view, then that value isinserted.

If no default value for the corresponding column hasbeen specified, then the database inserts null.

--这说法似乎有点问题。当相关列不允许空值的时候,数据库插入操作会失败。需要说明各个列为空。这时候,你不指定默认值,那么插入就为NULL。

Please refer to "About SQL Expressions"and SELECT for syntax of valid expressions.

Note:

Parallel direct-path INSERT supports only the subquerysyntax of the INSERT statement, not thevalues_clause. Please refer toOracleDatabase Concepts for information on serial and paralleldirect-path INSERT.

Restrictions onInserted Values The value are subject tothe following restrictions:

  • You cannot insert a BFILE value until you haveinitialized the BFILE locator to null or to adirectory name and filename.

    See Also:

    • BFILENAME for information on initializing BFILEvalues and for an example of inserting into aBFILE

    • OracleCall Interface Programmer's Guide and Oracle Database Application Developer's Guide -Fundamentals for information on initializingBFILE locators

  • When inserting into a list-partitioned table, you cannot inserta value into the partitioning key column that does not alreadyexist in the partition_value list of one ofthe partitions.

  • You cannot specify DEFAULT when inserting into aview.

  • If you insert string literals into a RAW column,then during subsequent queries Oracle Database will perform a fulltable scan rather than using any index that might exist on theRAW column.

See Also:

  • "Using XML in SQL Statements" for information on insertingvalues into an XMLType table

  • "Inserting into a Substitutable Tables and Columns: Examples","Inserting Using the TO_LOB Function: Example", "Inserting Sequence Values: Example", and "Inserting Using Bind Variables: Example"

文档地址:http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/insert_statement.htm#LNPLS01325

 ---下边是比较重要的INSERT的语法。

INSERT Statement

TheINSERT statement adds one or more new rows of data toa database table. For a full description of the INSERTstatement, see Oracle Database SQL Reference.

Syntax

insert statement ::=


Description of the illustrationinsert_statement.gif

Keyword and ParameterDescription

alias

Another (usually short) name for the referenced table orview.

column_name[, column_name]...

A list of columns in a database table or view. The columns canbe listed in any order, as long as the expressions in theVALUES clause are listed in the same order. Eachcolumn name can only be listed once. If the list does not includeall the columns in a table, each missing columns is set toNULL or to a default value specified in theCREATE TABLE statement.

returning_clause

Returns values from inserted rows, eliminating the need toSELECT the rows afterward. You can retrieve the columnvalues into variables or into collections. You cannot use theRETURNING clause for remote or parallel inserts. Ifthe statement does not affect any rows, the values of the variablesspecified in the RETURNING clause are undefined. Forthe syntax of returning_clause, see "RETURNING INTO Clause".

sql_expression

Any expression valid in SQL. For example, it could be aliteral, a PL/SQL variable, or a SQL query that returns a singlevalue. For more information, see OracleDatabase SQL Reference. PL/SQL alsolets you use a record variable here.

---在SQL中任意一个表达式都有效。例如:可以是一个字符、一个PL/SQL变量、或者能够返回单独值的一个SQL查询。

subquery

A SELECT statement that provides a set of rows forprocessing. Its syntax is like that ofselect_into_statement without the INTOclause. See "SELECT INTO Statement".

subquery3

A SELECT statement that returns a set of rows. Eachrow returned by the select statement is inserted into the table.The subquery must return a value for every column in the columnlist, or for every column in the table if there is no columnlist.

table_reference

A table or view that must be accessible when you execute theINSERT statement, and for which you must haveINSERT privileges. For the syntax oftable_reference, see "DELETE Statement".

TABLE (subquery2)

The operand of TABLE is a SELECTstatement that returns a single column value representing a nestedtable. This operator specifies that the value is a collection, nota scalar value.

VALUES (...)

Assigns the values of expressions to corresponding columns inthe column list. If there is no column list, the first value isinserted into the first column defined by the CREATETABLE statement, the second value is inserted into thesecond column, and so on. There must be one value for each columnin the column list. The datatypes of the values being inserted mustbe compatible with the datatypes of corresponding columns in thecolumn list.

Usage Notes

Character and date literals in the VALUES list mustbe enclosed by single quotes ('). Numeric literals are not enclosedby quotes.

The implicit cursor SQL and the cursor attributes%NOTFOUND, %FOUND,%ROWCOUNT, and %ISOPEN let you accessuseful information about the execution of an INSERTstatement.

Insert语句的语法相关推荐

  1. uipath 执行 insert 语句报 “语法错误“ 的问题解决

    同样的 insert 语句在 navicat 里执行是正常的, 但是放到 uipath 流程里就报语法错误, 一脸懵逼. 解决: 排查了一下午最后发现 sql 语句中有个全角字符的空格, 这个坑爬了好 ...

  2. TiDB 源码阅读系列文章(十六)INSERT 语句详解

    在之前的一篇文章 <TiDB 源码阅读系列文章(四)INSERT 语句概览> 中,我们已经介绍了 INSERT 语句的大体流程.为什么需要为 INSERT 单独再写一篇?因为在 TiDB ...

  3. mariadb不能导入与mysql可以,mysql/mariadb知识点总结(12):insert语句总结

    这篇文章总结了mysql中的insert语句,delete.update.select等DML语句将会在其他文章中单独总结. 在本博客中,"mysql"是一个系列文章,这些文章主要 ...

  4. [C#]关于Access的“INSERT INTO 语句的语法错误”问题

    以下内容摘自网上资料,具体出处已找不到,在此对原文作者表示感谢和敬意! insert into 语句的语法错误经常会出现,主要原因是数据的字段名为access或sql数据库的保留字 解决的方法很简单, ...

  5. c mysql insert语句_MySQL_mysql insert详细讲解,INSERT语法 INSERT [LOW_PRIORITY |DELA - phpStudy...

    INSERT语法 INSERT [LOW_PRIORITY |DELAYED| HIGH_PRIORITY] [IGNORE] [INTO]tbl_name[(col_name,...)] VALUE ...

  6. 向Access中插入数据报“INSERT INTO 语句的语法错误” 解决

    因一直使用SQL,使用SQL数据有点浪费,所以决定用ACCESS做数据库,在进行查询的时候没有任何问题.可是一但在使用插入时就会出现insert into插入错误.刚在网上搜了下,发现一些网友也碰到此 ...

  7. ACCESS的System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误

    在开发中.大型WEB应用系统的时候,我们往往选择了ORACLE或者SQL SERVER,但当我们制作小型网站的后台管理系统时,小巧.简单.可随意迁移的ACCESS就成了我们的最爱,但是,用ACCESS ...

  8. Access“INSERT INTO 语句的语法错误”解决办法

    在程序中对Access数据库执行以下语句时报错:"INSERT INTO 语句的语法错误."但将该语句拷贝到Access中执行时,没有报错!且执行成功. insert into u ...

  9. ASP、Access、80040e14、保留关键字、INSERT INTO 语句的语法错误

    当字段名与保留字相同时,应用[] 加以区分,否则会出现Microsoft JET Database Engine 错误 '80040e14' INSERT INTO 语句的语法错误.Example: ...

最新文章

  1. 单列模式(懒汉)测试代码
  2. 中国拖拉机市场情况分析与发展趋势预测分析报告2022-2028年版
  3. cocos 新工程遇到的问题
  4. Tablestore入门手册-UpdateRow接口详解
  5. dataguard备库的数据文件的迁移
  6. 后台启动_Linux系统后台运行应用三板斧
  7. CUDA 和 GPU
  8. e4a生成r.java错误,编译时候出现英文错误
  9. python哈夫曼编码注意_[Python]哈夫曼编码
  10. 468.验证IP地址
  11. A better zip bomb,比例28000000:1「V2」
  12. 项目管理工具——5W1H分析法
  13. embed预览pdf_09.html使用iframe、embed查看pdf不显示(未解决),使用pdf.js预览pdf
  14. 致远OA单点登陆二次开发的实现(含源码)
  15. 阶的估计I 无穷小量与强函数2 Taylor公式 基本初等函数与三角函数的阶
  16. python二进制格式追加_Python追加/填充二进制文件添加garbag
  17. 读书感受 之 《跟美国幼儿园老师学早教》
  18. linux常用命令 cp命令的使用和介绍
  19. 补齐AI人才短板!百度飞桨师资培训高校行走进天津大学
  20. 中文词向量的下载与使用探索 (tensorflow加载词向量)

热门文章

  1. 理解电脑上的串口对应的端口号(com口)
  2. 助力白纸一般的你面试——宏任务微任务
  3. 安卓gpio操作示例
  4. 100多年前人们心中的2018年:部分预测已成现实
  5. 崩三类卡通渲染解析及制作规范
  6. toAppendStream doesn‘t support consuming update and delete changes which is produced by node XXX
  7. ldf 和mdf 各是数据库的什么文件?
  8. Ubuntu下Qt软件打包流程
  9. 微信开发之使用java获取签名signature
  10. rhel7 http实例