-1

Can we write a control file such that the FIELDS TERMINATED BY length of characters in text file

For example if i have a data as listed below

123565966643
984635164666
6164654 2423

can we terminate it by 3 characters such that it would be 123,565,966,643 and get inserted in to the table accordingly.

If we can do it by a java program also kindly let me know.

  • `FIELDS TERMINATED BY` is used when the record length is variable and the fields are delimited by a character (such as with a CSV file). In your case, it seems your file is a fixed width format file (i.e. the first 3 digits are field 1, the next 3 digits are field 2, etc.). – Jeffrey Kemp Jan 22 '15 at 04:08

1 Answers1

0

Control file snippet:

...
field_1 POSITION(1:3) 
field_2 POSITION(4:6) 
field_3 POSITION(7:9) 
...

Unless you have a typo in the 3rd field of the 3rd record, that will cause you trouble though if that's going into a numeric column.

Gary_W
  • 9,933
  • 1
  • 22
  • 40