用word,录制个宏,整理一下先
解决方案 »
- orange
- 为什么远程创建物化视图不成功
- mount.ocfs2: Device name specified was not found while opening device /dev/sdb2
- 请高手解决Oracle这个SQL语法兼容的问题
- Oracle里面这样查会影响效率吗?
- SI OBJECT BROWSER 8的注册机或注册码
- 请问导出数据是哪个权限
- 无法启动OracleOraHome81ManagementServer 服务。错误997:重叠I/O操作在进行中。
- 创建数据库时,如何根据情况选择数据库模式
- 我的数据库启动不了,怎么解决?
- w2000下安装oracle8,能否对solaris中的oracle7.2.x进行数据访问。net8如何连sql*net v1呢
- 大家来帮忙呀,有谁知道oracle、slq server、pb和mysql都有些啥日志?
请详细指教,最好给我代码
谢谢先
大哥,指明一条大路吧
1、到www.activeperl.com去下载一个activeperl5.6 MSI
2、安装 PERL3、你的文本文件示例:test.old
1 2 3 4 5
6 7
a b c d e
f g4、我的PERL程序:test.pl
$mycount=2;
open(FILE_OLD","TEST.OLD");
open(FILE_NEW",">TEST.NEW");
while(<FILE_OLD>)
{
chomp;
if ($mycount%2 == 0)
{print FILE_NEW $_." ";}
else
{print FILE_NEW $_."\n";}
$mycount++;
}
5、在命令窗口下执行 perl test.pl
6、得到一个新的文本文件:test.new,内容如下:1 2 3 4 5 6 7
a b c d e f g
Case 4: Loading Combined Physical Records
Case 4 demonstrates:
* Combining multiple physical records to form one logical record with CONTINUEIF; see Assembling Logical Records from Physical Records on
page 5-36.
* Inserting negative numbers.
* Indicating with REPLACE that the table should be emptied before the new data is inserted; see Loading into Empty and Non-Empty Tables on page 5-32.
* Specifying a discard file in the control file using DISCARDFILE; see Specifying the Discard File on page 5-27.
* Specifying a maximum number of discards using DISCARDMAX; see Specifying the Discard File on page 5-27.
* Rejecting records due to duplicate values in a unique index or due to invalid data values; see Rejected Records on page 5-26.Control File
The control file is ULCASE4.CTL:
LOAD DATA
INFILE ’ulcase4.dat’
1) DISCARDFILE ’ulcase4.dsc’
2) DISCARDMAX 999
3) REPLACE
4) CONTINUEIF THIS (1) = ’*’
INTO TABLE emp
(empno POSITION(1:4) INTEGER EXTERNAL,
ename POSITION(6:15) CHAR,
job POSITION(17:25) CHAR,
mgr POSITION(27:30) INTEGER EXTERNAL,
sal POSITION(32:39) DECIMAL EXTERNAL,
comm POSITION(41:48) DECIMAL EXTERNAL,
deptno POSITION(50:51) INTEGER EXTERNAL,
hiredate POSITION(52:60) INTEGER EXTERNAL)Notes:
1. DISCARDFILE specifies a discard file named ULCASE4.DSC.
2. DISCARDMAX specifies a maximum of 999 discards allowed before terminating the run (for all practical purposes, this allows all discards).
3. REPLACE specifies that if there is data in the table being loaded, then SQL*Loader should delete that data before loading new data.
4. CONTINUEIF THIS specifies that if an asterisk is found in column 1 of the current record, then the next physical record after that record should be appended to it to from the logical record. Note that column 1 in each physical record should then contain either an asterisk or a non-data value.Data File
The datafile for this case, ULCASE4.DAT, is listed below. Note the asterisks in the first position and, though not visible, a new line indicator is in position 20 (following "MA", "PR", and so on). Note that CLARK’s commission is -10, and SQL*Loader loads the value converting it to a negative number.
*7782 CLARK
MANAGER 7839 2572.50 -10 2512-NOV-85
*7839 KING
PRESIDENT 5500.00 2505-APR-83
*7934 MILLER
CLERK 7782 920.00 2508-MAY-80
*7566 JONES
MANAGER 7839 3123.75 2517-JUL-85
*7499 ALLEN
SALESMAN 7698 1600.00 300.00 25 3-JUN-84
*7654 MARTIN
SALESMAN 7698 1312.50 1400.00 2521-DEC-85
*7658 CHAN
ANALYST 7566 3450.00 2516-FEB-84
* CHEN
ANALYST 7566 3450.00 2516-FEB-84
*7658 CHIN
ANALYST 7566 3450.00 2516-FEB-84
你的建议是好的,sqlldr能不能实现我提的问题呢,因为这个生成的文件已经生成这样了,并且文件很大.能不能够实现我提的问题
atcg,你有qq或者email吗?
我的qq是:20341329
email:[email protected]
如果大家有好的方法,给我一个实例,我郁闷了一阵天了!!!
这个方法是可以解决问题的,但是每一行的第一个字符被去掉了
还有我的数据源的数据是定长的,没有带有特殊的标记!!
我其实已经给了你实例了,如上所说。
我的程序就是处理你的两行的文本,其功能是把两行合并为一行
即1,2行合并为一行,3,4行合并为一行,依此类推。
我几乎可以处理你任何格式的文本文件,给你做成任何格式的新文件。处理速度,100万行数据,生成新文件只需90秒,机器配置256M 内存。快吧,而且这样,会大大加快sqlldr的速度,不需要在sqlldr的时候再
做判断,这是首选,即在sqlldr之前先处理文本,我的程序是一劳永逸的
当然,你最好自己掌握一些方法,条条大路通罗马啊。
正所谓“笑一笑十少,愁一愁白了头”嘛,对不?
我认为把换行符去掉,就ok了。你认为呢?得到了正确答案别忘了告诉我呀,我的e_mail:[email protected]
谢谢!!!!!!!!!!!!!!!!
我的办法肯定是可行的,不过当然未必是最好的。不知两位
有没有试过,其实我已经把解决方案描述得很详细。100万行数据
只要90秒,很快了。
我知道你的办法是好了,但是生成的文件是非常大,如果再生成另外一个文件的话,空间会膨胀很大!这样的话,硬盘会需要很大!我想直接导入到数据库中
末尾都有一个TAB或空格,就可以按以下的方法LOAD.
1 2 3 4 5
6 7
a b c d e
f gload data
infile 'test.txt'
concatenate(2)
into table aa
fields terminated by whitespace
(FIELD1,FIELD2,FIELD3,FIELD4,FIELD5,FIELD6,FIELD7)
可惜我不会啊!
你什么东东不会啊?Perl吗?很简单的啦。一天入门,15天熟悉,一个月“精通”。真的啊!