0

I have recently been given the task of taking a text file and writing it to a table. We are trying to avoid having to rewrite the entire project because of the business logic that takes place here.

We have a table with 128 columns and the text file is being generated by looping through all 128 categories and converting them to one long string separated by an '\t' like this:

1001\t1234\tBaseball\tetc. and it goes on for 128 fields.

My question is can I take this string and insert into a table separating by columns based on the '\t' value?

I appreciate any input at all.

Someone marked this as a duplicate to something clearly not what I asked at all,

This is NOT reading from a text file, I am trying to find out if there was a way using JDBC to write a string with delimiters separating fields of the string.

Norcal
  • 13
  • 5
  • AFAIK there is no library method that provides the functionality you want, you have to split the string and use the different parts to update the relevant columns. – Nir Alfasi Jan 31 '17 at 22:40
  • I didn't even think about that, basically split the string into 128 other strings based on that '\t'. Thanks, I was so wrapped up around an insert that I didn't think about that approach. This whole process has been a nightmare, we don't have the time to dedicate a complete rewrite to our feeds so I got stuck with the task of figuring out what an ex-employee did over a year ago. – Norcal Jan 31 '17 at 22:42
  • Some databases support loading tab delimited data. Postgres and MySQL do. – teppic Jan 31 '17 at 22:43
  • We would be using Oracle as the database. – Norcal Jan 31 '17 at 22:45

0 Answers0