I have shell script with following code:
#! /bin/bash
MODEL=$1
declare -a arr=("porsche" "lamborgini" "tesla")
for i in ${arr[@]}
do
sqlplus -s un/pass <<!
set verify off
INSERT INTO tbl1 (par1, par2, par3, datetime_parm)
VALUES('$MODEL', '${arr[i]}', (select count(s) from table i), SYSTIMESTAMP);
COMMIT;
exit;
!
done
For some reason it is overwriting the previous value it gets from the array and i ends up only populating the table with 'tesla'.
Does anyone know what i am doing wrong?