Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have this sample records below, (16fields, comma delimited)

0116,01,84210870,10,FFFF,04061B22BF,639180000716,00,00,00,515050901775495,351824050673100,639255569174,F0,00,,
0116,03,84186940,10,FFFF,041E1AB770,639180000716,00,00,00,515050901378444,353681050728720,639328500332,F0,00,,

I'm gonna load it to the database using shell script (.ctl). My problem is, i dont know how to adjust records in the database fields. For example, if the second field is "01", the 11th field in my record will be in the 12th field once loaded in the database. The 11th field in the database will be blank then

if the second field is "03", the 11th and 12th record will stay where it is and the 13th field in my record will be in 14th in the database.

share|improve this question
1  
Kindly help me. This is urgent -- How would one connect to your system in order to load records in database for you? –  devnull Jun 25 at 2:44
    
I expect you need to learn how to use awk to transform the data before you load it. However, it is not very clear what the transform is based on your description. Read about awk then use it to apply your rules to the file before a bulk load. –  Hogan Jun 25 at 2:47
    
What are database fields, and why are they numeric in your nomenclature? Do you mean columns in a table? Do you have a schema? –  Elliott Frisch Jun 25 at 2:48
    
sqlldr and a .ctl file will do this from any shell- assuming oracle –  jim mcnamara Jun 25 at 2:53
    
@Hogan probably, i'm gonna transform the records first. But if the record in a field is blank, will it be loaded to the database as blank also? Sorry, I am new to this. –  user3003001 Jun 25 at 2:59
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.