how to insert data into database by reading it from a text file??

Hi....can you guys help me out in this script??

Below is a text file and it contains these:

GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005678 000001 000000 000000 000000 000000 000000 000001
I would like the first 3 columns of data to be read by the script to insert into the database.
The database table is IMSERNOS
and its contains 3 fields..namely:
ImiCode varchar2(6),
CustNo varchar2(9),
SerNo varchar2(9)

How to create a script that reads the data and insert this data into the database?

im having a headache now on working on this scripts....hope you(expertists) can help :slight_smile: a million thanks :slight_smile:

what have you got so far, what do you use to process the SQL statements?

am not getting how to start with this... am searching for answers in google and getting confused wit everything

#!/bin/bash

function processline
{
    ImiCode=$1
    CustNo=$2
    SerNo=$3
    SQL="insert into IMSERNOS (ImiCode,CustNo,SerNo) values ('$ImiCode','$CustNo','$SerNo')"
    echo $SQL
}

while read line
do
    processline $line
done

call the above like

<text.file |processfile >sql.output

which should give you nicely formatted sql statements for further processing

thank you so much for the quick reply....
i wil start wit this script....