且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HSQLDB将文本表文件导入到传统表中

更新时间:2022-11-03 08:01:43

意外令牌错误是语法错误。这表示版本2.x不支持此语法。

The unexpected token error is a syntax error. It means this syntax is not supported in version 2.x.

数据异常错误表示某些字符串存储在TEXT表太大,无法插入CACHED表的字段中。尝试查询,例如:

The data exception error means some string stored in the TEXT table is too large to insert into the field in the CACHED table. Try a query such as:

SELECT MAX(CHAR_LENGTH(UD_MDC_CODE)), MAX(CHAR_LENGTH(DRUG_GNR_NAME)), MAX(CHAR_LENGTH(DRUG_PRODUCT_NAME)) FROM textfiletable 

查看结果并将最大长度与列的大小进行比较 normaltable 。例如,如果UD_MDC_CODE的MAX值为29,则必须将该列增大。可以使用以下语句将列的大小更改为30:

look at the result and compare the maximum lengths with the column size of the normaltable. For example, if the MAX value for UD_MDC_CODE is 29, then you have to make this column larger. This can be done using this statement which changes the size of the column to 30:

ALTER TABLE normaltable ALTER COLUMN UD_MDC_CODE SET DATA TYPE VARCHAR(30)

仅对大小小于MAX值的列使用ALTER TABLE语句。对所有太小的列完成此操作后,请使用INSERT INTO语句将数据从TEXT表复制到CACHED表。此处记录了ALTER TABLE语句:

Use the ALTER TABLE statement only for columns that have a smaller size than the MAX value. When you have done this for all the columns that are too samll, use your INSERT INTO statement to copy the data from the TEXT table to the CACHED table. The ALTER TABLE statement is documented here:

http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_table_manupulation