Need Suggestion

Hi,

I have the requirement to run multiple SQLs against database running on a server and save the output of SQL executed to a log.

I thought about writing a Function in sh that will take file name as argument and function should return the SQL output to calling program. E.g.

function Run_SQL {
    vSQL=$1

    vSPOOL=`sqlplus -L -s dbuser/dbuser@$ORACLE_SID<<EOF
		set pagesize 200 feedback off lines 100
		@@$SCRIPT_HOME/${vSQL}
        exit;
EOF`

echo $vSPOOL
}

This function I am planning to call multiple times for all SQL files that need to be executed one by one.

Can someone please suggest if the approach I used is correct or is there a better way to achieve it. I am a novice to shell scripting.

Thanks a lot for your time.