[英]parsing oracle 11g
I have the following snippet of a file that needs parsing : 我有一个需要分析的文件的以下片段:
000000837002100302015-04-13-15.55.12.1922082015-04-1300032128CHECK CLEARED CHECK CLEARED 00000000000030000000000000000000000000000000016594703
The respective positions for the string are as follows: 字符串的相应位置如下:
RECORD1 - POS (1 :10 ) - DUR 10
RECORD2 - POS (11 :13 ) - DUR 3
RECORD3 - POS (14 :17 ) - DUR 4
RECORD4 - POS (18 :43 ) - DUR 26
RECORD5 - POS (44 :53 ) - DUR 10
RECORD6 - POS (54 :61 ) - DUR 8
RECORD7 - POS (62 :95 ) - DUR 34
RECORD9 - POS (96 :215) - DUR 120
RECORD10 - POS (216:233) - DUR 18
RECORD11 - POS (234:251) - DUR 18
RECORD12 - POS (252:266) - DUR 15
RECORD13 - POS (267:268) - DUR 2
I need to parse the string to extract these records from that string. 我需要解析字符串以从该字符串中提取这些记录。 Can anyone help with the substr/instr functionality to account for the string and blank spaces.
任何人都可以使用substr / instr功能来解决字符串和空格问题。 The extracted data would then get inserted into a table.
然后将提取的数据插入到表中。 Thank you in advance!
先感谢您!
Can you not simply use a sqlloader control file eg 您能不能简单地使用sqlloader控制文件,例如
echo "OPTIONS (DIRECT=TRUE)"
echo "LOAD DATA"
echo "INFILE '/path/to/file/$1'"
echo "BADFILE '/path/to/file/log/$1.bad'"
echo "DISCARDFILE '/path/to/file/log/$1.dsc'"
echo "APPEND INTO TABLE table.t"
echo "("
echo " RECORD1 POSITION (1:10),"
echo " RECORD2 POSITION (11:13),"
etc...
echo ")"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.