Oracle SQL加载器中Insert和Append语句的区别? 可以告诉我在SQL加载器中插入和追加语句的区别吗?请考虑下面的例子: 这是我的控制文件 load_1.ctl load data infile 'load_1.dat' "str '\r\n'" insert*/+append/* into table sql_loader_1 ( load_time sysdate, field_2 position( 1:10), field_1 position(11:20) )
这是我的数据文件Oracle SQL加载器中Insert和Append语句的区别? 可以告诉我在SQL加载器中插入和追加语句的区别吗?请考虑下面的例子: 这是我的控制文件 load_1.ctl load data infile 'load_1.dat' "str '\r\n'" insert*/+append/* into table sql_loader_1 ( load_time sysdate, field_2 position( 1:10), field_1 position(11:20) ),oracle,sql-loader,Oracle,Sql Loader,这是我的数据文件 load_1.dat 0123456789abcdefghij **********########## foo bar here comes a very long line and the next is short 问题比较清楚,;在加载到空表时使用INSERT,在向(可能)包含(要保留的)数据的表中添加行时使用APPEND 如果您的表为空,APPEND仍然有效插入可能更安全,因
load_1.dat
0123456789abcdefghij
**********##########
foo bar
here comes a very long line
and the next is
short
问题比较清楚,;在加载到空表时使用INSERT
,在向(可能)包含(要保留的)数据的表中添加行时使用APPEND
如果您的表为空,
APPEND
仍然有效<如果希望表为空,则代码>插入可能更安全,因为如果表为空,则会出错,可能会避免意外的结果(特别是如果您没有注意到并且没有收到其他错误,如违反唯一索引约束)和/或加载后数据清理。区别在于两点:
- append仅在语句末尾添加记录
- insert将插入任意位置,即如果表有10列,则只能在5列中插入,但在append中不能插入
希望对您有所帮助insert也会将行添加到表中,append也会做同样的事情…这有什么主要区别?您能解释清楚吗?即使在我阅读了document@Rajesh:
INSERT
仅在表为空时添加行;如果表不是空的,那么它将出错<代码>追加将添加行,无论表是否为空。