SQL Script

Hi guys,

Can you help me on below scenario.

I want to run insert statements from shell script.

The script should create the insert statements(format is fixed and parameters are so). The insert statement should get values from txt file or csv file and they should be passed by reading the txt file.

I can create the statement and execute directly but the problem is the insert statement is variyng daily and i cannot create that's why i am thinking of directly passing parametes using txt or csv file as parameters to insert script.
Shell script should read the file, pass the parameter from file to insert statement and execute those.

Can you help on this.

Thanks in advance..

Can you share the template .txt and .csv files?

Below sample should help u, but if u not able to code teh below 2 functions then it will be hard.

sqlplus -s <---- this will take care of the auto insert part, but b4 that the insert script with COMMIT should be ready.

CreateInsert()
{
###using the $CreateInsert, create or frame the insert query and redirect it to a file $SQLFile
}

ExecuteInsert()
{
    sqlplus -s $orauser/$orapwd @${SQLFile} "$tempFile" 2> $OraErrFile
}

###MAIN
read inputFileName

CreateInsert "$CreateInsert"
ExecuteInsert "$SQLFile"

Note: orauser and orapwd should be set.