SQL Loader 中的 Insert 和 Append 语句之间的区别?
谁能告诉我 SQL Loader 中 Insert 和 Append 语句之间的区别?请考虑以下示例: 这是我的控制文件
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)
)
这是我的数据文件
load_1.dat
0123456789abcdefghij
**********##########
foo bar
here comes a very long line
and the next is
short
Can any one tell me the Difference Between Insert and Append statement in SQL Loader?consider the below example :
Here is my control file
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)
)
Here is my data file
load_1.dat
0123456789abcdefghij
**********##########
foo bar
here comes a very long line
and the next is
short
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
文档相当清楚;当您加载到空表中时,请使用 INSERT;当向(可能)包含(您想要保留的)数据的表中添加行时,请使用
APPEND
。如果您的表为空,
APPEND
仍然有效。如果您期望表为空,则 INSERT 可能会更安全,因为如果不是这样,它会出错,可能会避免意外结果(特别是如果您没有注意到并且没有得到其他错误(例如唯一索引约束违规)和/或加载后数据清理。The documentation is fairly clear; use
INSERT
when you're loading into an empty table, andAPPEND
when adding rows to a table that (might) contains data (that you want to keep).APPEND
will still work if your table is empty.INSERT
might be safer if you're expecting the table to be empty, as it will error if that isn't true, possibly avoiding unexpected results (particularly if you don't notice and don't get other errors like unique index constraint violations) and/or a post-load data cleanse.区别有两点很明显:
另外,您的数据和表应该具有相同的列,这意味着在行级别而不是列级别插入数据
,而且如果您的表有数据(如果它是空的),那么您就不能使用插入,那么只有您可以使用插入。
希望有帮助
The difference are in two points clear:
in append both your data and the table should have same columns means insert data in row level rather than in column level
and it's also true you cannot use insert if your table have data if it's empty then only you can do use insert.
hope it helps