问题描述
正如我在许多站点上看到的那样,如果要创建INSERT ALL
,则必须以SELECT (Like SELECT * FROM dual;)
As I seen on many sites, if I want to make an INSERT ALL
, I have to finish it with a SELECT (Like SELECT * FROM dual;)
为什么?
推荐答案
根据INSERT ALL的语法,子查询是必需的(请参阅 http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#i2111652 )
A subquery is mandatory per the syntax of INSERT ALL (see http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#i2111652)
对于子查询返回的每一行(即SELECT语句)执行insert子句. SELECT * FROM dual返回单个行,因此insert_clause(s)仅执行一次(当您要插入一组硬编码的值时,这很有用)
the insert clause is executed for each row returned by the subquery (i.e. the SELECT statement). SELECT * FROM dual returns a single row, so the insert_clause(s) is executed once (which is useful when you want to insert a hardcoded set of values)
这篇关于为什么我们必须在“全部插入"之后进行选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!