sqlloader导入数据失败Column not found before end of logical record (use TRAILING NULLCOLS)

1.问题描述

sqlloader导入数据失败,提示:

Column not found before end of logical record (use TRAILING NULLCOLS)

检查control文件和表结构都一一对应。

数据库版本12.2:

SQL> select * from v$version ;
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production              0
PL/SQL Release 12.2.0.1.0 - Production                                                    0
CORE	12.2.0.1.0	Production                                                                  0
TNS for Linux: Version 12.2.0.1.0 - Production                                            0
NLSRTL Version 12.2.0.1.0 - Production                                                    0

2. 问题处理

因为数据中有中文,考虑数据无法导入是字符集的问题。
检查数据库字符集和Linux环境变量:

数据库字符集:AMERICAN_AMERICA.ZHS16GBK

SQL> select userenv('language') from dual;
AMERICAN_AMERICA.ZHS16GBK

Linux环境变量:

$ echo $NLS_LANG
AMERICAN_AMERICA.ZHS16GBK

两者一致!
处理方法,使用字符集超集AL32UTF8:

$ export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

使用sqlloader ,导入成功,不再报错!

可能原因是:

AL32UTF8:一个汉字占三个字节;
ZHS16GBK:一个汉字占两个字节;

因为数据中有中文,考虑数据无法导入是字符集的问题。使用sqlloader ,导入成功,不再报错!检查control文件和表结构都一一对应。AL32UTF8:一个汉字占三个字节;ZHS16GBK:一个汉字占两个字节;
Many SQL texts attempt to serve as an encyclopedic reference on SQL syntax — an approach that is often counterproductive, because that information is readily available in online references published by the major database vendors. For SQL beginners, it’s more important for a book to focus on general concepts and to offer clear explanations and examples of what various SQL statements can accomplish. This is that book. A number of features make The Language of SQL unique among introductory SQL books. First, you will not be required to download software or sit with a computer as you read the text. The intent of this book is to provide examples of SQL usage that can be understood simply by reading. Second, topics are organized in an intuitive and logical sequence. SQL keywords are introduced one at a time, allowing you to grow your understanding as you encounter new terms and concepts. Finally, this book covers the syntax of three widely used databases: Microsoft SQL Server, MySQL, and Oracle. Special “Database Differences” sidebars clearly show you any differences in syntax among these three databases, and instructions are included on how to obtain and install free versions of the databases. This is the only book you need to gain a quick working knowledge of SQL and relational databases. Learn How To… Use SQL to retrieve data from relational databases Apply functions and calculations to data Group and summarize data in a variety of useful ways Use complex logic to retrieve only the data you need Update data and create new tables Design relational databases so that data retrieval is easy and intuitive Use spreadsheets to transform your data into meaningful displays Retrieve data from multiple tables via joins, subqueries, views, and set logic Create, modify, and execute stored procedures Install Microsoft SQL Server, MySQL, or Oracle
有这么一个数据,按照一分钟统计数据的查询数,字段内容: stat_date date, stat_num number(10) stat_date表示统计日期,stat_num表示统计数目 数据如下: 2009-0...
1. sql loader里有几个概念: 控制文件:和数据库的文件不是一回事,个人理解是用于数据加载控制的。 数据文件:要加载入库的数据文件,支持文本,csv, 等格式。 数据文件的内容可以放在控制文件的最后。 ×注意:最好数据记录之间不
最近做javaWeb项目,出现了一个小插曲java.sql.SQLException: Column ’ name ’ not found,首先分析出现小插曲的本质问题: 1、查询语句是否有问题 2、是否有name 3、或者就是实体映射问题,实体类没有name 就拿我当时的小插曲做个简单分析喽! 首先我的查询语句:findRownumberMax="SELECT MAX(rownumbername...
The logical '||' operator is used in programming languages to perform a logical OR operation. When using the '||' operator, if any of the operands (either constant or variable) evaluate to true, the result of the expression will be true. If both operands are false, then the result will be false. Here's an example of using the logical '||' operator with a constant operand in C++: ```cpp #include <iostream> using namespace std; int main() { int age = 25; if (age < 18 || age > 60) { cout << "You are either under 18 or over 60." << endl; } else { cout << "You are between 18 and 60." << endl; return 0; In this example, the logical OR operator '||' is used to check if the age variable is either less than 18 or greater than 60. If either condition is true, the message "You are either under 18 or over 60" will be displayed. Otherwise, the message "You are between 18 and 60" will be displayed. You can also use constants as operands with the logical '||' operator in a similar way to variables. The behavior remains the same; if any of the operands (constant or variable) evaluate to true, the overall result will be true.