Shell script for insert multiple records into a Database

I have a table in an Informix DB into which I want to insert multiple records at a time. Data for one of the column should be unique & other column data may be the same for all the records I insert

Typical Insert Statement I use to insert one row :

insert into employee(empid, country, state) values(1, us, ca)

Now I want to pass different values for the 'empid' column, & data in rest of the columns can remain the same.

I am looking for something like looping empid & prompting user to enter the Start & End range of values for empid When User enters Start Value as 1 & End Value as 100, the script should inset 100 records with empid's from 1 to 100

you should post what you have done so far so people can see where you are getting stuck ...

I am new to this area and so I am seeking some help

Start with this script:

#!/bin/bash
printf "empID lo: "
read empID_lo
printf "empID hi: "
read empID_hi
printf "country: "
read country
printf "state: "
read state
printf "value #1/3: "
read val1
printf "value #2/3: "
read val2
printf "value #3/3: "
read val3
ei=$empID_lo
while [ $ei -le $empID_hi ]
do
 echo "employee($ei, $country, $state) values($val1, $val2, $val3)" 
 ei=$(($ei+1))
done

That didnt work
See an error with the line where there is while statement

If you have large no records to insert into databse..instead of using the loop to insert the records..then use sqlldr command.

Here you can put all of your records in a csv file...the control file contains the details like where will be the csv file location.

 
sqlldr $usrname\@dbname/password control=data.ctl log=logfile bad=out.bad discard=data.discard data=data.csv silent=all